A C# chess engine built with bitboards and accessible via a REST API.
Try it: Chess Bot
- Bitboard Board Representation
- Magic Bitboards
- Legal Move Generation
- *Opening Book
- Repetition Detection
- Alpha-Beta Pruning
- Transposition Tables
- Move Ordering
- PVS
- Mate Search
- Asperation Windows
- Null Move Search
- Itterative deeping
- Quiescence Search
- Material Evaluation
- Piece-Square Tables
- Pawn Structure
Based on current implementation, I estimate the bot to play at approximately 1600-1900 Elo. This is an informal estimate.
- .NET 10.0 SDK or later
-
Clone the repository:
git clone https://github.com/RJDonnison/ChessBot.git cd ChessBot -
Run the API server:
dotnet run --project ChessBot.Api
The API will start on
http://localhost:5000
To test without building a custom UI, you can use the provided Chess Bot Interface.
Returns the best move for a given position.
Parameters:
fen(required) - The board position in FEN notation
Example:
curl "http://localhost:5000/bestmove?fen=rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR%20w%20KQkq%20-%200%201"Response:
{
"bestmove": "e2e4"
}// Import the ChessBot.Core library
using ChessBot.Core;
var bot = new Bot();
string fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
string bestMove = bot.GetBestMove(fen);
Console.WriteLine($"Best move: {bestMove}");- ChessBot.Core - Core engine logic
- ChessBot.Api - ASP.NET API wrapper
- ChessBot.Core.Tests - Unit tests for Perft move generation tests
- WebAssembly (WASM) - Browser-native engine compilation
- Multi-threading - Parallel search implementation
- ML evaluation - Neural network-based position evaluation
- History heuristic - Move ordering improvement using historical data
- King safety evaluation - Enhanced king attack detection and safety scoring
- Lazy evaluation - Deferred evaluation for performance
See LICENSE for details.