Game of life, JAVA Programming

Conway's Game of Life is a "cellular automaton" that is played on a 2D grid (array) of cells. At the start of the game, an initial configuration is set up in which a number of cells are considered to be alive, while the remainder of the cells are considered to be dead.

The game of life proceeds in discrete steps called generations. In each generation, some of the cells will change from dead to alive, and vice-versa, according to specific rules. The rules are based on the neighborhood of 8 cells surrounding each cell, and are given as follows:

1.     Any live cell with fewer than two live neighbours dies, as if caused by under-population.

2.     Any live cell with two or three live neighbours lives on to the next generation.

3.     Any live cell with more than three live neighbours dies, as if by overcrowding.

4.     Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

Assignment

In this assignment, you will implement Conway's game of life. Like Mine Sweeper, this is a good project for working with 2D arrays, and also will give you some experience reading text files, as well as some simple GUI programming.

Instructions

1.  Write a program that will play Conway's game of life.

2.  The program must take the name of an input text file as user input somehow.

3. Input files will contain a first line stating the resolution of the life array, and then a number of lines giving the initial configuration of the array. (An "X" character is considered to be alive, and other characters are considered to be dead.) Your program must be able to handle life arrays of different sizes specified in an input file.

4.  Your program must handle "toroidal addressing" for the edges of the array. In other words, the left and right sides of the life array must be connected, as well as the top and bottom.

5.  You should display your life game in a GUI window. There are several ways to do this. One would be to have your application extend JFrame, and then use JLabels for each of the cells in a GridLayout.

6.   Provide a way for the user to specify the rate at which generations occur (for example, by using a Timer).

7.   Optional: Create a few interesting input files for your program.

Posted Date: 2/19/2013 7:00:06 AM | Location : United States







Related Discussions:- Game of life, Assignment Help, Ask Question on Game of life, Get Answer, Expert's Help, Game of life Discussions

Write discussion on Game of life
Your posts are moderated
Related Questions
Write names of the DoS attack's phases? DoS (Denail of service): DoS attach has in total 3 kinds of phases and below they are listed: 1. Search 2. Arm 3. Attack

This project is based on the teams example of chapter 1. Instead of teams, you will consider employees working in a department in a company. (Departments and employees are analog

Explain Choosing Font Faces and Sizes in java AWT packages? Choosing a font face is simple. First you create a new Font object. Then you call g.setFont(Font f). To instantiate

Does Java pass arguments by value or reference? Ans) Pass by value. 1. When passing primitives, it going a copy of the variable to the method. Any change made in the method d

I want ProSport Savings Plans Project Description: To prepare an application on iPhone, Mac, iPad and Android, which does the subsequent:- Provides a calculation of the am

What is File Transfer Protocol? This protocol is used to upload the files on remote computers. This is used to transfer files among computer on TCP/IP network e.g. internet and

Application Rewrite Project Description: There is an app that I want to be rewritten in order to support multiple profiles. The App is an OTP generator. It is required to

Java Is For Real Java has a lot of hype however much of it is deserved. Java is very well matched for many modern problems Using more CPU time and memory but less programmer

Question: (a) Java does not support multiple inheritance but does provide the concept of ‘interface'. Explain how interfaces can help a programmer to implement multiple inheri

Explain the term array and Scope of Variable? Defining the space in that a variable is effective is known as describing the scope of a variable. A variable can be either local