From 7426eb86fb2e7313607493becab262fe3115ce7b Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 12 Sep 2025 10:54:14 -0400 Subject: [Apworld] Handle complete_at > 1 --- apworld/rules.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'apworld/rules.py') diff --git a/apworld/rules.py b/apworld/rules.py index 0bff056..6186637 100644 --- a/apworld/rules.py +++ b/apworld/rules.py @@ -32,6 +32,21 @@ def lingo2_can_satisfy_requirements(state: CollectionState, reqs: AccessRequirem for subjunction in reqs.or_logic): return False + if reqs.complete_at is not None: + completed = 0 + checked = 0 + for possibility in reqs.possibilities: + checked += 1 + if lingo2_can_satisfy_requirements(state, possibility, world): + completed += 1 + if completed >= reqs.complete_at: + break + elif len(reqs.possibilities) - checked + completed < reqs.complete_at: + # There aren't enough remaining possibilities for the check to pass. + return False + if completed < reqs.complete_at: + return False + return True def make_location_lambda(reqs: AccessRequirements, world: "Lingo2World") -> Callable[[CollectionState], bool]: -- cgit 1.4.1