You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
791 B
27 lines
791 B
|
|
// We are making this an *immutable* class. The state that an object has when constructed is its state permanently.
|
|
// Instead of making changes to objects we create new ones (with attemptMove() and the constructor).
|
|
|
|
public class GameState {
|
|
Square[] boardSquares; //Tracks the game board as a 1D array of Square objects (effectively 12 x 12) with 2 layers of sentinel squares all around.
|
|
boolean isWhitesTurn; //Knows whose turn it is
|
|
|
|
public GameState() {
|
|
//Set turn to white
|
|
//Initialize squares with legal starting position.
|
|
}
|
|
|
|
public GameState attemptMove(Move m) {
|
|
//See if it is legal.
|
|
//Change the board state accordingly.
|
|
}
|
|
|
|
public Moves[] getAllPossibleMoves() {
|
|
}
|
|
|
|
// returns something like "checkmate", "stalemate", etc.
|
|
public String getFeedback() {
|
|
}
|
|
|
|
}
|