Disable marking before first reveal#11
Merged
Merged
Conversation
A flag placed before the first reveal could land on a non-mine cell — mine placement only excluded the 3×3 around the first click, not pre-marks. The bogus flag blocked the win condition: marksLeft hit 0 but the game stayed in play state until the player guessed to unmark and reveal. mark() is now a no-op when the field isn't filled yet. Drops the #preMarks Set, the replay loop in reveal(), and the synthesized pre-fill snapshot branch. After-game marking was already blocked by the existing isGameOver guard. Refs #10
Runs lint+test+build on every pull_request. CD (cd.yml) continues to handle master pushes and the rsync to the VPS.
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
Minesweeper#mark()is now a no-op until the field is filled. Pre-fill flags could land on non-mine cells (mine placement only excluded the 3×3 around the first click, not pre-marks), blocking the win condition.#preMarks, the replay loop inreveal(), and the pre-fill branch ofgetSnapShot(). After-game marks were already blocked by the existing#isGameOverguard.src/minesweeper/minesweeper.spec.tswith three cases covering the new behaviour. ts-jest config tweaked so the spec compiles against ES2020.CLAUDE.mdupdated.Closes #10.
Test plan
npm test— 19/19 passing, including the new minesweeper.spec.tsnpm run lint— cleannpm run build— clean