Minesweeper game implemented in python using pygame
Project description
Minesweeper
Minesweeper is a single-player puzzle computer game. The objective of the game is to clear a rectangular board containing hidden "mines" or bombs without detonating any of them, with help from clues about the number of neighboring mines in each field. The game originates from the 1960s, and has been written for many computing platforms in use today. It has many variations and offshoots.
This simple implementation of minesweeper is done in Python using the game library pygame.
The core functionality of the game can be found here and the python package for the sprite sheet can be found here
Motivation
The motivation of these minesweeper projects is to learn the tooling around python projects, how to create CI/CD pipelines for python projects, and distributing python eggs.
Getting Started
Installation
python -m pip install pygame-minesweeper
# or
pip install pygame-minesweeper
Start a game
# if $HOME/.local/bin/ is defined in $PATH
minesweeper <basic | intermediate | expert | custom>
# or
python -m minesweeper <basic | intermediate | expert | custom>`
Boards
scheme | rows | cols | mines |
---|---|---|---|
Basic | 10 | 10 | 10 |
Intermediate | 16 | 16 | 40 |
expert | 6 | 30 | 99 |
custom | --rows | --cols | --mines |
Show high Score
minesweeper --show-high-score
# or
python -m minesweeper --show-high-score
# Stdout
BASIC
-----
#01 0:00:22.641516
#02 0:00:29.936435
#03 0:01:02.104885
#04 -
#05 -
#06 -
#07 -
#08 -
#09 -
#10 -
CUSTOM 10X10:5
-----
#01 0:00:15.618247
#02 -
#03 -
#04 -
#05 -
#06 -
#07 -
#08 -
#09 -
#10 -
Start a game with a different sprite sheet
The --tile-sprite
, --face-sprite
, and --score-sprite
parameters define a set of sprite sheets that are available from this python package.
# if $HOME/.local/bin/ is defined in $PATH
minesweeper -h
# or
python -m minesweeper -h
#stdout
positional arguments:
{basic,intermediate,expert,custom}
optional arguments:
-h, --help show this help message and exit
--rows ROWS
--cols COLS
--mines MINES
--tile-sprite {2.0,2.9,95,2000,fiorito-2000,fiorito-monochrome,fiorito-xp,monochrome}
--score-sprite {2000,monochrome}
--face-sprite {2000,monochrome}
--sprite {2000,monochrome}
--show-high-score
If the --sprite flag is set it will override the other flags like --tile-sprite
, --score-sprite
and --face-sprite
.
# Starting an *Expert* game with a full monochrome spritesheet
minesweeper expert --sprite=monochrome
# or
python -m minesweeper expert --sprite=monochrome
Credits
Sprites
The sprites used in this project were created by Black Squirrel and can be found here.
TODO
- Refactor Project
References
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pygame-minesweeper-1.0.11.tar.gz
.
File metadata
- Download URL: pygame-minesweeper-1.0.11.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47e7752793d32d8d7c8066f46d7d7bc2333b6ca404bbacc3de018801c821505d |
|
MD5 | 2d9ae11d66068fa6d0b9b8ce70c22c20 |
|
BLAKE2b-256 | 82aab40c22ebcdfab7c0b164c21a3709968288da6d952809182718bf04671589 |
File details
Details for the file pygame_minesweeper-1.0.11-py3-none-any.whl
.
File metadata
- Download URL: pygame_minesweeper-1.0.11-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0abfe13e04374dd339e86ce84a672984f0d9abcacf1bd27a52bb74fa24ab0b0 |
|
MD5 | 934297d317a38c93d454730f9b5e65b7 |
|
BLAKE2b-256 | 73b1a834e4c214d7fe698f3a92d15eb98c344ed1a5c034e29ca38331c06a4f9a |