| Function |
Input |
Output |
Description |
| alphabeta |
depth, alpha, beta |
score |
Recursive algorithm to span the move tree. parses
the tree and returns the score of the best move. Uses evaluate(),
generateMoves(), movesLeft(), makeNextMove() and unmakeMove().
|
| evaluate |
board |
score |
Adds up total material value of a given board and returns a score. |
| generateMoves |
board |
N/A |
Scans the board and pushes all generated moves for one player
from a given board onto the move stack. Uses isLegal() and push(). |
| movesLeft |
N/A |
boolean |
Returns true if stack is not empty. |
| makeMove |
move, board |
board |
Applies a move to the board and saves info about the board to
unmake moves. Uses pop(), attack() and inCheck(). |
| unmakeMove |
move, board |
board |
Unapplies a move done to a board. |
| isLegal |
move, board |
boolean |
Returns true if move is legal. |
| push |
move |
N/A |
Pushes a move onto the stack. |
| pop |
N/A |
move |
Pops a move off of the stack. |
| attack |
square, side |
boolean |
Returns true if opposite side is attacking given square. |
| inCheck |
side |
boolean |
Returns true if king is in check. |