- C++ 99.2%
- CMake 0.8%
| .idea | ||
| src | ||
| CMakeLists.txt | ||
| LICENSE | ||
| README.md | ||
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
- Download the .exe from releases
- 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.