Add Nocturnal option of Colourful Phantasist
This buyer scales with the product of implausibility and menace.
This commit is contained in:
parent
c80b61ba6c
commit
70b02586b7
|
@ -1116,6 +1116,11 @@ class Buyer(enum.Enum):
|
||||||
cost = Cost.ACTION.value
|
cost = Cost.ACTION.value
|
||||||
)
|
)
|
||||||
|
|
||||||
|
A_COLOURFUL_PHANTASIST_NOCTURNAL = Action(
|
||||||
|
"Sell a menacing skeleton as a work of Nocturnal 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
|
||||||
|
@ -1906,6 +1911,30 @@ def Solve(bone_market_fluctuations, zoological_mania, desired_buyer = None, maxi
|
||||||
del amalgamy_times_implausibility, value_remainder, derived_exhaustion
|
del amalgamy_times_implausibility, value_remainder, derived_exhaustion
|
||||||
|
|
||||||
|
|
||||||
|
# A Colourful Phantasist - Nocturnal
|
||||||
|
model.Add(skeleton_in_progress >= 100).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_NOCTURNAL])
|
||||||
|
model.Add(implausibility >= 2).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_NOCTURNAL])
|
||||||
|
model.Add(menace >= 4).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_NOCTURNAL])
|
||||||
|
|
||||||
|
menace_times_implausibility = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, '{}: {}'.format(Buyer.A_COLOURFUL_PHANTASIST_NOCTURNAL.name, 'menace times implausibility'))
|
||||||
|
model.AddMultiplicationEquality(menace_times_implausibility, [menace, implausibility])
|
||||||
|
|
||||||
|
value_remainder = model.NewIntVar(0, 49, '{}: {}'.format(Buyer.A_COLOURFUL_PHANTASIST_NOCTURNAL.name, 'value remainder'))
|
||||||
|
model.AddModuloEquality(value_remainder, value, 50)
|
||||||
|
|
||||||
|
model.Add(primary_revenue == value - value_remainder + 100).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_NOCTURNAL])
|
||||||
|
model.Add(secondary_revenue == 250*menace_times_implausibility + 250).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_NOCTURNAL])
|
||||||
|
|
||||||
|
model.Add(difficulty_level == 0).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_NOCTURNAL])
|
||||||
|
|
||||||
|
# The indirection is necessary for applying an enforcement literal
|
||||||
|
derived_exhaustion = model.NewIntVar(0, cp_model.INT32_MAX, '{}: {}'.format(Buyer.A_COLOURFUL_PHANTASIST_NOCTURNAL.name, 'derived exhaustion'))
|
||||||
|
model.AddDivisionEquality(derived_exhaustion, menace_times_implausibility, 20)
|
||||||
|
model.Add(added_exhaustion == derived_exhaustion).OnlyEnforceIf(actions[Buyer.A_COLOURFUL_PHANTASIST_NOCTURNAL])
|
||||||
|
|
||||||
|
del menace_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])
|
||||||
|
|
Loading…
Reference in New Issue