Question
The game of Minesweeper (http://www.chezpoor.com/minesweeper/minesweeper.html) is traditionally a one-player game played against a computer. There are several covered squares and several squares have mines in
The game of Minesweeper (http://www.chezpoor.com/minesweeper/minesweeper.html) is traditionally a one-player game played against a computer. There are several covered squares and several squares have mines in them. The goal of the game is to label all the mines without stepping on any.
The computer hides the mines in the minefield. The user does not know where the mines are. The user then selects squares in the minefield. If the square contains a mine, the game is over. If the square does not contain a mine, the computer puts a number on the square that indicates how many mines are immediate neighbors to that square (or leaves the square blank if there are no immediate neighbors).
In this project, you will read in a minefield from a file. The first line of the file will contain two integers to tell you how big the minefield is (first rows (height), then columns (width)). The dimensions will not exceed 20 x 20. The remaining lines in the file will contain the minefield, where 0 means there is no mine and 1 means there is a mine. Your goal is to make the computer print out the completely revealed board for that minefield, where X indicates the presence of a mine, and the remaining squares contain a count of how many mines are in its immediately neighboring cells.
You will use redirected input to read in the board from a file. I will provide several input files on Blackboard and the results that your program should return, so that you can use those for testing.
Programming in C
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started