A simple Game of Life implementation in Java
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
836 B

  1. package edu.stuy.goldfish;
  2. import edu.stuy.goldfish.rules.*;
  3. public class Goldfish {
  4. private Grid _grid;
  5. private Render _render;
  6. public Goldfish () {
  7. _render = new Render(640, 480);
  8. _grid = new Grid(10, 10);
  9. }
  10. public void run () {
  11. //TODO: make it run.
  12. _grid.getPatch(1,0).setState(2);
  13. _grid.getPatch(2,1).setState(2);
  14. _grid.getPatch(2,2).setState(2);
  15. _grid.getPatch(1,2).setState(2);
  16. _grid.getPatch(0,2).setState(2);
  17. System.out.println(_grid);
  18. for (int i = 0; i < 6; i++) {
  19. _grid = BriansBrain.run(_grid);
  20. System.out.println("------------");
  21. System.out.println(_grid);
  22. }
  23. }
  24. public static void main (String[] args) {
  25. Goldfish g = new Goldfish();
  26. g.run();
  27. }
  28. }