Skip to content

Conversation

REM-moe
Copy link

@REM-moe REM-moe commented Oct 7, 2025

What this PR changes

  • Implements field generation in the Game class to guarantee the first click is never a bomb (standard Minesweeper behavior).
  • Adds a new Field.withSafePosition() factory using an efficient O(n) shuffle algorithm for bomb placement, replacing the old do-while loop.
  • (game.width, game.height, game.bombCount) instead of accessing game.field before the field is generated.

Why

  • Prevents the user from losing on the first click, matching expected Minesweeper behavior.

Issues


  • I've reviewed the contributor guide and applied the relevant portions to this PR.

Copy link

google-cla bot commented Oct 7, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

guarantee first-click is not a bomb
1 participant