From 048a33c24fe4b1e937391693e3556e1edfdbfbcd Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 27 Sep 2016 10:28:14 -0700 Subject: 3422 Stop checking the number of ingredients and products when picking shape-shifting recipes. That's more consistent with how we handle regular recipes, and we still get errors in all the examples I can think of: reverse # no ingredients or products n:num <- length # no ingredients; products don't provide type --- 056shape_shifting_recipe.cc | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to '056shape_shifting_recipe.cc') diff --git a/056shape_shifting_recipe.cc b/056shape_shifting_recipe.cc index 49b6fcdf..a389bd65 100644 --- a/056shape_shifting_recipe.cc +++ b/056shape_shifting_recipe.cc @@ -109,21 +109,13 @@ vector strictly_matching_shape_shifting_variants(const instructi } bool all_concrete_header_reagents_strictly_match(const instruction& inst, const recipe& variant) { - if (SIZE(inst.ingredients) < SIZE(variant.ingredients)) { - trace(9993, "transform") << "too few ingredients" << end(); - return false; - } - if (SIZE(variant.products) < SIZE(inst.products)) { - trace(9993, "transform") << "too few products" << end(); - return false; - } - for (int i = 0; i < SIZE(variant.ingredients); ++i) { + for (int i = 0; i < min(SIZE(inst.ingredients), SIZE(variant.ingredients)); ++i) { if (!concrete_type_names_strictly_match(variant.ingredients.at(i), inst.ingredients.at(i))) { trace(9993, "transform") << "concrete-type match failed: ingredient " << i << end(); return false; } } - for (int i = 0; i < SIZE(inst.products); ++i) { + for (int i = 0; i < min(SIZE(inst.products), SIZE(variant.ingredients)); ++i) { if (is_dummy(inst.products.at(i))) continue; if (!concrete_type_names_strictly_match(variant.products.at(i), inst.products.at(i))) { trace(9993, "transform") << "strict match failed: product " << i << end(); -- cgit 1.4.1-2-gfad0