A modern TypeScript chess engine that demonstrates high-quality evaluation, efficient search (alpha-beta pruning), and parallel move exploration using worker threads. Ideal for learning, experimentation, and integration into web UIs or bots.
- Blazing Search: Minimax with alpha-beta pruning and parallel search.
- Tunable Evaluation: Piece-square tables, material, king safety, and tuned heuristic weights (see
tuned_values.csv). - Frontend-ready: Integrates with a React/Vite frontend included in this repo.
- Educational: Clear code structure in
backend/srcfor stepping through core algorithms.
- Clone the repo
git clone https://github.com/priyanshupatel/chess-engine.git
cd chess-engine- Install backend dependencies and run dev server
cd backend
npm install
npm run dev- Start the frontend
cd ../frontend
npm install
npm run devOpen the app in your browser (Vite usually runs at http://localhost:5173).
backend/— Engine logic, search, evaluation, and worker threads.frontend/— React + Vite UI to play and visualize engine decisions.tuned_values.csv— Tunable parameters used by the evaluation function.
From the backend you can call endpoints to evaluate or search a position:
POST /api/evaluate → returns evaluation score and features
POST /api/search → returns best move with principal variation
See backend/src for implementation details: evaluate.ts, minimax.ts, and searchBestMoveParallel.ts.
See the chess engine in action:
https://github.com/user-attachments/assets/edited.mov
- Run unit tests (if present) and linting from each package.
- Explore
backend/src/worker.tsfor parallel search orchestration.
Contributions welcome — open issues or PRs. Follow the standard GitHub flow and include tests for new features.
MIT — see LICENSE file.






