Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

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. Instead of reading in the gameboard from the file, prompt the user for x and y dimensions of the gameboard and how many mines to hide. Then, randomly generate the location of the mines and print out the game board and the revealed board. Dont forget to ensure that each random location is unique (dont place 2 mines in the same spot). Hint: use srand() and rand().

PROGRAMMING IN C

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago