main
Michael Kowalczyk 11 months ago
parent 88a5ded3f6
commit 5dcff17a02

@ -0,0 +1,30 @@
//Main class and GUI
public class Chess {
private GameBoard board;
//Remembers the initial click square for the user's move
//Stack of GameBoard states for the move undo.
//Stack of tuples (moves) so they can be displayed.
public void start() {
//Set up the initial board
}
//Reset to the intial game position.
public void reset() {
}
//AI makes a move
public void moveAI() {
}
//For the human moving
public void mouseClick() {
}
//Undo button for the most recent move
public void undo() {
}
}

@ -0,0 +1,26 @@
public class GameState {
//Tracks the game board as a 1D array of Square objects (effectively 12 x 12) with 2 layers of sentinel squares all around.
//Knows whose turn it is
public GameState() {
reset();
}
public void reset() {
}
public void attemptMove(int sourceX, int sourceY, int destX, int destY) {
//See if it is legal.
//Change the board state accordingly.
}
public Moves[] getAllPossibleMoves() {
}
// returns something like "checkmate", "stalemate", etc.
public String getFeedback() {
}
}

@ -0,0 +1,13 @@
public class Move {
//source and dest coordinates
//boolean check or not
//boolean capture or not
//boolean checkmate or not
//returns something like e2-e4 or Qc8++
public String toString() {
}
}

@ -0,0 +1,12 @@
public class Square {
//Pawn, knight, bishop, rook, queen, king, blank.
//White or black boolean
//en passant boolean flag (for the square that would be "captured")
//boolean Knowledge of whether or not this piece moved yet (for castling)
//boolean for off-the-board square
//Positive values for white, negative for black, blank square is 0.
public int getValue() {
}
}

@ -5,16 +5,18 @@ Possible classes:
Show the list of moves that are performed so far Show the list of moves that are performed so far
Show the captured pieces Show the captured pieces
Show highlighting for the most recent move Show highlighting for the most recent move
GameBoard Symbol for display?
GameState
Direct storage of piece data in a 2D array (speed of computation) Direct storage of piece data in a 2D array (speed of computation)
Knowledge of whether or not castling, en passant are available Know whose turn it is
Be able to set up the starting positions Be able to set up the starting positions
Perform the move (remove piece if a capture, promote to queen if get to the end) Be able to perform the move (remove piece if a capture, promote to queen if get to the end)
Piece (subclasses?) Square
Symbol What pieces (if any) occupies it
Position (else captured) Knowledge of whether or not castling, en passant are available
Player Move
Enacts moves on the GameBoard Represents a source and destination square
Knows whether or not it was a capture, check, etc.
Where are the rules going to be programmed in? Where are the rules going to be programmed in?
A piece has to be aware of other stuff going on around it in order to calculate if a move is legal or not. A piece has to be aware of other stuff going on around it in order to calculate if a move is legal or not.

@ -4,7 +4,9 @@ This simple application allows the user to play chess. Moves can be made by hum
GUI GUI
=== ===
The GUI shows a 2D grid of colored chess squares and whichever pieces are in play (it starts with a new game, ready to play). The GUI shows a 2D chess board and whichever pieces are in play (it starts with a new game, ready to play).
Last move and currently selected square are highlighted in different colors.
List of all moves made so far in the game are listed on the side.
Text feedback is given for the game state (who's turn it is, and if it is checkmate or stalemate). Text feedback is given for the game state (who's turn it is, and if it is checkmate or stalemate).

Loading…
Cancel
Save