Skip to content

Commit

Permalink
盤面クラスの定義
Browse files Browse the repository at this point in the history
  • Loading branch information
hanasuke committed Nov 8, 2014
1 parent 3f8a541 commit 22e62dc
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Board.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
import java.util.Arrays;

public class Board {
private int xSize, ySize;
private int[][] state;

Board (int difficulty) {
ySize = 80;
if ( difficulty == 1 ) {
xSize = 80;
} else if ( difficulty == 2 ) {
xSize = 120;
} else {
xSize = 160;
}
state = new int[ySize][xSize];
Arrays.fill(state, 0);
System.out.println(Arrays.toString(state));
}

public int getState(Point point) {
if ( point.x < 0 || point.x > xSize ) {
return -1;
} else if ( point.y < 0 || point.y > ySize ) {
return -1;
} else {
return state[point.y][point.x];
}
}

}

0 comments on commit 22e62dc

Please sign in to comment.