Question
Please help with my game of life project in Java Create a GUI application for Conways game of life. The game of life application should
Please help with my game of life project in Java
Create a GUI application for Conways game of life.
The game of life application should consist of a grid board of size N x N cells. A cell can either be empty (dead cell) or occupied by a creature (live cell). The surrounding cells are called the neighbors of this cell.
Each game state is called a generation. The game progresses from one generation to the next according to the following rules:
A creature that has two or three neighbors will continue live in the next generation.
A creature that has more than 3 neighbors will die of overcrowding. Its cell will be empty in the next generation.
A creature that has less than 2 neighbors will die of loneliness.
A new creature born in an empty cell that has exactly 3 neighbors.
The initial state of the grids is called the seed of the program. You can choose any initial configuration.
Write a GUI program that consists of an N x N grid board and displays the state of the grids at each generation. The program should contain the following features:
Prompt for the size of the board.
Allow the player to use the mouse to select the initial state of the grid. By clicking on a cell you can change to state of the cell. You can indicate the state of the cell using two different colors, one color of an empty cell and another for a cell occupied by a creature.
A start and stop button to start and stop the game.
Display the state of the cells at each generation. You can use a pre-determined time to update the grid between generations. (Use the Thread.sleep() method to pause the program for a specified time.)
Note that the changes in the board in each generation are done simultaneously on all the cells, so you may need to update the all the grid locations before you display the grid again. You may need to use two grid arrays for computing the changes.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started