true;
else if (s + n + 1 >= 5)
return true;
else if (ne + sw + 1 >= 5)
return true;
else if (nw + se + 1 >= 5)
return true;
else
return false;
}
public int getCountDirection(int row, int col, int color,
DIRECTION direction) {
int nCount = 0;
Model model = Model.getInstance();
for (int n = 1; n <= 4; n++) {
int currentRow = getNextRow(row, direction, n);
int currentCol = getNextCol(col, direction, n);
if (currentRow < 0 || currentCol < 0)
break;
if (model.getChessAt(currentRow, currentCol) == color)
nCount++;
else
break;
}
return nCount;
}
private int getNextRow(int row, DIRECTION direction, int step) {
int nextRow;
switch (direction) {
case SOUTH:
case SOUTH_EAST:
case SOUTH_WEST:
nextRow = row + step;
break;
case NORTH:
case NORTH_EAST:
case NORTH_WEST:
nextRow = row - step;
break;
default:
nextRow = row;
b
上一篇:
统计学:应用领域的奇葩
下一篇:
猪疥癣病的防治