Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c program seashell Minesweeper is a computer game dating back to the 1970s. (It no longer comes with Windows, but is still playable online in

c program seashell

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

image text in transcribedimage text in transcribed

Minesweeper is a computer game dating back to the 1970s. (It no longer comes with Windows, but is still playable online in a number of places, such as here). The rules can be found here You have been provided with minesweeper.h and must complete minesweeper.c. This module is responsible for the game logic. It is used to update the board when the client wants to make a move and to determine if the game is over. A human will play the game. You are not writing code to play the game. The game rules match the rules linked above, with three differences. First, if you lose it does not reveal the entire board. Second, there is only one kind of fiag, no ?' flag for uncertain squares. Third there is no promise that your first click is not a mine! This module can be used to create a graphical game like the version linked above. Seashell only supports text interfaces though, so we have created for you an ASCII version of minesweeper, in the game.1l program. About the rules A Minesweeper board is a 2D grid of tiles. Initially all tiles are un-revealed The goal in Minesweeper is to reveal all tiles on the board except the ones containing mines. When you reveal a tile, you either uncover a mine (an asterisk character),losing the game, or you uncover a number (a digit character '0' through '8'). This digit represents the number of nearby mines, where "nearby" means "in the 8 adjacent tiles" (tiles at the edges of the board have fewer than 8 adjacent tiles) Winning involves making careful deductions based on the numbers revealed. It also usually involves dumb luck. Because it's difficult to keep track of all of the mines in one's head, the game usually lets the player place a flag on a tile they are sure contains a mine. This has no effect other than preventing them from revealing it accidentally, and reminding them of the locations of mines. We will be using the character "F, to represent a flag. Flag starts with 'F' and 'F' also looks like a flag (sort of), so it's a double win Example Game Again, please note that you're not required to understand the logic of the player's moves. You are only writing functions that update the board after a human player has made a move. About our representation We will represent the 2D board as an array of characters using the approach used on slide 07-45. To make things easier on human players, the interface starts counting rows and columns from 1 rather than from 0. That is, the first element in the array will correspond to row 1, column 1 (instead of row 0, column 0 like it does in the notes) As in the course notes, the first character in the array represents the first character in the first row, the second represents the second character in the first row, etc. Board tiles are represented using space . . for an un-revealed tile,'F' for a flag, '0' through '8' for a mine-free revealed tile, and .*. for a revealed tile that has a mine in it. These characters have been defined as constants for you About our game program The game has a limit of 16 for each dimension of the board. This is to keep the board small enough to display nicely in ASCII. The minesweeper.c module does not have this restriction! Read the interface carefully! Note: Because there is a lot of text involved in the game program, we strongly recommend against creating .expect files for use with game.11. Create an assertion-based testing client, like the one we have provided Minesweeper is a computer game dating back to the 1970s. (It no longer comes with Windows, but is still playable online in a number of places, such as here). The rules can be found here You have been provided with minesweeper.h and must complete minesweeper.c. This module is responsible for the game logic. It is used to update the board when the client wants to make a move and to determine if the game is over. A human will play the game. You are not writing code to play the game. The game rules match the rules linked above, with three differences. First, if you lose it does not reveal the entire board. Second, there is only one kind of fiag, no ?' flag for uncertain squares. Third there is no promise that your first click is not a mine! This module can be used to create a graphical game like the version linked above. Seashell only supports text interfaces though, so we have created for you an ASCII version of minesweeper, in the game.1l program. About the rules A Minesweeper board is a 2D grid of tiles. Initially all tiles are un-revealed The goal in Minesweeper is to reveal all tiles on the board except the ones containing mines. When you reveal a tile, you either uncover a mine (an asterisk character),losing the game, or you uncover a number (a digit character '0' through '8'). This digit represents the number of nearby mines, where "nearby" means "in the 8 adjacent tiles" (tiles at the edges of the board have fewer than 8 adjacent tiles) Winning involves making careful deductions based on the numbers revealed. It also usually involves dumb luck. Because it's difficult to keep track of all of the mines in one's head, the game usually lets the player place a flag on a tile they are sure contains a mine. This has no effect other than preventing them from revealing it accidentally, and reminding them of the locations of mines. We will be using the character "F, to represent a flag. Flag starts with 'F' and 'F' also looks like a flag (sort of), so it's a double win Example Game Again, please note that you're not required to understand the logic of the player's moves. You are only writing functions that update the board after a human player has made a move. About our representation We will represent the 2D board as an array of characters using the approach used on slide 07-45. To make things easier on human players, the interface starts counting rows and columns from 1 rather than from 0. That is, the first element in the array will correspond to row 1, column 1 (instead of row 0, column 0 like it does in the notes) As in the course notes, the first character in the array represents the first character in the first row, the second represents the second character in the first row, etc. Board tiles are represented using space . . for an un-revealed tile,'F' for a flag, '0' through '8' for a mine-free revealed tile, and .*. for a revealed tile that has a mine in it. These characters have been defined as constants for you About our game program The game has a limit of 16 for each dimension of the board. This is to keep the board small enough to display nicely in ASCII. The minesweeper.c module does not have this restriction! Read the interface carefully! Note: Because there is a lot of text involved in the game program, we strongly recommend against creating .expect files for use with game.11. Create an assertion-based testing client, like the one we have provided

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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

Students also viewed these Databases questions

Question

When is it appropriate to use a root cause analysis

Answered: 1 week ago

Question

Is the person willing to deal with the consequences?

Answered: 1 week ago