Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Minesweeper The year is 1992... Microsoft has just released Windows 3.1 and packaged with it is a beautiful game called Minesweeper.
For many people, this game is the first game they will have (and the last game they will need) on their Windows computer,
and it is still a classic. If you'd like to try the game, it's available as a Google Search Game here. In this assignment,
you will be implementing COMP1511's version of this classic logic puzzle game. Our Minesweeper is a program that allows us to set up and play a game using a series of commands in a terminal.
The commands are made up of integers typed directly into our program. Each command will make some change to a minefield,
a two dimensional space that hides some mines that a player is trying not to uncover. The aim of minesweeper is
to reveal every square in the minefield except for the ones containing mines. Minesweeper is already capable of drawing a
certain view of the minefield, but it will be up to you to write code so that it can get input from the user on where mines are
initially placed, and read commands to make the correct changes to the minefield. The finished product of Minesweeper is
a simplified playable version of the game. Note: At time of release of this assignment (end of Week 3), COMP1511 has not
yet covered all of the techniques and topics necessary to complete this assignment. At the end of Week 3, the course has covered
enough content to be able to read in a single command and process its integers, but not enough to work with two
dimensional arrays like the minefield or be able to handle multiple commands ending in End-of-Input (Ctrl-D). We will be covering
these topics in the lectures, tutorials, labs, and a live stream in Week 4. The Minefield The minefield is a two dimensional
array (an array of arrays) of integers that represents the space that the game is played in. We will be referring to individual
elements of these arrays as squares in the minefield. The minefield is a fixed size grid and has SIZE rows, and SIZE columns.
SIZE is a #define 'd constant. Both the rows and columns start at 0, not at 1. The top left corner of the grid is (0, 0) and
the bottom right corner of the grid is (SIZE - 1, SIZE - 1) . Note that we are rows as the first coordinate in pairs of coordinates.
For example, if we are given an input pair of coordinates 5 6 , we will use that to find a particular square in our minefield by
accessing the individual element in the array: minefield[5][6]
In the game of minesweeper these states are displayed to the player: A revealed square A square that is unrevealed
Since a square that has not been revealed may or may not contain a mine, there are actually 3 values a square can take.
These are represented by the following #define 'd integers: #define VISIBLE_SAFE 0 : this represents a square that has
been revealed. #define HIDDEN_SAFE 1 : this represents a square that has not been revealed but does not contain a
mine. #define HIDDEN_MINE 2 : this represents a square that has not been revealed and contains a mine.
When the program is started, all of the squares should be HIDDEN_SAFE . The minefield is then populated with mines
(i.e., HIDDEN_MINE ) by scanning the locations of the mines, using the code you will write. The way you reveal squares
in the original minesweeper requires a concept not taught in COMP1511 so has been replaced by another revealing command: REVEAL_CROSS :
reveal the selected square, for each of the four directly connected squares, only reveal if they have no mines adjacent.