Add Celestial option of Colourful Phantasist

This buyer scales with the product of implausibility and antiquity.
This commit is contained in:
Jeremy Saklad 2021-06-15 07:10:20 -05:00
parent 70b02586b7
commit 4184468f1d
Signed by: Jeremy Saklad
GPG Key ID: 9CA2149583EDBF84
1 changed files with 29 additions and 0 deletions

View File

@ -1121,6 +1121,11 @@ class Buyer(enum.Enum):
cost = Cost.ACTION.value cost = Cost.ACTION.value
) )
A_COLOURFUL_PHANTASIST_CELESTIAL = Action(
"Sell an antique skeleton as a work of Celestial art",
cost = Cost.ACTION.value
)
THE_DUMBWAITER_OF_BALMORAL = Action( THE_DUMBWAITER_OF_BALMORAL = Action(
"Export the Skeleton of a Neathy Bird", "Export the Skeleton of a Neathy Bird",
cost = Cost.ACTION.value cost = Cost.ACTION.value
@ -1935,6 +1940,30 @@ def Solve(bone_market_fluctuations, zoological_mania, desired_buyer = None, maxi
del menace_times_implausibility, value_remainder, derived_exhaustion del menace_times_implausibility, value_remainder, derived_exhaustion
# A Colourful Phantasist - Celestial
model.Add(skeleton_in_progress >= 100).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_CELESTIAL])
model.Add(implausibility >= 2).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_CELESTIAL])
model.Add(antiquity >= 4).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_CELESTIAL])
antiquity_times_implausibility = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.A_COLOURFUL_PHANTASIST_CELESTIAL.name, 'antiquity times implausibility'))
model.AddMultiplicationEquality(antiquity_times_implausibility, [antiquity, implausibility])
value_remainder = model.NewIntVar(0, 49, '{}: {}'.format(Buyer.A_COLOURFUL_PHANTASIST_CELESTIAL.name, 'value remainder'))
model.AddModuloEquality(value_remainder, value, 50)
model.Add(primary_revenue == value - value_remainder + 100).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_CELESTIAL])
model.Add(secondary_revenue == 250*antiquity_times_implausibility + 250).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_CELESTIAL])
model.Add(difficulty_level == 0).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_CELESTIAL])
# The indirection is necessary for applying an enforcement literal
derived_exhaustion = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.A_COLOURFUL_PHANTASIST_CELESTIAL.name, 'derived exhaustion'))
model.AddDivisionEquality(derived_exhaustion, antiquity_times_implausibility, 20)
model.Add(added_exhaustion == derived_exhaustion).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_CELESTIAL])
del antiquity_times_implausibility, value_remainder, derived_exhaustion
# The Dumbwaiter of Balmoral # The Dumbwaiter of Balmoral
model.AddLinearExpressionInDomain(skeleton_in_progress, cp_model.Domain.FromFlatIntervals([180, 189])).OnlyEnforceIf(actions[Buyer.THE_DUMBWAITER_OF_BALMORAL]) model.AddLinearExpressionInDomain(skeleton_in_progress, cp_model.Domain.FromFlatIntervals([180, 189])).OnlyEnforceIf(actions[Buyer.THE_DUMBWAITER_OF_BALMORAL])
model.Add(value >= 250).OnlyEnforceIf(actions[Buyer.THE_DUMBWAITER_OF_BALMORAL]) model.Add(value >= 250).OnlyEnforceIf(actions[Buyer.THE_DUMBWAITER_OF_BALMORAL])