46 lines
1.2 KiB
Java
46 lines
1.2 KiB
Java
package domain;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.Arrays;
|
|
|
|
public class GameBase implements Serializable {
|
|
protected int[][] board;
|
|
public boolean[][] blackCells;
|
|
public boolean[][] whiteCells;
|
|
public int mistakeCount;
|
|
|
|
public GameBase(int[][] initialBoard) {
|
|
this.board = new int[initialBoard.length][initialBoard[0].length];
|
|
for (int i = 0; i < initialBoard.length; i++) {
|
|
this.board[i] = Arrays.copyOf(initialBoard[i], initialBoard[i].length);
|
|
}
|
|
this.blackCells = new boolean[board.length][board[0].length];
|
|
this.whiteCells = new boolean[board.length][board[0].length];
|
|
this.mistakeCount = 0;
|
|
}
|
|
|
|
public void reset() {
|
|
blackCells = new boolean[board.length][board[0].length];
|
|
whiteCells = new boolean[board.length][board[0].length];
|
|
}
|
|
|
|
public int[][] getBoard() {
|
|
return board;
|
|
}
|
|
|
|
public int[][] getCurrentState() {
|
|
return board;
|
|
}
|
|
|
|
public boolean[][] getBlackCells() {
|
|
return blackCells;
|
|
}
|
|
|
|
public boolean[][] getWhiteCells() {
|
|
return whiteCells;
|
|
}
|
|
|
|
public int getMistakeCount() {
|
|
return mistakeCount;
|
|
}
|
|
} |