Repository navigation
Discovering a secret door refunds both of its cells - #131
Merged
Merged
Conversation
…refund-both-cells) Acceptance tests marked expected-to-fail: a discovery from the near side, by search or by referee command, refunds the far cell's room-trap attempts. Claude-Session: https://claude.ai/code/session_01NmCezTw8hKKujkaEZ3YGAs
A secret door is one edge shared by two cells, and a room_traps search from either cell covers that edge, so an undiscovered secret door hides the trap beyond it from both sides. _refund_trap_search now takes the discovered door's direction and clears the room_traps attempts of the cell across the edge as well as the cell the discovery was named from, on both discovery paths: a secret_doors search in _reveal and the referee's SetDoorState in _handle_set_door_state. Other kinds and other cells keep their attempts. Also appends a sentence to the _migrate_3_to_4 docstring in persistence.py noting that the message code the dropped surrender flag's event once carried is gone too, so an event still naming it would no longer parse, though no log holds one. Claude-Session: https://claude.ai/code/session_01NmCezTw8hKKujkaEZ3YGAs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A secret door is one edge shared by two cells, and a
room_trapssearch from either cell covers that edge, so an undiscovered secret door hides the trap beyond it from both sides. Before this change, discovering the door refunded only the cell the discovery named: the searcher's cell in_reveal, or(x, y)in_handle_set_door_state. A member who searched the far cell while the door was still wall keptexploration.search.already_triedafter walking round to it, even though the door now made the trap findable from that side too.This fixes both discovery paths so they refund both cells of the edge:
_refund_trap_searchincrawl/exploration.pynow takes the discovered door's direction and clearsroom_trapsattempts for the cell it was named from and the cell across the edge (step(position, direction))._reveal'ssecret_doorsbranch passes the direction of each door it discovers._handle_set_door_stateincrawl/session.pypassescommand.direction.Other search kinds and other cells keep their attempts, and both discovery paths use the same helper so they can't drift.
Docstrings updated to say so:
Searchincrawl/commands.py,_refund_trap_search, and the searching entry ofdocs/adaptations.md(with the new test class added to its "Locked by" list).SetDoorState's docstring doesn't describe the refund, so it needed no change.Also, as asked outside this chunk: appended a sentence to the
_migrate_3_to_4docstring inpersistence.pynoting that the message code the dropped surrender flag's event once carried is gone too, so an event still naming it would no longer parse, though no log holds one because nothing ever set the flag that would have produced it. This is worded without the literal removed token, sincetest_unwired_surfaces.py::test_the_surrender_path_is_goneasserts that string appears nowhere undersrc/osrlib.Fixes the first issue in #129 (the scroll re-validation issue described there is a separate chunk).
Test plan
uv run pytest --runxfail tests/test_exploration.py— 132 passed, including both previouslyxfailtests inTestDiscoveringASecretDoorRefundsBothCellsnow passing for real.uv run ruff format --checkuv run ruff checkuv run pyrightuv run pytest— 2899 passed, 146 skipped, 2 xpassed (the two chunk tests, markers left for the lead to remove at merge), 0 failed.uv run mkdocs build --stricthttps://claude.ai/code/session_01NmCezTw8hKKujkaEZ3YGAs