Procházet zdrojové kódy

Adding some methods because Josh.

master
Ben Kurtovic před 11 roky
rodič
revize
22d1af5b20
2 změnil soubory, kde provedl 27 přidání a 6 odebrání
  1. +10
    -2
      src/Grid.java
  2. +17
    -4
      src/Patch.java

+ 10
- 2
src/Grid.java Zobrazit soubor

@@ -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;
}



+ 17
- 4
src/Patch.java Zobrazit soubor

@@ -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() {


Načítá se…
Zrušit
Uložit