From aeaaf77900ec334d5d73645c54e6f5d68776c8f2 Mon Sep 17 00:00:00 2001 From: Jeremy Saklad Date: Tue, 26 Jul 2022 12:42:03 -0500 Subject: [PATCH] feat: Add Exhibition skeleton This is a transient buyer available during F.F. Gebrandt's Prelapsarian Exhibition, the estival festival of 2022. It pays out 110% of skeleton's value. --- bonemarketsolver/data/buyers.py | 4 ++++ bonemarketsolver/solve.py | 24 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/bonemarketsolver/data/buyers.py b/bonemarketsolver/data/buyers.py index 381419d..e7f6297 100644 --- a/bonemarketsolver/data/buyers.py +++ b/bonemarketsolver/data/buyers.py @@ -121,6 +121,10 @@ class Buyer(Enum): cost = Cost.ACTION.value ) + EXHIBITION = Action( + "Supply a complete skeleton", + cost = Cost.ACTION.value + ) THE_DUMBWAITER_OF_BALMORAL = Action( "Export the Skeleton of a Neathy Bird", cost = Cost.ACTION.value diff --git a/bonemarketsolver/solve.py b/bonemarketsolver/solve.py index 9fdecd9..2c48734 100644 --- a/bonemarketsolver/solve.py +++ b/bonemarketsolver/solve.py @@ -23,7 +23,7 @@ from .data.torsos import Torso from .objects.bone_market_model import BoneMarketModel # This multiplier is applied to the profit margin to avoid losing precision due to rounding. -PROFIT_MARGIN_MULTIPLIER = 10000 +PROFIT_MARGIN_MULTIPLIER = 100 # This is the highest number of attribute to calculate fractional exponents for. MAXIMUM_ATTRIBUTE = 100 @@ -1088,6 +1088,28 @@ def Solve(shadowy_level, bone_market_fluctuations = None, zoological_mania = Non ), ) + # Exhibition + + exhibition_payout = model.NewIntVar('exhibition payout', lb = 0) + + multiplied_exhibition_value = model.NewIntVar('multiplied exhibition value', lb = 0) + model.Add(multiplied_exhibition_value == 11*value) + model.AddDivisionEquality(exhibition_payout, multiplied_exhibition_value, 10) + + model.AddIf(actions[Buyer.EXHIBITION], + cp_model.BoundedLinearExpression(skeleton_in_progress, (110, 212)), + implausibility == 0, + value >= 90000, + antiquity >= 3, + amalgamy == 0, + primary_revenue == exhibition_payout, + secondary_revenue == 0, + difficulty_level == 0, + added_exhaustion == 0, + ) + + del exhibition_payout, multiplied_exhibition_value + model.AddIf(actions[Buyer.THE_DUMBWAITER_OF_BALMORAL], cp_model.BoundedLinearExpression(skeleton_in_progress, (180, 189)), value >= 250,