diff --git a/src/Grid.java b/src/Grid.java index 1fd1052..8943dd1 100644 --- a/src/Grid.java +++ b/src/Grid.java @@ -18,11 +18,19 @@ public class Grid { } } - public Patch getPatch (int x, int y) { + public int getWidth() { + return _grid.length; + } + + public int getHeight() { + return _grid[0].length; + } + + public Patch getPatch(int x, int y) { return _grid[x][y]; } - public void setPatch (int x, int y, Patch p) { + public void setPatch(int x, int y, Patch p) { _grid[x][y] = p; } diff --git a/src/Patch.java b/src/Patch.java index 264220f..b2faf4c 100644 --- a/src/Patch.java +++ b/src/Patch.java @@ -1,18 +1,31 @@ package edu.stuy.goldfish; public class Patch { - private int _pxcor, _pycor; + private int _pxcor, _pycor, _state; private String _plabel; private Grid _myGrid; - public Patch(Grid grid, int xcor, int ycor) { + public Patch(Grid grid, int xcor, int ycor, int state) { _myGrid = grid; _pxcor = xcor; _pycor = ycor; + _state = state; } - public Patch () { - this(new Grid(), 0, 0); + public Patch() { + this(new Grid(), 0, 0, 0); + } + + public Grid getGrid() { + return _grid; + } + + public int getX() { + return _pxcor; + } + + public int getY() { + return _pycor; } public String toString() {