Language is c++  Assignment 6 C: Minesweeper - Simplified. For many years, computers sold with the Windows operating system would contain a game called M inesweeper. The player would be presented with a grid, where they would have to click an empty part of the map. If they clicked on a hidden mine, the game would be instantly over. However, if they clicked a safe spot, a hint about nearby mines would be displayed and the player would click another spot. The goal would be to flag all the hidden mines without hitting one. (As an aside, many people did not know these rules and just clicked around randomly until they hit a mine) We will be developing a simplified version of this game. You will prompt the user for a grid size and then created a 2D array with equal width and height (C++ students: Check the Appendix for more information on how to do this). You will initialize the 2D char array with each element equallying a ‘?’ symbol. You will then randomly generate one “mine” value per column in the 2D and store their row locations in a separate 1D array (the 1D array’s index will represent the column of the 2D array). The player will be prompted the user to enter an X and Y coordinate on the grid. If the space is "free”, you will replace the value at that index with a ‘_’ symbol. If the space has a hidden mine, you will place an ‘X’ symbol at that index instead. Afterwards, print the 2D array again. If the player hit a mine, tell them they lost and that the game is over. Otherwise, conduct a linear search of the 2D array and count how many ‘_’ symbols there are (Hint: Use a nested FOR loop). If the count equals the grid size, tell the player they won. Hint: Reference your code from past Assignments as a starting point for this one.   I included sample outputs in the pictures

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Language is c++ 

Assignment 6 C: Minesweeper - Simplified. For many years, computers sold with the Windows operating system would contain a game called M inesweeper. The player would be presented with a grid, where they would have to click an empty part of the map. If they clicked on a hidden mine, the game would be instantly over. However, if they clicked a safe spot, a hint about nearby mines would be displayed and the player would click another spot. The goal would be to flag all the hidden mines without hitting one. (As an aside, many people did not know these rules and just clicked around randomly until they hit a mine)
We will be developing a simplified version of this game. You will prompt the user for a grid size and then created a 2D array with equal width and height (C++ students: Check the Appendix for more information on how to do this). You will initialize the 2D char array with each element equallying a ‘?’ symbol. You will then randomly generate one “mine” value per column in the 2D and store their row locations in a separate 1D array (the 1D array’s index will represent the column of the 2D array).
The player will be prompted the user to enter an X and Y coordinate on the grid. If the space is "free”, you will replace the value at that index with a ‘_’ symbol. If the space has a hidden mine,
you will place an ‘X’ symbol at that index instead. Afterwards, print the 2D array again.
If the player hit a mine, tell them they lost and that the game is over. Otherwise, conduct a linear search of the 2D array and count how many ‘_’ symbols there are (Hint: Use a nested FOR loop). If the count equals the grid size, tell the player they won.
Hint: Reference your code from past Assignments as a starting point for this one.

 

I included sample outputs in the pictures 

Sample Output #2:
[Minesweeper - DOS Edition]
What is the grid size? 3
???
???
???
Enter your X coordinate: o
Enter your Y coordinate: 0
_??
???
???
Enter your X coordinate: 1
Enter your Y coordinate: 1
_??
?_?
???
Enter your X coordinate: 1
Enter your Y coordinate: 2
_??
?_?
?_?
You win!
Transcribed Image Text:Sample Output #2: [Minesweeper - DOS Edition] What is the grid size? 3 ??? ??? ??? Enter your X coordinate: o Enter your Y coordinate: 0 _?? ??? ??? Enter your X coordinate: 1 Enter your Y coordinate: 1 _?? ?_? ??? Enter your X coordinate: 1 Enter your Y coordinate: 2 _?? ?_? ?_? You win!
Sample Output #1:
[Minesweeper - DOS Edition]
What is the grid size? 6
??????
??????
??????
??????
??????
??????
Enter your X coordinate: 2
Enter your Y coordinate: 5
??????
??????
??????
??????
??????
??X???
Sorry, you hit a mine!
Transcribed Image Text:Sample Output #1: [Minesweeper - DOS Edition] What is the grid size? 6 ?????? ?????? ?????? ?????? ?????? ?????? Enter your X coordinate: 2 Enter your Y coordinate: 5 ?????? ?????? ?????? ?????? ?????? ??X??? Sorry, you hit a mine!
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education