casebench
test cases straight onto the board.
git clone https://owenrusk.dev/casebench.git
commit 14af15c526a0e604ea49199b68d70b6186570845 parent 1536529604919a60aad9006a6dec34ef5cada45a author Owen Rusk <owen@papermothgames.com> date 2025-05-29 11:52:39 -0500
lock: start the count over after a rest it kept the count, so the first wrong try after a rest put it straight back to resting.
| casebench/lock.py | +2 | -1 |
diff --git a/casebench/lock.py b/casebench/lock.py index 2bed125..006e7dd 100644 --- a/casebench/lock.py +++ b/casebench/lock.py @@ -61,5 +61,6 @@ def attempt(lock: Lock, typed: list[str], now: datetime) -> tuple[str, Lock]: return "open", replace(lock, wrong=0, resting_until=None, opened_at=now) wrong = lock.wrong + 1 if wrong >= lock.rest.after:- return "wrong", replace(lock, wrong=wrong, resting_until=now + timedelta(minutes=lock.rest.minutes))+ # the count starts over once it has rested. + return "wrong", replace(lock, wrong=0, resting_until=now + timedelta(minutes=lock.rest.minutes)) return "wrong", replace(lock, wrong=wrong)