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.

52 lines
896 B

  1. package edu.stuy.goldfish;
  2. public class Patch {
  3. private int _xcor, _ycor, _state;
  4. private String _label;
  5. private Grid _myGrid;
  6. public Patch(Grid grid, int xcor, int ycor, int state, String label) {
  7. _myGrid = grid;
  8. _xcor = xcor;
  9. _ycor = ycor;
  10. _state = state;
  11. _label = label;
  12. }
  13. public Patch() {
  14. this(new Grid(), 0, 0, 0, "");
  15. }
  16. public Grid getGrid() {
  17. return _grid;
  18. }
  19. public int getX() {
  20. return _xcor;
  21. }
  22. public int getY() {
  23. return _ycor;
  24. }
  25. public int getState() {
  26. return _state;
  27. }
  28. public void setState(int state) {
  29. _state = state;
  30. }
  31. public String getLabel() {
  32. return _label;
  33. }
  34. public void setLabel(String label) {
  35. _label = label;
  36. }
  37. public String toString() {
  38. return _plabel;
  39. }
  40. }