From 3a97dba0cb6e6e9e414132e068b4a0f794fc4d3d Mon Sep 17 00:00:00 2001 From: Jeremy Saklad Date: Tue, 6 Jul 2021 11:25:15 -0500 Subject: [PATCH] Change names of DiplomatFascination members The new names are more consistent with other enumerations, namely Declaration and Fluctuation. --- Bone Market Solver.py | 52 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Bone Market Solver.py b/Bone Market Solver.py index 90558bb..4264542 100644 --- a/Bone Market Solver.py +++ b/Bone Market Solver.py @@ -1159,12 +1159,12 @@ class Buyer(Enum): cost = Cost.ACTION.value ) - THE_TRIFLING_DIPLOMAT_ANTIQUE = Action( + THE_TRIFLING_DIPLOMAT_ANTIQUITY = Action( "Sell the Diplomat an antique skeleton", cost = Cost.ACTION.value ) - THE_TRIFLING_DIPLOMAT_FOSSIL_FISH = Action( + THE_TRIFLING_DIPLOMAT_FISH = Action( "Sell the Diplomat a fossil fish", cost = Cost.ACTION.value ) @@ -1197,9 +1197,9 @@ class OccasionalBuyer(Enum): class DiplomatFascination(Enum): """The current requirements of the Trifling Diplomat.""" - ANTIQUITY = Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUE + ANTIQUITY = Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUITY - FOSSILISED_FISH = Buyer.THE_TRIFLING_DIPLOMAT_FOSSIL_FISH + FISH = Buyer.THE_TRIFLING_DIPLOMAT_FISH def Solve(shadowy_level, bone_market_fluctuations, zoological_mania, occasional_buyer = None, diplomat_fascination = None, desired_buyers = [], maximum_cost = cp_model.INT32_MAX, maximum_exhaustion = cp_model.INT32_MAX, time_limit = float('inf'), workers = cpu_count(), stdscr = None): @@ -2125,58 +2125,58 @@ def Solve(shadowy_level, bone_market_fluctuations, zoological_mania, occasional_ model.Add(added_exhaustion == 0).OnlyEnforceIf(actions[Buyer.THE_CARPENTERS_GRANDDAUGHTER]) - # The Trifling Diplomat - Antique - model.Add(skeleton_in_progress >= 100).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUE]) - model.Add(antiquity >= 5).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUE]) + # The Trifling Diplomat - Antiquity + model.Add(skeleton_in_progress >= 100).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUITY]) + model.Add(antiquity >= 5).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUITY]) - antiquity_squared = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUE.name, 'antiquity squared')) + antiquity_squared = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUITY.name, 'antiquity squared')) model.AddMultiplicationEquality(antiquity_squared, [antiquity, antiquity]) - value_remainder = model.NewIntVar(0, 49, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUE.name, 'value remainder')) + value_remainder = model.NewIntVar(0, 49, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUITY.name, 'value remainder')) model.AddModuloEquality(value_remainder, value, 50) - model.Add(primary_revenue == value - value_remainder + 50).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUE]) - model.Add(secondary_revenue == 50*antiquity_squared).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUE]) + model.Add(primary_revenue == value - value_remainder + 50).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUITY]) + model.Add(secondary_revenue == 50*antiquity_squared).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUITY]) # TODO: Add actual difficulty level - model.Add(difficulty_level == 0).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUE]) + model.Add(difficulty_level == 0).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUITY]) # The indirection is necessary for applying an enforcement literal - derived_exhaustion = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUE.name, 'derived exhaustion')) + derived_exhaustion = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUITY.name, 'derived exhaustion')) model.AddDivisionEquality(derived_exhaustion, antiquity_squared, 100) - model.Add(added_exhaustion == derived_exhaustion).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUE]) + model.Add(added_exhaustion == derived_exhaustion).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUITY]) del antiquity_squared, value_remainder, derived_exhaustion - # The Trifling Diplomat - Fossilised Fish - model.AddLinearExpressionInDomain(skeleton_in_progress, cp_model.Domain.FromFlatIntervals([190, 199])).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_FOSSIL_FISH]) + # The Trifling Diplomat - Fish + model.AddLinearExpressionInDomain(skeleton_in_progress, cp_model.Domain.FromFlatIntervals([190, 199])).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_FISH]) - non_negative_amalgamy = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_FOSSIL_FISH.name, 'non-negative amalgamy')) + non_negative_amalgamy = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_FISH.name, 'non-negative amalgamy')) model.AddMaxEquality(non_negative_amalgamy, [amalgamy, 0]) - non_negative_menace = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_FOSSIL_FISH.name, 'non-negative menace')) + non_negative_menace = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_FISH.name, 'non-negative menace')) model.AddMaxEquality(non_negative_menace, [menace, 0]) - non_negative_antiquity = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_FOSSIL_FISH.name, 'non-negative antiquity')) + non_negative_antiquity = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_FISH.name, 'non-negative antiquity')) model.AddMaxEquality(non_negative_antiquity, [antiquity, 0]) - compromising_documents = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_FOSSIL_FISH.name, '')) + compromising_documents = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_FISH.name, '')) model.AddGeneralMultiplicationEquality(compromising_documents, non_negative_amalgamy, non_negative_menace, non_negative_antiquity) - value_remainder = model.NewIntVar(0, 49, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_FOSSIL_FISH.name, 'value remainder')) + value_remainder = model.NewIntVar(0, 49, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_FISH.name, 'value remainder')) model.AddModuloEquality(value_remainder, value, 50) - model.Add(primary_revenue == value - value_remainder + 50).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_FOSSIL_FISH]) - model.Add(secondary_revenue == 50*compromising_documents).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_FOSSIL_FISH]) + model.Add(primary_revenue == value - value_remainder + 50).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_FISH]) + model.Add(secondary_revenue == 50*compromising_documents).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_FISH]) # TODO: Add actual difficulty level - model.Add(difficulty_level == 0).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_FOSSIL_FISH]) + model.Add(difficulty_level == 0).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_FISH]) # The indirection is necessary for applying an enforcement literal - derived_exhaustion = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_FOSSIL_FISH.name, 'derived exhaustion')) + derived_exhaustion = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.THE_TRIFLING_DIPLOMAT_FISH.name, 'derived exhaustion')) model.AddDivisionEquality(derived_exhaustion, compromising_documents, 100) - model.Add(added_exhaustion == derived_exhaustion).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_FOSSIL_FISH]) + model.Add(added_exhaustion == derived_exhaustion).OnlyEnforceIf(actions[Buyer.THE_TRIFLING_DIPLOMAT_FISH]) del non_negative_amalgamy, non_negative_menace, non_negative_antiquity, compromising_documents, value_remainder, derived_exhaustion