A simple implementation of the popular game Мinesweeper, written in C++.
Purpose of the game: to reveal all positions in a given square matrix that are not marked as mined without revealing any of the mines first. The user wins if all mines are marked and loses if any mine is opened.
Functionality:
- The user must choose valid size of the matrix field (from 3 to 10) and valid number of mines (from 1 to 3*size of the field) to be hidden in order to start playing. If the data is not valid, then the user will be asked to enter it again;
- Then the user should type a valid command and coordinates of a cell form the field. Again, if any of the given data is invalid, the user will be asked to enter it again.
*Note: Valid commands are:
- open (If there is a mine there - game over);
- mark (Marks the cell as a ‘mine’);
- unmark (Unmarks the cell so it is not marked as a ‘mine’ anymore).
- If the user steps on a mine, he automatically loses the game.
- If the user has already marked all mines and opened all of the other cells, he wins the game.