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.

35 lines
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. }