Skip to main content

Minesweeper game implemented in python using pygame

Project description

Build Status PyPI - License PyPI Downloads

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

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

pygame-minesweeper-1.0.11.tar.gz (10.5 kB view hashes)

Uploaded Source

Built Distribution

pygame_minesweeper-1.0.11-py3-none-any.whl (12.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page