A simple Game of Life implementation in Java
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Goldfish.java 850 B

il y a 11 ans
il y a 11 ans
il y a 11 ans
il y a 11 ans
il y a 11 ans
il y a 11 ans
il y a 11 ans
1234567891011121314151617181920212223242526272829303132333435
  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. int height = 96;
  8. int width = 96;
  9. _grid = new Grid(width, height);
  10. _render = new Render(width, height, _grid);
  11. }
  12. public void run() {
  13. _grid.getPatch(1,0).setState(1);
  14. _grid.getPatch(2,1).setState(1);
  15. _grid.getPatch(2,2).setState(1);
  16. _grid.getPatch(1,2).setState(1);
  17. _grid.getPatch(0,2).setState(1);
  18. while (true) {
  19. _grid = Conway.run(_grid);
  20. _render.setGrid(_grid);
  21. _render.run();
  22. _render.sleep();
  23. }
  24. }
  25. public static void main (String[] args) {
  26. Goldfish g = new Goldfish();
  27. g.run();
  28. }
  29. }