ReSpringRole is my chess bot using the MCTS Algorithm stockfish uses, using the chess library "Stockfish Winrate" uses.
  • C++ 99.2%
  • CMake 0.8%
Find a file
2025-05-28 22:59:52 +02:00
.idea minor additions 2025-05-19 13:04:29 +02:00
src minor additions 2025-05-19 13:04:29 +02:00
CMakeLists.txt minor additions 2025-05-19 13:04:29 +02:00
LICENSE Initial commit 2025-03-17 19:28:55 +01:00
README.md Updated README.md 2025-05-28 22:59:52 +02:00

ReSpringRole

A Monte Carlo Tree Search (MCTS) based chess engine written in C++. It supports both an interactive mode to play against the bot and a command-line interface for integration or testing. The bot currently achieves an Elo rating of 1640, improved from an initial 1410.

Features

  • MCTS-based move selection

  • Heuristic evaluation with customizable parameters

  • Interactive and CLI modes

  • UCI-style move input

  • Fast thinking with iteration-based control

Installation Instructions

  1. Download the .exe from releases
  2. Profit

Make sure to include any dependencies like chess.hpp in the third_party directory.

Usage

Interactive Mode (play against the bot) bash Kopieren Bearbeiten ./ReSpringRole [iterations] [w|b] [fen] Arguments:

iterations: Number of MCTS iterations (e.g., 100000)

w or b: Play as white or black

fen (optional): Start position in FEN notation

Example:

./ReSpringRole 100000 w

CLI Mode (get best move only)

./ReSpringRolet --cli [iterations] [w|b] fen Returns the best move in UCI format based on the given position.

Example:

./ReSpringRole --cli 50000 b "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1" Output:

e7e5

Evaluation Parameters

The engine uses a weighted evaluation function. You can tweak the parameters in main.cpp to experiment with bot strength and play style.

EvalParams params = { .MATERIAL_MULTIPLIER = 14.2, .KING_SAFETY_MULTIPLIER = 12.0, .CENTER_CONTROL_MULTIPLIER = 7.5, .MOBILITY_MULTIPLIER = 3.5, .PAWN_STRUCTURE_WEIGHT = 1.2, .PIECE_SQUARE_WEIGHT = 1.8, .CHECK_WEIGHT = 0.735, .BISHOP_PAIR_BONUS = 50.0, .TEMPO_BONUS = 5.0, .ENDGAME_THRESHOLD = 1200, .CHECKMATE_SCORE = 1e7 };

MCTS Details

The function getBestMove in engine.cpp performs MCTS with a fixed number of iterations (e.g., 100,000). A depth limit (e.g., 20 plies) is enforced, and simulations are scored using the heuristic evaluation defined above.

Performance

  • Old Elo: 1410

  • Current Elo: 1640

Improvements driven by parameter tuning and improved rollout strategies.