소스 검색

Adding some methods because Josh.

master
Ben Kurtovic 11 년 전
부모
커밋
22d1af5b20
2개의 변경된 파일27개의 추가작업 그리고 6개의 파일을 삭제
  1. +10
    -2
      src/Grid.java
  2. +17
    -4
      src/Patch.java

+ 10
- 2
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;
}



+ 17
- 4
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() {


불러오는 중...
취소
저장