Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mekaem/gominesweeper
A Minesweeper implementation in Go (interview question)
https://github.com/mekaem/gominesweeper
Last synced: 6 days ago
JSON representation
A Minesweeper implementation in Go (interview question)
- Host: GitHub
- URL: https://github.com/mekaem/gominesweeper
- Owner: mekaem
- License: mit
- Created: 2024-10-09T08:48:08.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-09T08:58:40.000Z (3 months ago)
- Last Synced: 2024-12-22T06:56:01.030Z (7 days ago)
- Language: Go
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gominesweeper
A Minesweeper implementation in Go (interview question)
## Prompt
Minesweeper is a classic single-player puzzle game. The objective of the game is to clear a rectangular board containing hidden mines without detonating any of them.
## Basic Rules
1. **Game Setup**: The game board is initially covered with tiles. Some of these tiles contain mines, while others are safe. The player's objective is to uncover all the safe tiles without triggering any mines.
2. **Game Board**: The game board consists of a grid of square tiles. Each tile can be uncovered or covered. Initially, all tiles are covered.
3. **Mines**: Mines are hidden beneath some of the tiles on the game board. The number of mines is predetermined.
4. **Numbers**: Tiles adjacent to mines contain a number indicating the number of mines in the surrounding tiles. For example, if a tile contains the number "3," it means that there are three mines in the adjacent tiles.
5. **Uncovering Tiles**: The player uncovers tiles by clicking on them.
- If a player uncovers a tile containing a mine, the game ends, and the player loses.
- If the tile does not contain a mine, it will reveal a number indicating the number of adjacent mines, or it will be blank if there are no adjacent mines.
- When a tile with 0 adjacent mines is revealed, it and all adjacent tiles are automatically revealed.6. **Winning the Game**: The player wins the game when all safe tiles are uncovered and only mines remain uncovered.
## Task
Build a program that allows a person to play the game Minesweeper. Please focus on the internal game logic rather than the presentation / UI layer. First create the board and place mines randomly, and then focus on the game play.
## Input Variables
- `h` - board height in # of cells
- `w` - board width in # of cells
- `m` - number of mines