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.

35 lignes
601 B

  1. package edu.stuy.goldfish;
  2. public class Patch {
  3. private int _pxcor, _pycor, _state;
  4. private String _plabel;
  5. private Grid _myGrid;
  6. public Patch(Grid grid, int xcor, int ycor, int state) {
  7. _myGrid = grid;
  8. _pxcor = xcor;
  9. _pycor = ycor;
  10. _state = state;
  11. }
  12. public Patch() {
  13. this(new Grid(), 0, 0, 0);
  14. }
  15. public Grid getGrid() {
  16. return _grid;
  17. }
  18. public int getX() {
  19. return _pxcor;
  20. }
  21. public int getY() {
  22. return _pycor;
  23. }
  24. public String toString() {
  25. return _plabel;
  26. }
  27. }