| 1 | # ncurses Minesweeper |
| 2 |
|
| 3 | Terminal game of Minesweeper, implemented in C with ncurses. |
| 4 |
|
| 5 | Minesweeper is a logic game where mines are hidden in a grid of squares. The |
| 6 | object is to open all the safe squares in the shortest time possible. Use |
| 7 | the arrow keys to move and <SPACE> to select. Read the Help page for more |
| 8 | information. |
| 9 |
|
| 10 | Click to watch a video demo on YouTube: |
| 11 | [](http://www.youtube.com/watch?v=g7InqPoMShA "Minesweeper demo") |
| 12 |
|
| 13 | ## Compiling and Linking |
| 14 |
|
| 15 | Should be functional on all systems with an ncurses library. PDCurses may be |
| 16 | dropped in and linked on Windows, although this hasn't been tested. Might work |
| 17 | on WSL or Cygwin. |
| 18 |
|
| 19 | Requirements: `build-essential libncurses-dev` |
| 20 |
|
| 21 | Compiling and linking: |
| 22 | ``` |
| 23 | make compile build |
| 24 | ``` |
| 25 |
|
| 26 | **Binary executable deposited at `bin/minesweeper`.** You can copy this to |
| 27 | `/usr/local/bin/minesweeper` to run the game as `minesweeper` from any location |
| 28 | in your shell (given `/usr/local/bin` is in your path). |
| 29 |
|
| 30 | If you're contributing source code to this repository, install `clang-format |
| 31 | clang-tidy` and use `make` to target the linter programs. (`clang-format` is |
| 32 | a bit finicky; make sure you're running version 10.0.0 at least, or it will |
| 33 | yell at you about unsupported configuration in `.clang-format`.) |
| 34 |
|
| 35 | ## Program structure |
| 36 |
|
| 37 | * Entry point at `src/main.c` |
| 38 | * State structs at `src/state.h` |
| 39 | * Rendering logic loop at `src/draw/draw.c` |
| 40 | * Game logic handler (input) at `src/game/game.c` |
| 41 | * Game renderer at `src/draw/game.c` |
| 42 |
|
| 43 | All header files correspond to a similarly named source file except |
| 44 | `src/draw/pages.h`, which encapsulates multiple sources in the same directory, |
| 45 | and `src/state.h`, which provides struct definitions for game state data. |
| 46 |
|
| 47 | ## TODO |
| 48 |
|
| 49 | * Rewrite Options screen controls |
| 50 | * Rewrite game board renderer |
| 51 |
|
| 52 | ## Copyright and Licensing |
| 53 |
|
| 54 | This package is copyrighted by [Joshua 'joshuas3' |
| 55 | Stockin](https://joshstock.in/) and licensed under the [MIT License](LICENSE). |
| 56 |
|
| 57 | A form of the following should be present in each source or header file. |
| 58 |
|
| 59 | ```txt |
| 60 | ncurses-minesweeper Copyright (c) 2021 Joshua 'joshuas3' Stockin |
| 61 | <https://joshstock.in> |
| 62 | <https://git.joshstock.in/ncurses-minesweeper> |
| 63 | |
| 64 | This software is licensed and distributed under the terms of the MIT License. |
| 65 | See the MIT License in the LICENSE file of this project's root folder. |
| 66 | |
| 67 | This comment block and its contents, including this disclaimer, MUST be |
| 68 | preserved in all copies or distributions of this software's source. |
| 69 | ``` |
| 70 |
|
| 71 | <<https://joshstock.in>> | [josh@joshstock.in](mailto:josh@joshstock.in) | joshuas3#9641 |
| 72 |
|