Implement scaling value for Vake skulls
Vake skulls now have diminishing returns beyond the first skull, which are calculated using a partial sum formula similar to joint addition. Value calculation has been reorganized to accomodate the change.
This commit is contained in:
parent
abd5139aad
commit
5d7c972169
|
@ -129,10 +129,10 @@ class Skull(Enum):
|
||||||
skulls_needed = -1
|
skulls_needed = -1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Value scales with repetition and is implemented separately
|
||||||
VAKE_SKULL = Action(
|
VAKE_SKULL = Action(
|
||||||
"Duplicate the Vake's skull and use it to decorate your (Skeleton Type)",
|
"Duplicate the Vake's skull and use it to decorate your (Skeleton Type)",
|
||||||
cost = Cost.ACTION.value + 6000*Cost.BONE_FRAGMENT.value,
|
cost = Cost.ACTION.value + 6000*Cost.BONE_FRAGMENT.value,
|
||||||
value = 6500,
|
|
||||||
skulls_needed = -1,
|
skulls_needed = -1,
|
||||||
skulls = 1,
|
skulls = 1,
|
||||||
menace = 3
|
menace = 3
|
||||||
|
|
|
@ -148,11 +148,31 @@ def Solve(shadowy_level, bone_market_fluctuations = None, zoological_mania = Non
|
||||||
|
|
||||||
|
|
||||||
# Value calculation
|
# Value calculation
|
||||||
original_value = model.NewIntVar(0, cp_model.INT32_MAX, 'original value')
|
|
||||||
model.Add(original_value == cp_model.LinearExpr.ScalProd(actions.values(), [action.value.value for action in actions.keys()]))
|
|
||||||
|
|
||||||
value = model.NewIntVar(0, cp_model.INT32_MAX, 'value')
|
value = model.NewIntVar(0, cp_model.INT32_MAX, 'value')
|
||||||
|
|
||||||
|
original_value = model.NewIntVar(0, cp_model.INT32_MAX, 'original value')
|
||||||
|
|
||||||
|
constant_base_value = model.NewIntVar(0, cp_model.INT32_MAX, 'constant base value')
|
||||||
|
model.Add(constant_base_value == cp_model.LinearExpr.ScalProd(actions.values(), [action.value.value for action in actions.keys()]))
|
||||||
|
|
||||||
|
# Calculate value from Vake skulls
|
||||||
|
# This is a partial sum formula.
|
||||||
|
vake_skull_value = model.NewIntVar(cp_model.INT32_MIN, cp_model.INT32_MAX, 'vake skull value')
|
||||||
|
|
||||||
|
vake_skulls = actions[Skull.VAKE_SKULL]
|
||||||
|
|
||||||
|
vake_skulls_squared = model.NewIntVar(0, cp_model.INT32_MAX, 'vake skulls squared')
|
||||||
|
model.AddMultiplicationEquality(vake_skulls_squared, [vake_skulls, vake_skulls])
|
||||||
|
|
||||||
|
model.Add(vake_skull_value == -250 * vake_skulls_squared + 6750 * vake_skulls)
|
||||||
|
|
||||||
|
del vake_skulls, vake_skulls_squared
|
||||||
|
|
||||||
|
model.Add(original_value == constant_base_value + vake_skull_value)
|
||||||
|
|
||||||
|
del constant_base_value, vake_skull_value
|
||||||
|
|
||||||
|
# Zoological Mania
|
||||||
if zoological_mania:
|
if zoological_mania:
|
||||||
multiplier = 115 if zoological_mania in [Declaration.FISH, Declaration.INSECT, Declaration.SPIDER] else 110
|
multiplier = 115 if zoological_mania in [Declaration.FISH, Declaration.INSECT, Declaration.SPIDER] else 110
|
||||||
|
|
||||||
|
@ -164,7 +184,7 @@ def Solve(shadowy_level, bone_market_fluctuations = None, zoological_mania = Non
|
||||||
else:
|
else:
|
||||||
model.Add(value == original_value)
|
model.Add(value == original_value)
|
||||||
|
|
||||||
del original_value
|
del multiplied_value, original_value
|
||||||
|
|
||||||
|
|
||||||
# Torso Style calculation
|
# Torso Style calculation
|
||||||
|
|
Loading…
Reference in New Issue