JSChess is a browser-based chess engine and GUI implemented in JavaScript. It features a playable chessboard, move generation, evaluation, and integration with Stockfish via WebAssembly. The project is designed for learning, experimentation, and playing chess directly in your web browser.
- Interactive chessboard with drag-and-drop piece movement
- FEN input/output for setting up and sharing positions
- Move generation, validation, and perft testing
- UCI engine support via Stockfish (WebAssembly)
- Visual board flipping and highlighting
- Opening book support (via
bookXml.xml) - Responsive UI with jQuery
bookXml.xml # Opening book in XML format
index.html # Main HTML file (UI and script includes)
perftsuite.epd # Perft test positions
README.md # Project documentation
script.cmd # Windows batch script for running/building
stockfish.wasm # Stockfish chess engine (WebAssembly)
styles.css # CSS styles for the UI
images/ # Chess piece and UI images
js/ # JavaScript source files
js/main.js: Application entry point and initializationjs/board.js: Board representation, FEN parsing, and printingjs/defs.js: Constants, enums, and utility functionsjs/gui.js: User interface logic and event handlersjs/movegen.js: Move generation logicjs/makemove.js: Move making and unmakingjs/evaluate.js: Position evaluationjs/search.js: Search algorithms and engine logicjs/stockfish.js: Stockfish engine integration
-
Clone or Download the Repository
git clone https://github.com/SpaciousFish/JSChess.git cd JSChess -
Open
index.htmlin your browserNo build step is required. All dependencies are included in the
js/folder. -
Play Chess!
- Use the board to make moves.
- Enter FEN strings to set up custom positions.
- Use the "Set Position" and "New Game" buttons for control.
- Chess engine logic inspired by Bluefever Software's Chess Programming.
- Stockfish engine (WASM) from official Stockfish project.
- jQuery for DOM manipulation.
This project is for educational and personal use. See individual file headers for more information.