about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-10-30 12:15:00 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-10-30 12:15:00 -0700
commitcc569af1ad7acf349c9fa1f721a7faa97b3ad79e (patch)
treec6c85b0edfd1e134f34ff6c223fcdce5338001d4
parent3ac371894204b85b7385a38480576e3db2c22b85 (diff)
downloadmu-cc569af1ad7acf349c9fa1f721a7faa97b3ad79e.tar.gz
4096
-rw-r--r--056shape_shifting_recipe.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/056shape_shifting_recipe.cc b/056shape_shifting_recipe.cc
index 36c405ec..47d53804 100644
--- a/056shape_shifting_recipe.cc
+++ b/056shape_shifting_recipe.cc
@@ -127,16 +127,16 @@ recipe_ordinal best_shape_shifting_variant(const instruction& inst, const vector
     if (score > max_score) max_score = score;
   }
   // break any ties at max_score by a secondary score
-  int min_score2 = 999;
+  int max_score2 = -999;
   int best_index = 0;
   for (int i = 0;  i < SIZE(candidates);  ++i) {
     int score1 = number_of_concrete_type_names(candidates.at(i));
     assert(score1 <= max_score);
     if (score1 != max_score) continue;
     int score2 = shape_shifting_tiebreak_heuristic(inst, candidates.at(i));
-    assert(score2 < 999);
-    if (score2 < min_score2) {
-      min_score2 = score2;
+    assert(score2 > -999);
+    if (score2 > max_score2) {
+      max_score2 = score2;
       best_index = i;
     }
   }
@@ -145,8 +145,8 @@ recipe_ordinal best_shape_shifting_variant(const instruction& inst, const vector
 
 int shape_shifting_tiebreak_heuristic(const instruction& inst, const recipe_ordinal candidate) {
   const recipe& r = get(Recipe, candidate);
-  return (SIZE(r.products) - SIZE(inst.products))
-       + (SIZE(inst.ingredients) - SIZE(r.ingredients));
+  return (SIZE(inst.products) - SIZE(r.products))
+       + (SIZE(r.ingredients) - SIZE(inst.ingredients));
 }
 
 bool any_type_ingredient_in_header(recipe_ordinal variant) {