diff --git a/src/Grid.java b/src/Grid.java index 8943dd1..9fb1e1b 100644 --- a/src/Grid.java +++ b/src/Grid.java @@ -11,8 +11,8 @@ public class Grid { public Grid(int x, int y) { _grid = new Patch[x][y]; - for(int i = 0; i < x; i++) { - for(int j = 0; j < y; j++) { + for (int i = 0; i < x; i++) { + for (int j = 0; j < y; j++) { _grid[i][j] = new Patch(this, i, j); } } @@ -36,8 +36,8 @@ public class Grid { public String toString() { String ans = ""; - for(int i = 0; i < _grid.length; i++) { - for(int j = 0; j < _grid[i].length; j++) { + for (int i = 0; i < _grid.length; i++) { + for (int j = 0; j < _grid[i].length; j++) { ans += _grid[i][j]; } ans += "\n"; diff --git a/src/Patch.java b/src/Patch.java index b2faf4c..ad4b31e 100644 --- a/src/Patch.java +++ b/src/Patch.java @@ -1,19 +1,20 @@ package edu.stuy.goldfish; public class Patch { - private int _pxcor, _pycor, _state; - private String _plabel; + private int _xcor, _ycor, _state; + private String _label; private Grid _myGrid; - public Patch(Grid grid, int xcor, int ycor, int state) { + public Patch(Grid grid, int xcor, int ycor, int state, String label) { _myGrid = grid; - _pxcor = xcor; - _pycor = ycor; + _xcor = xcor; + _ycor = ycor; _state = state; + _label = label; } public Patch() { - this(new Grid(), 0, 0, 0); + this(new Grid(), 0, 0, 0, ""); } public Grid getGrid() { @@ -21,11 +22,27 @@ public class Patch { } public int getX() { - return _pxcor; + return _xcor; } public int getY() { - return _pycor; + return _ycor; + } + + public int getState() { + return _state; + } + + public void setState(int state) { + _state = state; + } + + public String getLabel() { + return _label; + } + + public void setLabel(String label) { + _label = label; } public String toString() {