Bläddra i källkod

Remove printing from Conway

master
Josh Hofing 12 år sedan
förälder
incheckning
b974a506d0
2 ändrade filer med 12 tillägg och 10 borttagningar
  1. +12
    -4
      src/Goldfish.java
  2. +0
    -6
      src/rules/Conway.java

+ 12
- 4
src/Goldfish.java Visa fil

@@ -15,20 +15,28 @@ public class Goldfish {

public void run () {
//TODO: make it run.
_grid.getPatch(0,1).setState(1);
_grid.getPatch(1,2).setState(1);
_grid.getPatch(2,2).setState(1);
_grid.getPatch(1,0).setState(1);
_grid.getPatch(2,1).setState(1);
_grid.getPatch(2,0).setState(1);
_grid.getPatch(2,2).setState(1);
_grid.getPatch(1,2).setState(1);
_grid.getPatch(0,2).setState(1);
System.out.println(_grid);

_grid = Conway.run(_grid);
System.out.println("------------");
System.out.println(_grid);

_grid = Conway.run(_grid);
System.out.println("------------");
System.out.println(_grid);
_grid = Conway.run(_grid);
System.out.println("------------");
System.out.println(_grid);

_grid = Conway.run(_grid);
System.out.println("------------");
System.out.println(_grid);
}

public static void main (String[] args) {


+ 0
- 6
src/rules/Conway.java Visa fil

@@ -20,14 +20,11 @@ public class Conway extends RuleSet {
int numAlive = 0;
for (Patch neighbor : neighbors)
if (neighbor.getState() == 1) numAlive++;
//System.out.println(numAlive);
Patch p = g.getPatch(i,j).clone(newGrid);
if (numAlive < 2) {
p.setState(0); //Dies by underpopulation
//System.out.println("ded by under");
}
if (numAlive > 3) {
//System.out.println("ded by over");
p.setState(0); //Dies by overpopulation
}
if (numAlive == 3)
@@ -36,9 +33,6 @@ public class Conway extends RuleSet {
}
}

System.out.println(g);
System.out.println("-----");
System.out.println(newGrid);
//boolean running = true;
//while (running) {
//running = false;


Laddar…
Avbryt
Spara