def test_choose_sort_3_avoid_too_much_of_1_ingredient(self): witch_state = Witch((3, 0, 0, 0), 0) sorts = [ CastAction((-1, 4, 0, 0), 0, 1, 0, 0, True, True), CastAction((-1, 1, 1, 1), 0, 2, 0, 0, True, True), ] potions = [ BrewAction((1, 1, 1, 1), 0, 5, 0, 0, True, True), ] sort = witch_state.find_best_cast(sorts, potions) self.assertEqual(2, sort.action_id) sort = witch_state.find_best_cast(sorts[::-1], potions) self.assertEqual(2, sort.action_id)
def test_choose_sort_max_10(self): witch_state = Witch((3, 0, 0, 0), 0) sorts = [ CastAction((-1, 10, 0, 0), 0, 1, 0, 0, True, True), CastAction((-1, 2, 0, 0), 0, 2, 0, 0, True, True), ] potions = [ BrewAction((1, 1, 1, 1), 0, 5, 0, 0, True, True), ] sort = witch_state.find_best_cast(sorts, potions) self.assertEqual(2, sort.action_id) sort = witch_state.find_best_cast(sorts[::-1], potions) self.assertEqual(2, sort.action_id)