Class Engine
java.lang.Object
io.github.colonelparrot.jchessify.Engine
jChessify core chess engine implementation
- Version:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptioncom.github.bhlangonijr.chesslib.move.MovegetBestMove(com.github.bhlangonijr.chesslib.Board board) find the best move based on the sideintminimax(com.github.bhlangonijr.chesslib.Board board, com.github.bhlangonijr.chesslib.Side side, int depth, int alpha, int beta) Alpha-beta pruning recursive minimax algorithm
Calculates the best move to play
MINIMAX works by going down a move tree
each side must play the best move for themselves
we simply find the move that, assuming both sides play their best, yields the best outcome
Alpha-beta pruning is used to eliminate moves from the movement tree which we know don't need to be searched
-
Method Details
-
getBestMove
public com.github.bhlangonijr.chesslib.move.Move getBestMove(com.github.bhlangonijr.chesslib.Board board) find the best move based on the side- Parameters:
board- the chess board- Returns:
- a Move object with the best move
-
minimax
public int minimax(com.github.bhlangonijr.chesslib.Board board, com.github.bhlangonijr.chesslib.Side side, int depth, int alpha, int beta) Alpha-beta pruning recursive minimax algorithm
Calculates the best move to play
MINIMAX works by going down a move tree
each side must play the best move for themselves
we simply find the move that, assuming both sides play their best, yields the best outcome
Alpha-beta pruning is used to eliminate moves from the movement tree which we know don't need to be searched- Parameters:
board- the chess boardside- the current sidedepth- the search depthalpha- the best evaluation found so far for the maximizing (white) sidebeta- the best evaluation found so far for the minimizing (black) side- Returns:
- an evaluation of the board position, see comments for more technical details
-