Skip to content


Repository files navigation

A minesweeper solver and game.

Download binaries at

I have successfully compiled this using Ubuntu 11.04 (with ncurses)
and using MinGW (with pdcurses). The Makefile and source checks and
adjusts itself depending on which system you use.

Below is the "--help" output from the programs in this repository:

Usage: minesweeper [OPTION]... [FILE]
Start a new minesweeper game to FILE or standard output
(see -n), or process a turn in an existing minesweeper
game from FILE or standard input.

  -n         Start a new game.
  -f         Start the new game fairly (reveal a hole)
  -b INT     Start the new game using a predefined board:
               0: 8x8 grid with 10 mines
               1: 16x16 grid with 40 mines
               2: 30x16 grid with 99 mines
               3: 78x21 grid with 450 mines
  -x INT     Set the width of the grid.
  -y INT     Set the height of the grid.
  -m INT     Set the number of mines.
  -h, --help Show this help menu.
  -v         Verbose output (to stderr).

The FILE contains information about the game and provide an
interface to the game. Only modify the file by overwriting
characters in the first grid, the reader is sensitive(bad).

Legend of the symbols in the grid:
  .      A unknown tile
  space  A tile with no bombs surrounding it
  1-8    A tile surrounded by 1-8 mines
  !      A tile designated by the user as a mine
  ?      A tile designated by the user as not a mine,
           running minesweeper processed these
  *      A exploded mine. If you see any of these you
           have lost

Example: Playing a game of minesweeper
  Start a new game called using file 'foo':
    run 'minesweeper -n -b 1 foo.txt'
  Play minesweeper:
    1) Edit file foo.txt
    2) Replace .'s with ?'s or !'s to mark tiles that are 
       not mines and mines, respectively
    3) Process your input by running 'minesweeper foo.txt'
    4) Go to step 1)

Usage: minesweeper_solver [FILE]
Solve as much as possible of a minesweeper game
from FILE or standard input. It solves it by
replacing unknown tiles (.) with either mines (!)
or not-mines (?).

  -h, --help  Show this help menu
  -v          Verbose output (to stderr)
  -m          Replace explosions (*) with mines (!)
  -c INT      Set new cluster size limit (default is 15)

The game modifies a interface file generated by

Example: Solve a game of minesweeper
  Start a new game called foo using the 'minesweeper'
  Solve minesweeper:
    1) run 'minesweeper_solver foo'
    2) Process a turn by running 'minesweeper foo'
    3) Go to step 1)

Usage: minesweeper_curses [FILE]
Start a curses user interface using the minesweeper
game from FILE or game.txt by default.

  -h, --help   Show this help menu.
  -w WINDOW-ID Set up recording using Imagemagick
  -m 'CMD'     Use CMD instead of './minesweeper'
  -s 'CMD'     Use CMD instead of './minesweeper_solver -m'
  -a 'ARGS'    Append ARGS when running './minesweeper'
                 and './minesweeper_solver'


A minesweeper terminal solver and game






No releases published


No packages published