**The Rules**

For a space that is 'populated':

Each cell with one or no neighbors dies, as if by loneliness.

Each cell with four or more neighbors dies, as if by overpopulation.

Each cell with two or three neighbors survives.

For a space that is 'empty' or 'unpopulated'

Each cell with three neighbors becomes populated.

My code(not fully complete):

import java.util.Scanner; public class studyhard7 { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("Please enter either 1 or 0:"); int array[][]=new int[5][5]; for(int row=0;row<array.length;row++){ for(int column=0;column<array[row].length;column++){ int a=input.nextInt(); if(a==1||a==0){ array[row][column]=a; } else{ System.out.println("Invalid number"); System.exit(0); } } } genMethod(array); } public static void genMethod(int matrix[][]){ for(int i=1;i<=10;i++){ System.out.println("Generation "+i); for(int row=0;row<matrix.length;row++){ for(int column=0;column<matrix[row].length;column++){ System.out.print(matrix[row][column]+" "); } System.out.println(" "); } } } }

Anyone help me to complete this program, i got stuck to make the rule of the game....please help me....

This post has been edited by **no2pencil**: 09 March 2010 - 08:24 PM

Reason for edit:: Added code tags