In this project we will implement the Minesweeper game. Minesweeper is played on a rectangle grid....

80.2K

Verified Solution

Question

Electrical Engineering

In this project we will implement the Minesweeper game.Minesweeper is played on a rectangle grid. When the game starts, anumber of bombs are hidden on random positions on the field. Inevery round, the player \"touches\" a cell of the field. If the cellcontains a bomb, it explodes, the game ends, and the player loses.Otherwise, the cell is uncovered to show the number of bombs in thevicinity, that is, the number of neighboring cells that containbombs. (Each cell has eight neighbors, including the diagonalneighbors. If the number is zero, the cell is displayed as ablank.) When the user believes she knows the position of a bomb,she can flag that cell with a marker. It is allowed to change one'smind later and uncover a flagged cell. If all cells are eitheruncovered or flagged, and the number of flags is equal to thenumber of bombs, then the game ends and the player wins.

The display should be performed in the Terminal. The C code mustenforce the rules and prevent the players to choose forbiddenoptions.

Do c programming coding based on this qusetion..

Answer & Explanation Solved by verified expert
3.9 Ratings (416 Votes)
A C Program to Implement and Play Minesweeper include using namespace std define BEGINNER 0 define INTERMEDIATE 1 define ADVANCED 2 define MAXSIDE 25 define MAXMINES 99 define MOVESIZE 526 25 25 99 int SIDE side length of the board int MINES number of mines on the board A Utility Function to check whether given cell row col is a valid cell or not bool isValidint row int col Returns true if row number and column number is in range return row 0 row SIDE col 0 col SIDE A Utility Function to check whether given cell row col has a mine or not bool isMine int row int col char boardMAXSIDE if boardrowcol return true else return false A Function to get the users move void makeMoveint x int y Take the input move printfEnter your move row column scanfd d x y return A Function to print the current gameplay board void printBoardchar myBoardMAXSIDE int i j printf for    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students