final short row = movement.getRow();
final short column = movement.getColumn();
- //Precondition 1.
+ //Precondition:
if (row <= 1) {
return false;
}
- //Precondition 2.
- if (gameBoard[column][row-1].getPlayer() == player ||
- empty(gameBoard, column, (short)(row-1))) {
- return false;
- }
-
final List<FlippedDisc> flippedDiscs = outflank((short)0, (short)-1, gameBoard,
player, (short)(row-1), column);
if (flippedDiscs.isEmpty()) {
final short row = movement.getRow();
final short column = movement.getColumn();
- //Precondition 1:
+ //Precondition:
if (row >= ReversiView.NUMBER_OF_ROWS -2) {
return false;
}
- //Precondition 2.
- if (gameBoard[column][row+1].getPlayer() == player ||
- empty(gameBoard, column, (short)(row+1))) {
- return false;
- }
-
final List<FlippedDisc> flippedDiscs = outflank((short)0, (short)1, gameBoard,
player, (short)(row+1), column);
if (flippedDiscs.isEmpty()) {
final short row = movement.getRow();
final short column = movement.getColumn();
- //Precondition 1:
+ //Precondition:
if (column >= ReversiView.NUMBER_OF_COLUMNS -2) {
return false;
}
- //Precondition 2.
- if (gameBoard[column+1][row].getPlayer() == player ||
- empty(gameBoard, (short)(column+1), row)) {
- return false;
- }
-
final List<FlippedDisc> flippedDiscs = outflank((short)1, (short)0, gameBoard,
player, row, (short)(column+1));
if (flippedDiscs.isEmpty()) {
final short row = movement.getRow();
final short column = movement.getColumn();
- //Precondition 1:
+ //Precondition:
if (column <= 1) {
return false;
}
- //Precondition 2.
- if (gameBoard[column-1][row].getPlayer() == player ||
- empty(gameBoard, (short)(column-1), row)) {
- return false;
- }
-
final List<FlippedDisc> flippedDiscs = outflank((short)-1, (short)0, gameBoard,
player, row, (short)(column-1));
if (flippedDiscs.isEmpty()) {
final short row = movement.getRow();
final short column = movement.getColumn();
- //Precondition 1:
+ //Precondition:
if (column <= 1 || row <= 1) {
return false;
}
- //Precondition 2.
- if (gameBoard[column-1][row-1].getPlayer() == player ||
- empty(gameBoard, (short)(column-1), (short)(row-1))) {
- return false;
- }
-
final List<FlippedDisc> flippedDiscs = outflank((short)-1, (short)-1, gameBoard,
player, (short)(row-1), (short)(column-1));
if (flippedDiscs.isEmpty()) {
final short row = movement.getRow();
final short column = movement.getColumn();
- //Precondition 1:
+ //Precondition:
if (column >= (ReversiView.NUMBER_OF_COLUMNS -2) || row >= (ReversiView.NUMBER_OF_ROWS -2)) {
return false;
}
- //Precondition 2.
- if (gameBoard[column+1][row+1].getPlayer() == player ||
- empty(gameBoard, (short)(column+1), (short)(row+1))) {
- return false;
- }
-
final List<FlippedDisc> flippedDiscs = outflank((short)1, (short)1, gameBoard,
player, (short)(row+1), (short)(column+1));
if (flippedDiscs.isEmpty()) {
final short row = movement.getRow();
final short column = movement.getColumn();
- //Precondition 1:
+ //Precondition:
if (column <= 1 || row >= (ReversiView.NUMBER_OF_ROWS -2)) {
return false;
}
- //Precondition 2.
- if (gameBoard[column-1][row+1].getPlayer() == player ||
- empty(gameBoard, (short)(column-1), (short)(row+1))) {
- return false;
- }
-
final List<FlippedDisc> flippedDiscs = outflank((short)-1, (short)1, gameBoard, player,
(short)(row+1), (short)(column-1));
if (flippedDiscs.isEmpty()) {
final short row = movement.getRow();
final short column = movement.getColumn();
- //Precondition 1:
+ //Precondition:
if (row <= 1 || column >= (ReversiView.NUMBER_OF_COLUMNS -2)) {
return false;
}
- //Precondition 2.
- if (gameBoard[column+1][row-1].getPlayer() == player ||
- empty(gameBoard, (short)(column+1), (short)(row-1))) {
- return false;
- }
-
final List<FlippedDisc> flippedDiscs = outflank((short)1, (short)-1, gameBoard, player,
(short)(row-1), (short)(column+1));
if (flippedDiscs.isEmpty()) {
while (row > 0 && column > 0 &&
row < ReversiView.NUMBER_OF_ROWS && column < ReversiView.NUMBER_OF_COLUMNS &&
- gameBoard[column][row].getPlayer() != Player.NOPLAYER) {
+ !empty(gameBoard, column, row)) {
if (gameBoard[column][row].getPlayer() == player) {
match = true;