Class BotPlayer

java.lang.Object
javachess.player.BotPlayer
All Implemented Interfaces:
Player

public class BotPlayer extends Object implements Player
  • Constructor Details

    • BotPlayer

      public BotPlayer(Game game, PieceColor color, int depth)
      Constructor for BotPlayer.
      Parameters:
      game - The game instance.
      color - The color of the player.
  • Method Details

    • getBestMove

      public String getBestMove(String fen, int depth) throws Exception
      Fetches the best move from Stockfish API.
      Parameters:
      fen - The FEN string to analyze.
      depth - The depth for engine to go to (must be less than 16).
      Returns:
      The best move as a String, or null if not found.
      Throws:
      Exception - in case of an HTTP or parsing error.
    • testConnection

      public static boolean testConnection()
    • main

      public static void main(String[] args)
    • getColor

      public PieceColor getColor()
      Description copied from interface: Player
      Returns the color of the player.
      Specified by:
      getColor in interface Player
      Returns:
      the color of the player
    • getMove

      public Move getMove()
      Specified by:
      getMove in interface Player
    • getPromoteTo

      public Piece getPromoteTo(Cell pawnCell)