Page 885 - 2
P. 885
나. Eclipse 에서 승리확인을 위한 프로그램 소스
package omoke;
public class Map{
private short[][] map;// 맵의 배열 1 일 때 흑, -1 일 때 백, 0 일 때 돌이 놓이지 않음.
private final short BLACK = 1;
private final short WHITE = -1;
boolean checkBNW = true;// 흑백차례확인
private int count = 0;
private int size = 0;
private MapSize ms;
public Map(MapSize ms) {
this.ms = ms;
size = ms.getSize();
size = size * size;
map = new short[size][];
for (int i = 0; i < map.length; i++) {
map[i] = new short[ms.getSize()];
}
}
public void resetMap(){
map = new short[size][];
for (int i = 0; i < map.length; i++) {
map[i] = new short[ms.getSize()];
}
count = 0;
checkBNW = true;
}
public int getCount()
{
return count;
}
public int getSize()
{
return size;
}
public short getBlack() {
return BLACK;
}
- 885 -