From aa6a294d556184396683339011e9fbceb6da8b6a Mon Sep 17 00:00:00 2001 From: Jeremy Saklad Date: Thu, 26 May 2022 06:45:36 -0600 Subject: [PATCH] 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. --- bonemarketsolver/objects/action.py | 3 +++ bonemarketsolver/solve.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/bonemarketsolver/objects/action.py b/bonemarketsolver/objects/action.py index 974eb0e..3f00ff7 100644 --- a/bonemarketsolver/objects/action.py +++ b/bonemarketsolver/objects/action.py @@ -47,6 +47,9 @@ class Action: # Skeleton: Fins fins: int = 0 + # Skeleton: Number of Segments + segments: int = 0 + # Skeleton: Tentacles tentacles: int = 0 diff --git a/bonemarketsolver/solve.py b/bonemarketsolver/solve.py index 27daaaa..568a19f 100644 --- a/bonemarketsolver/solve.py +++ b/bonemarketsolver/solve.py @@ -166,6 +166,10 @@ def Solve(shadowy_level, bone_market_fluctuations = None, zoological_mania = Non fins = model.NewIntVar('fins', lb = 0) 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 = model.NewIntVar('tentacles', lb = 0) model.Add(tentacles == cp_model.LinearExpr.WeightedSum(actions.values(), [action.value.tentacles for action in actions.keys()]))