Skip to content

Minesweeper - complete features #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Minesweeper: don't start on a tile with adjacent mines
as the rocket otherwise covers the number
  • Loading branch information
Keith Hall committed Sep 30, 2018
commit cadd6b83b8a0645392b605036c7dbbd7bd3801fe
2 changes: 1 addition & 1 deletion minesweeper/minesweeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def get_adjacency_n(x, y):
x, y = random.randint(0, self.b_size - 1), random.randint(0, self.b_size - 1)
w = self.grid.itemAtPosition(y, x).widget()
# We don't want to start on a mine.
if (x, y) not in positions:
if (x, y) not in positions and not w.adjacent_n:
w.is_start = True

# Reveal all positions around this, if they are not mines either.
Expand Down