Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// Calculate the next generation of cells private void NextGeneration() { for (int y = 1; y { for (int x= 0; x { Int

// Calculate the next generation of cells

private void NextGeneration()

{

for (int y = 1; y

{

for (int x= 0; x

{


Int count = -1;

If ( true)

{


count = CountNeighborsFinite(x, y);


}

else

{


count = CountNeighborsToroidal(x, y);

}

//Apply the rules


If ( universe[x, y]

{

If ((count 3)))

{

ScratchPad[x,y] = false;

}

Else

{

ScratchPad[x,y] = true;

}


}


Else

{


If (count == 3)

{

ScratchPad[x,y] = false;

}

Else if ( count != 3)

{

ScratchPad[x,y] = true;

}


//Apply the rules


// turn on/off sketchpad

}

}


// Increment generation count

generations++;

// Update status strip generations

toolStripStatusLabelGenerations.Text = "Generations = " + generations.ToString();

}

image text in transcribed
1. Render Conway's Game of Life in a .NET application. A grid should be rendered representing the individual cells. Cells can be turned on and off by clicking on them with the mouse. Once a group of cells are turned on and the game runs they should live or die according the 4 rules of the game. a. Living cells with less than 2 living neighbors die in the next generation. b. Living cells with more than 3 living neighbors die in the next generation. c. Living cells with 2 or 3 living neighbors live in the next generation. d. Dead cells with exactly 3 living neighbors live in the next generation. 2. Start, Pause and Next menu items and tool strip buttons. The game should start running by clicking on a Start menu item or a tool strip button. The game should be pause by clicking on a Pause menu item or a tool strip button. If currently paused, the game can be advanced 1 generation by clicking on a Next menu item or a tool strip button. 3. Randomizing the universe. The current universe can be randomly populated from time or from a seed variable. The user should be able to edit the seed variable through a dialog box. Randomizing should occur when a menu item is clicked on. 4. Emptying the universe. The universe should be emptied of all living cells through a New or Clear menu item. 5. Saving the current universe to a text file. The current state and size of the universe should be able to be saved in RlainText file format. The file name should be chosen by the user with a save file dialog box. 6. Opening a previously saved universe. A previously saved plaintext file should be able to be read in and assigned to the current universe. Opening should also resize the current universe to match the size of the file being read. 7. Show the current generation. The current generation should be able to be displayed in a status strip. 8. Show the current number of living cells. The current number of living cells should be displayed in a status strip. 9. Controlling how many milliseconds between new generations. The number of milliseconds between new generations should be adjustable through a dialog box. 10. Controlling the current size of the universe. The width and height of the current. universe should be able to be chosen through a modal dialog box. 11. Displaying the neighbor count in each cell. Render the neighbor count for each individual cell. The user should be able to toggle this feature on and off using the View menu. 12. View Menu Items. Implement a View Menu that toggles the grid on an off, toggles the neighbor count display and toggles the heads up display (if the heads up is Implemented as an advanced feature.)

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

Define influence diagram.

Answered: 1 week ago