From 673b6160c6720d9e483b07f71304cb74f090a84c Mon Sep 17 00:00:00 2001 From: Jeremy Saklad Date: Tue, 6 Jul 2021 12:18:49 -0500 Subject: [PATCH] Define DiplomatFascination functionally Rather than laboriously replicating every fascination the Trifling Diplomat has, the script now exploits the consistent member names to generate the list automatically. This should not have any effect on usage, but will ease future maintainance. --- Bone Market Solver.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Bone Market Solver.py b/Bone Market Solver.py index 20f0c21..ab5a0cb 100644 --- a/Bone Market Solver.py +++ b/Bone Market Solver.py @@ -1194,12 +1194,13 @@ class OccasionalBuyer(Enum): AN_INGENUOUS_MALACOLOGIST = [Buyer.AN_INGENUOUS_MALACOLOGIST] -class DiplomatFascination(Enum): - """The current requirements of the Trifling Diplomat.""" - - ANTIQUITY = Buyer.THE_TRIFLING_DIPLOMAT_ANTIQUITY - - FISH = Buyer.THE_TRIFLING_DIPLOMAT_FISH +DiplomatFascination = Enum( + 'DiplomatFascination', + ( (diplomat.name[22:], diplomat) for diplomat in Buyer + if diplomat.name.startswith('THE_TRIFLING_DIPLOMAT_') ), + module = __name__ + ) +DiplomatFascination.__doc__ = "The current fascination of the Trifling Diplomat." 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):