Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions com/laboon/Cell.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,17 @@ public State iterate(int numNeighbors) {
* @return Character representation of the cell's state
*/

public char getStateRep() {
char toReturn = ' ';
if (_state == State.DEAD) {
toReturn = '.';
} else if (_state == State.ALIVE) {
toReturn = '*';
} else {
toReturn = ' ';
}
return toReturn;

public char getStateRep() {
char toReturn = ' ';
if (_state == State.DEAD) {
toReturn = ' ';
} else if (_state == State.ALIVE) {
toReturn = '*';
} else {
toReturn = ' ';
}
return toReturn;
}

/**
Expand Down
32 changes: 16 additions & 16 deletions com/laboon/JavaLife.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

public class JavaLife {

/**
* This is the main part.
*
* @param size Size of world
* @param seed Random number seed
* @param percent Percent of cells alive at beginning
* @param maxIterations Maximum number of iterations
*/

/**
*
* @param size Size of a world
* @param seed Random number seed for RNG
* @param percent Percent of cells alive at beginning
* @param maxIterations Maximum number of iterations
*/

public JavaLife(int size, int seed, int percent, int maxIterations) {
World w = new World(size, seed, percent);
System.out.println("Initial Configuration:");
System.out.println(w.toString());
for (int j=0; j < maxIterations; j++) {
w = w.iterate();
System.out.println("Iteration " + (j + 1) + ":");
System.out.println(w.toString());
public JavaLife(int size, int seed, int percent, int maxIterations) {
World w = new World(size, seed, percent);
System.out.println("Initial Configuration:");
System.out.println( w.toString() );
for (int j=0; j < maxIterations; j++) {
w = w.iterate();
System.out.println("Iteration " + (j + 1) + ":");
System.out.println(w.toString());
}

}
Expand Down