There are pythons snakes in the grass!
This project is a console implementation of the classic game Minesweeper as recommended by Triplebyte's interview guide.
Just clone the repo and execute the pysweep
module
$ python -m pysweep
The prompts will guide you from there.
Tests are written with pytest. Install if not installed already and just run pytest
$ pip install -U pytest
$ pytest
Anonymous Functions : Principally for customizing how user input is captured.
Depth-First Search : For revealing contiguous sections of blank squares.
Encapsulation : For state management of the gameboard and squares.
Null Object Pattern : For gracefully dealing with out of bounds squares.
Generators : For various iterations, to keep memory use nice and tidy
Recursion : For the application of scalar-based algorithms against non-scalar data
I know there are best in class packages available in the community to handle some of the things done here better, but as a practice exercise I wanted to keep this pure python, save testing.
I'm not great at making console applications and am even less experienced at dealing with game loops. I don't feel great about the use of Exceptions to manage game termination but it works for now.
Overall I'm pleased with the implementation for a few hours work.
Admin: Unit tests- Admin: Doc strings
Feature: Add victory conditionFeature: Add snake flaggingFeature: Add snake countFeature: Add timerFeature: Add UI colorsFeature: Richer input options (Multiple row/column selection per command)- Feature: Command-Line arguments to drive feature toggles
Refactor: Uncouple rendering from state- Refactor: Get fancy! Maybe some context managers or decorators
Refactor: Unit tests to make better use of built-in mocking- Major Version: Write as a curses app
- Added richer input options
- Board difficulties now mirror the original Minesweeper
- Added UI colors
- Added game timer
- Updated rendering so playing larger boards is a bit easier
- Added snake flagging
- Added snake counter
- Rebranded game as PySweep
- Version playable version of game that is winnable
- No flagging
- No bomb counter