# Console Application for Minesweeper In this milestone, students will create three classes: Cell, Board, and Program.     Create a class that models a game cell. A game cell should have the following properties: a.Its row and column. These should initially be set to -1. b.Its visited boolean value. This should initially be set to false.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

C# Console Application for Minesweeper

In this milestone, students will create three classes: Cell, Board, and Program.

 

 

Create a class that models a game cell. A game cell should have the following properties:

a.Its row and column. These should initially be set to -1.

b.Its visited boolean value. This should initially be set to false.

c.Live boolean value. This should initially be set to false. "Live" set to true will indicate that the cell is a "live bomb" cell.

d.The number of neighbors that are "live." This should initially be set to 0.

The Cell class should have a constructor, as well as getters and setters for all properties.

3.Create a class that models a game board. A game board should have the following properties:

a.Size. The board will be square, where the size includes the dimensions of both the length and width of the board.

b.Grid. The grid will be a 2-dimensional array of the type cell.

c.Difficulty. A percentage of cells that will be set to "live" status.

4.The Board class should have the following methods:

a.The constructor for the Board should have a single parameter to set the size of the Grid. In its constructor, the Grid should be initialized so that a Cell object is stored at each location.

b.setupLiveNeighbors. A method to randomly initialize the grid with live bombs. The method should utilize the Difficulty property to determine what percentage of the cells in the grid will be set to "live" status.

c.calculateLiveNeighbors. A method to calculate the live neighbors for every cell on the grid. A cell should have between 0 and 8 live neighbors. If a cell itself is "live," then you can set the neighbor count to 9.

5.Program

a.The Program class should be the console app that drives the application. This is the class that should contain a main() method. The main program should have a printBoard helper method that uses, for loops, the Console.write and Console.writeLine commands to display the contents of the Board as shown at the beginning of these instructions.

6.The main() method should:

a.Create an instance of the Board class.

b.Call the Board.setupLiveNeighbors and Board.calculateLiveNeighbors commands to initialize the grid.

c.Call the printBoard method to display the contents of the grid.

llvmware-host\Shared Folders\Documents\Visual Studio
2017\projects\Min
+ 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10+ 11+
-+
-+-
+
+
-+-
-+
B 0 I 0 01 111
I 1 1 1 2
* I 2 H 1 I0 0
+
+
+
+
E 1 H 1 1 1 | *
I 1
I1 1 * :
3 I * | 1 0 1 1
-+
+
-+
+
E 1 H * 1
I 1 H 2 1 2 H1 I 1 H0 1 2
I 3 I 3 2
-+
+--
-+-
-+-
+
-+
+
E 1 H 1 1
I1 1 2 : * | * | 1 | 0 | 1
+
-+
+
+---+
+
-+
+
----
----
---
E 0 I 0 0 11 *
I 4 I 3 1 1 1 0 1 1 1
* |1 | 4
+
-+
-+
-+--
---
-+
-+
-+
-+
-----
---
E 1 H 1 1
I1 1 2 : *
I 1 10 0 111 1 1 1 5
+
--+-
1 |1 I 0 0 6
----
-+--
----
-+-
----
*---
-+-
----
-+-
----
---
: 1 * : 2 1 1 2
+-
+---+
-+-
+-
-+-
+----+
--- ----
E 2 1 3 I * 1
I 1 1 * | 1 1 2 H
* 3 | 1 0 7
+---
+--
+--
+----
+
+-
+---
----+
E
+-
2 2 1 0:0 0: 0 0 I 1 I
I * 2 1 1 1 1 1 1 1 1 1 1 2 1 * | * 1 10 8
+---
+-
+-- -
+-- -
+-
-+-
-+
+
+---
+---+
---
3 I 3 H 2 10 9
+---
-+-
-+-
-+-
+-
-+
-+
+
+-
----
+
---
---
| * 1 |0 0 0 0 0I0 I
+
2 * ! 21 01 10
---+-
-+-
-+-
+---
-+-
1 I 1 |0 |0 0 |0 :0 O I
2 * 2 I 0 11
-+---+
Transcribed Image Text:llvmware-host\Shared Folders\Documents\Visual Studio 2017\projects\Min + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10+ 11+ -+ -+- + + -+- -+ B 0 I 0 01 111 I 1 1 1 2 * I 2 H 1 I0 0 + + + + E 1 H 1 1 1 | * I 1 I1 1 * : 3 I * | 1 0 1 1 -+ + -+ + E 1 H * 1 I 1 H 2 1 2 H1 I 1 H0 1 2 I 3 I 3 2 -+ +-- -+- -+- + -+ + E 1 H 1 1 I1 1 2 : * | * | 1 | 0 | 1 + -+ + +---+ + -+ + ---- ---- --- E 0 I 0 0 11 * I 4 I 3 1 1 1 0 1 1 1 * |1 | 4 + -+ -+ -+-- --- -+ -+ -+ -+ ----- --- E 1 H 1 1 I1 1 2 : * I 1 10 0 111 1 1 1 5 + --+- 1 |1 I 0 0 6 ---- -+-- ---- -+- ---- *--- -+- ---- -+- ---- --- : 1 * : 2 1 1 2 +- +---+ -+- +- -+- +----+ --- ---- E 2 1 3 I * 1 I 1 1 * | 1 1 2 H * 3 | 1 0 7 +--- +-- +-- +---- + +- +--- ----+ E +- 2 2 1 0:0 0: 0 0 I 1 I I * 2 1 1 1 1 1 1 1 1 1 1 2 1 * | * 1 10 8 +--- +- +-- - +-- - +- -+- -+ + +--- +---+ --- 3 I 3 H 2 10 9 +--- -+- -+- -+- +- -+ -+ + +- ---- + --- --- | * 1 |0 0 0 0 0I0 I + 2 * ! 21 01 10 ---+- -+- -+- +--- -+- 1 I 1 |0 |0 0 |0 :0 O I 2 * 2 I 0 11 -+---+
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY