Class Engine

java.lang.Object
io.github.colonelparrot.jchessify.Engine

public class Engine extends Object
jChessify core chess engine implementation
Version:
1.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    com.github.bhlangonijr.chesslib.move.Move
    getBestMove(com.github.bhlangonijr.chesslib.Board board)
    find the best move based on the side
    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

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 board
      side - the current side
      depth - the search depth
      alpha - the best evaluation found so far for the maximizing (white) side
      beta - the best evaluation found so far for the minimizing (black) side
      Returns:
      an evaluation of the board position, see comments for more technical details