A highly-optimized, custom C++23 bitboard chess engine paired with a modern, real-time web analysis platform built in Next.js and Node.js.
Live Demo: https://bitboard.ksohail.space/
|
|
|
| Fair Play Mode | Training Mode | Analysis Mode |
Bitboard is a comprehensive, full-stack chess engineering project. Rather than using an off-the-shelf engine like Stockfish, this project implements a custom UCI-compliant chess engine from scratch in C++23. The engine is connected to an elegant "engine room" web dashboard, allowing players to challenge the bot or deeply analyze specific positions using real-time WebSockets streaming.
- Three distinct modes:
- Fair Play: Play against the engine under standard time controls with no assistance.
- Training: Play with live engine evaluation, depth, and principal variation (PV) overlays.
- Analysis: Setup arbitrary FENs or import PGNs for continuous, unrestricted engine analysis.
- Custom C++23 Engine: Blazing fast bitboard representations and Negamax search framework.
- Real-Time Streaming: Live telemetry of Nodes, Nodes Per Second (NPS), Depth, and Eval over WebSockets.
- UCI Protocol Bridge: A scalable Node.js session manager gracefully multiplexes isolated engine processes for browser clients.
- Dynamic FEN / PGN Handling: Copy, paste, and load complex game states on the fly.
- Engine: C++23, standard library (no external dependencies)
- Frontend: Next.js, React, TypeScript, Tailwind CSS, Recharts
- Backend Bridge: Node.js, WebSockets (
ws),child_process - Deployment: Docker, Docker Compose, Nginx
The platform uses a decoupled three-tier architecture:
- Next.js Frontend: Manages the board state (
chess.js), user interface, and WebSocket connectivity. - Node.js Session Manager: Spawns and manages isolated C++ UCI processes per connection, translating JSON websocket messages into standard UCI standard input/output.
- C++ Chess Engine: Processes positions and streams iterative deepening evaluations.
For a deep-dive into the technical implementation, please read the Architecture Documentation.
The custom chess AI was built for performance and accuracy:
- Bitboards: Core state is modeled using 64-bit integers and bitwise operations for efficient piece attack generation and board queries.
- Search Pipeline: Alpha-beta pruned Negamax search integrated with Iterative Deepening.
- Transposition Tables: Zobrist hashing caches visited node evaluations to prevent redundant tree traversal.
- Move Ordering: MVV-LVA, Killer Move heuristics, and History tables drastically improve alpha-beta cutoff rates.
- Quiescence Search: Extended horizon search to resolve noisy tactical captures.
- Evaluation: Hand-Crafted Evaluation (HCE) optimized via Texel Tuning.
The engine includes a compact opening-book binary at engine/openings/performance.bin, which is required for opening-book support. Larger/generated books are intentionally excluded from the repository.
The UI is built with a dark, technical "engine room" aesthetic. It utilizes React state to smoothly display asynchronous multi-variation payloads streaming from the engine in real-time.
- Node.js (v18+)
- Make & GCC/Clang (for compiling C++23)
- Compile the engine:
cd engine make all - Install frontend/backend dependencies:
cd ../website npm install - Start the development stack (Next.js + WebSocket Server):
npm run dev:all
- Access the application at
http://localhost:3000.
The project provides a production-ready containerized pipeline.
- Create a
.envfile in the./deploy/directory (refer todocker-compose.ymlfor required variables). - Build and spin up the stack:
docker compose -f deploy/docker-compose.yml up -d --build
.
├── engine/ # C++23 Engine Source Code
│ ├── src/ # Core headers and cpp implementations
│ └── Makefile # Compilation script
├── website/ # Full-Stack Web Platform
│ ├── src/app/ # Next.js Pages & Layouts
│ ├── src/components/ # React UI Components
│ ├── src/hooks/ # Custom React Hooks (e.g. useEngine)
│ ├── src/lib/ # Node.js backend logic (WebSocket, UCI bridge)
│ └── server.ts # Custom Node/Next bootstrapper
├── docs/ # Architecture and media assets
└── deploy/ # Dockerfiles and CI/CD bash scripts
- Implement WASM compilation for client-side engine execution.
- Add an NNUE (Efficiently Updatable Neural Network) evaluation pipeline.
- Expand endgame tablebase support.


