feat: Add segment property to actions

This is used to track the number of segments in a skeleton, which
is affected by a new bone.
This commit is contained in:
Jeremy Saklad 2022-05-26 06:45:36 -06:00
parent 57a2e9ce36
commit aa6a294d55
Signed by: Jeremy Saklad
GPG Key ID: 94B02EA3D0B6481B
2 changed files with 7 additions and 0 deletions

View File

@ -47,6 +47,9 @@ class Action:
# Skeleton: Fins # Skeleton: Fins
fins: int = 0 fins: int = 0
# Skeleton: Number of Segments
segments: int = 0
# Skeleton: Tentacles # Skeleton: Tentacles
tentacles: int = 0 tentacles: int = 0

View File

@ -166,6 +166,10 @@ def Solve(shadowy_level, bone_market_fluctuations = None, zoological_mania = Non
fins = model.NewIntVar('fins', lb = 0) fins = model.NewIntVar('fins', lb = 0)
model.Add(fins == cp_model.LinearExpr.WeightedSum(actions.values(), [action.value.fins for action in actions.keys()])) model.Add(fins == cp_model.LinearExpr.WeightedSum(actions.values(), [action.value.fins for action in actions.keys()]))
# Segments calculation
segments = model.NewIntVar('segments', lb = 0)
model.Add(segments == cp_model.LinearExpr.WeightedSum(actions.values(), [action.value.segments for action in actions.keys()]))
# Tentacles calculation # Tentacles calculation
tentacles = model.NewIntVar('tentacles', lb = 0) tentacles = model.NewIntVar('tentacles', lb = 0)
model.Add(tentacles == cp_model.LinearExpr.WeightedSum(actions.values(), [action.value.tentacles for action in actions.keys()])) model.Add(tentacles == cp_model.LinearExpr.WeightedSum(actions.values(), [action.value.tentacles for action in actions.keys()]))