|
|
@@ -7,18 +7,22 @@ public class Goldfish { |
|
|
|
private Render _render;
|
|
|
|
|
|
|
|
public Goldfish() {
|
|
|
|
int height = 128;
|
|
|
|
int width = 128;
|
|
|
|
int width = 128;
|
|
|
|
int height = 128;
|
|
|
|
_grid = new Grid(width, height);
|
|
|
|
_render = new Render(width, height, _grid);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
_grid.getPatch(1,0).setState(1);
|
|
|
|
_grid.getPatch(2,1).setState(1);
|
|
|
|
_grid.getPatch(2,2).setState(1);
|
|
|
|
_grid.getPatch(1,2).setState(1);
|
|
|
|
_grid.getPatch(0,2).setState(1);
|
|
|
|
for (int i = 0; i < _grid.getWidth(); i += 16) {
|
|
|
|
for (int j = 0; j < _grid.getHeight(); j += 16) {
|
|
|
|
_grid.getPatch(i + 1, j + 0).setState(1);
|
|
|
|
_grid.getPatch(i + 2, j + 1).setState(1);
|
|
|
|
_grid.getPatch(i + 2, j + 2).setState(1);
|
|
|
|
_grid.getPatch(i + 1, j + 2).setState(1);
|
|
|
|
_grid.getPatch(i + 0, j + 2).setState(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
_grid = Conway.run(_grid);
|
|
|
@@ -26,9 +30,9 @@ public class Goldfish { |
|
|
|
_render.run();
|
|
|
|
_render.sleep();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void main (String[] args) {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
Goldfish g = new Goldfish();
|
|
|
|
g.run();
|
|
|
|
}
|
|
|
|