Ver código fonte

Cool gun is cool.

Is it a gun?
master
Lee 12 anos atrás
pai
commit
03b94d7862
1 arquivos alterados com 29 adições e 20 exclusões
  1. +29
    -20
      src/Goldfish.java

+ 29
- 20
src/Goldfish.java Ver arquivo

@@ -24,7 +24,7 @@ public class Goldfish {
if (_render.reset) {
setup(_render.rule);
_render.reset = false;
}
}
if (!_render.paused) {
String rule = _render.rule;
if (rule.equals("Conway"))
@@ -55,24 +55,24 @@ public class Goldfish {
}
private void setup(String rule) {
if(rule.equals("Conway")) {
int[][] glidergun = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1},
{0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
for(int i = 0; i < 36; i++) {
for(int j = 0; j < 9; j++) {
_grid.getPatch(i+2,j+2).setState(glidergun[j][i]);
}
}
} else if (rule.equals("Life Without Death")) {
if(rule.equals("Conway")) {
int[][] glidergun = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1},
{0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
for(int i = 0; i < 36; i++) {
for(int j = 0; j < 9; j++) {
_grid.getPatch(i+2,j+2).setState(glidergun[j][i]);
}
}
} else if (rule.equals("Life Without Death")) {
int[][] pattern = {
{1,1,1,1,0,1},
{1,0,1,1,1,1}
@@ -83,7 +83,16 @@ public class Goldfish {
}
}
} else if (rule.equals("Brian's Brain")) {
_render.randomize();
int[][] pattern = {
{2,0,2,0,2},
{2,0,2,0,2},
{0,1,0,1,0}
};
for(int i = 0; i < 5; i++) {
for(int j = 0; j < 3; j++) {
_grid.getPatch(i+((_grid.getHeight()-5)/2),j+((_grid.getWidth()-3)/2)).setState(pattern[j][i]);
}
}
}
}


Carregando…
Cancelar
Salvar