|
|
@@ -9,7 +9,6 @@ public class Goldfish { |
|
|
|
|
|
|
|
private Grid _grid;
|
|
|
|
private Render _render;
|
|
|
|
|
|
|
|
private Random random = new Random();
|
|
|
|
|
|
|
|
public Goldfish() {
|
|
|
@@ -22,11 +21,11 @@ public class Goldfish { |
|
|
|
public void run() {
|
|
|
|
setup(_render.rule);
|
|
|
|
while (true) {
|
|
|
|
if (_render.reset) {
|
|
|
|
setup(_render.rule);
|
|
|
|
_render.reset = false;
|
|
|
|
if (_render.reset) {
|
|
|
|
setup(_render.rule);
|
|
|
|
_render.reset = false;
|
|
|
|
}
|
|
|
|
if (!_render.paused) {
|
|
|
|
if (!_render.paused) {
|
|
|
|
String rule = _render.rule;
|
|
|
|
if (rule.equals("Conway"))
|
|
|
|
_grid = Conway.run(_grid);
|
|
|
@@ -42,19 +41,19 @@ public class Goldfish { |
|
|
|
_render.sleep();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int getMaxStates(String rule) { |
|
|
|
if (rule.equals("Conway")) |
|
|
|
return Conway.states; |
|
|
|
else if (rule.equals("Conway4")) |
|
|
|
return Conway4.states; |
|
|
|
else if (rule.equals("Life Without Death")) |
|
|
|
return LifeWithoutDeath.states; |
|
|
|
else if (rule.equals("Brian's Brain")) |
|
|
|
return BriansBrain.states; |
|
|
|
return 2; |
|
|
|
|
|
|
|
public static int getMaxStates(String rule) {
|
|
|
|
if (rule.equals("Conway"))
|
|
|
|
return Conway.states;
|
|
|
|
else if (rule.equals("Conway4"))
|
|
|
|
return Conway4.states;
|
|
|
|
else if (rule.equals("Life Without Death"))
|
|
|
|
return LifeWithoutDeath.states;
|
|
|
|
else if (rule.equals("Brian's Brain"))
|
|
|
|
return BriansBrain.states;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void setup(String rule) {
|
|
|
|
if(rule.equals("Conway")) {
|
|
|
|
int[][] glidergun = {
|
|
|
|