This project implements an ASCII version of the classic MineSweeper game that you can play in your terminal.
- Practice working with functions.
- Learn about array usage.
- Implement the logic for a complex program.
-
Board Layout:
The minefield is predefined with 8 rows and 5 columns, and starts as an empty ASCII grid. -
Commands:
Commands are strings of three characters in the format "aij", where:- a: Action type
f
to flag a cell.r
to reveal a cell.u
to undo a flag.
- i: Row index (starting from 0).
- j: Column index (starting from 0).
Example:
f12
flags the cell at row 1, column 2. - a: Action type
-
Game Mechanics:
- Revealing a cell (
r
) shows the number of adjacent mines (including diagonals). - If a revealed cell is a mine, the game ends with an explosion, marking incorrect flag placements with an "&".
- The game supports undoing a flag with
u
.
- Revealing a cell (
-
Functions:
You must complete the functions as described in the starter code without changing their names or the board's representation. -
Autograder:
The program must produce exact output for each given input as per the sample outputs. Test each function separately using the provided autograder. -
Collaboration:
Work individually. If you collaborate, document the help in the header of your code.
Implement the recursive reveal feature:
- When a cell with no adjacent mines is revealed, the game should automatically reveal its surrounding cells.
- This feature requires recursion and continues until cells with non-zero adjacent mines are reached.
- Refer to the starter code for further instructions.
Happy coding!