From e0b070d2ebd59eb28eca98c57ddb74afb344951d Mon Sep 17 00:00:00 2001 From: Jeremy Saklad Date: Fri, 10 Sep 2021 20:55:41 -0500 Subject: [PATCH] Update Investment-Minded Ambassador The Ambassador now pays four-fifths of their previous secondary revenue. --- bonemarketsolver/solve.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/bonemarketsolver/solve.py b/bonemarketsolver/solve.py index 57bca6c..2f6b909 100644 --- a/bonemarketsolver/solve.py +++ b/bonemarketsolver/solve.py @@ -700,14 +700,24 @@ def Solve(shadowy_level, bone_market_fluctuations = None, zoological_mania = Non model.Add(skeleton_in_progress >= 100).OnlyEnforceIf(actions[Buyer.AN_INVESTMENT_MINDED_AMBASSADOR]) model.Add(antiquity > 0).OnlyEnforceIf(actions[Buyer.AN_INVESTMENT_MINDED_AMBASSADOR]) - antiquity_squared = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.AN_INVESTMENT_MINDED_AMBASSADOR.name, 'antiquity squared')) - model.AddMultiplicationEquality(antiquity_squared, [antiquity, antiquity]) + antiquity_squared_times_four_fifths = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.AN_INVESTMENT_MINDED_AMBASSADOR.name, 'antiquity squared times four-fifths')) + antiquity_squared_times_four = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.AN_INVESTMENT_MINDED_AMBASSADOR.name, 'antiquity squared times four')) + model.AddGeneralMultiplicationEquality(antiquity_squared_times_four, antiquity, antiquity, 4) + model.AddDivisionEquality(antiquity_squared_times_four_fifths, antiquity_squared_times_four, 5) + del antiquity_squared_times_four tailfeathers = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.AN_INVESTMENT_MINDED_AMBASSADOR.name, 'tailfeathers')) if bone_market_fluctuations == Fluctuation.ANTIQUITY: - model.AddApproximateExponentiationEquality(tailfeathers, antiquity, 2.1, MAXIMUM_ATTRIBUTE) + boosted_antiquity = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.AN_INVESTMENT_MINDED_AMBASSADOR.name, 'boosted antiquity')) + model.AddApproximateExponentiationEquality(boosted_antiquity, antiquity, 2.1, MAXIMUM_ATTRIBUTE) + boosted_antiquity_times_four = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.AN_INVESTMENT_MINDED_AMBASSADOR.name, 'boosted antiquity times four')) + model.AddMultiplicationEquality(boosted_antiquity_times_four, [boosted_antiquity, 4]) + boosted_antiquity_times_four_fifths = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.AN_INVESTMENT_MINDED_AMBASSADOR.name, 'boosted antiquity times four-fifths')) + model.AddDivisionEquality(boosted_antiquity_times_four_fifths, boosted_antiquity_times_four, 5) + model.Add(tailfeathers == boosted_antiquity_times_four_fifths).OnlyEnforceIf(actions[Buyer.AN_INVESTMENT_MINDED_AMBASSADOR]) + del boosted_antiquity, boosted_antiquity_times_four, boosted_antiquity_times_four_fifths else: - model.Add(tailfeathers == antiquity_squared).OnlyEnforceIf(actions[Buyer.AN_INVESTMENT_MINDED_AMBASSADOR]) + model.Add(tailfeathers == antiquity_squared_times_four_fifths).OnlyEnforceIf(actions[Buyer.AN_INVESTMENT_MINDED_AMBASSADOR]) value_remainder = model.NewIntVar(0, 49, '{}: {}'.format(Buyer.AN_INVESTMENT_MINDED_AMBASSADOR.name, 'value remainder')) model.AddModuloEquality(value_remainder, value, 50) @@ -720,10 +730,10 @@ def Solve(shadowy_level, bone_market_fluctuations = None, zoological_mania = Non # The indirection is necessary for applying an enforcement literal derived_exhaustion = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.AN_INVESTMENT_MINDED_AMBASSADOR.name, 'derived exhaustion')) - model.AddDivisionEquality(derived_exhaustion, antiquity_squared, 20) + model.AddDivisionEquality(derived_exhaustion, antiquity_squared_times_four_fifths, 20) model.Add(added_exhaustion == derived_exhaustion).OnlyEnforceIf(actions[Buyer.AN_INVESTMENT_MINDED_AMBASSADOR]) - del antiquity_squared, tailfeathers, value_remainder, extra_value, derived_exhaustion + del antiquity_squared_times_four_fifths, tailfeathers, value_remainder, extra_value, derived_exhaustion # A Teller of Terrors