Skip to content
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

Minesweeper - complete features #11

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

keith-hall
Copy link

Hi,

Thanks very much for this project, it is very useful for jump starting PyQt development :)

I found the Minesweeper game particularly interesting and decided to complete it's features. I thought I would share it here as a PR in case you would like these improvements in your repo for others to learn from / make this example game more enjoyable - I will totally understand if it is out of the project scope and you reject it, I wasn't sure if it was intentionally half finished so people could do exactly what I just did as a fun way to experiment or learn or because the example in its current state is perfect for demonstrating how to create Qt apps from Python. Apologies if this project goal is mentioned somewhere but I missed it.

Anyway, the changes I have made are, in no particular order:

  • allow right clicking on a flagged cell to unflag it
  • when flagging, reduce the number of remaining mines shown in the counter widget
  • when unflagging, increase the number of remaining mines shown in the counter widget
  • when revealing a mine and losing the game, mark the mine that caused game over in a different color
  • when losing the game, show which flags were incorrect and keep those that were correct visible
  • when right clicking on a revealed cell, intelligently reveal the cells around if the number of adjacent mines matches the number of adjacent flags (a feature Windows 95's "winmine" has)
  • evaluate the winning conditions - when all the cells except the mines have been revealed
  • use a common generator function to deduplicate some code and only evaluate the minimum number of cells necessary for the new logic
  • set the window title
  • allow the user to specify the difficulty level (0, 1 or 2) in the command line arguments to expose the otherwise hidden functionality

@mfitzp
Copy link
Member

mfitzp commented Jul 8, 2019

Hi @keith-hall — just going through this repo again and found this PR! This is awesome, nice work! :)

The target when writing the apps was "completely functional but incomplete" to leave some room for experimentation. I might still merge some of the changes (fixes/etc.) ...but either way it's great to see what it's inspired you to do.

I'm going to link this PR from the article to share it more widely.

Thanks again!

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.

None yet

2 participants