Skip to content

georgeck/chess-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chess App

Simple chess game that you can run locally that uses STOCKFISH engine and use LLMs for game analysis.

Setup

  1. Download the STOCKFISH engine from stockfishchess.org and place it in the same directory as the server.js file.
  2. If you have the binary file in a different directory, update the path in the .env file.

Running the App

To run the app, execute the following commands:

pnpm install
pnpm start

Libraries used:

  • chess.js -> JavaScript library for chess move validation and check/checkmate/draw detection
  • chessboard-js -> JavaScript chessboard
  • stockfish engine -> UCI chess engine; Engine is run locally as a child process
  • express -> Web framework for Node.js
  • socket.io -> Real-time bidirectional event-based communication
  • ollama -> host quantized LLM models locally
  • Open WebUI -> Web-based user interface for LLM

Features:

  • Play against the computer
  • Analysis board with LLM running locally using ollama and Open WebUI.

How it works:

The client renders the chess board using chessboardjs. Each move is validated using chess.js. The client sends the move to the server (using socket.io), which then sends the move to the STOCKFISH engine. The engine calculates the best move and sends it back to the client (again using socket.io). The client renders the move on the board.

The state of the board is maintained both on the server and the client using chess.js.

For game analysis, the current position is extracted from the client in the PGN format and sent to the server. The server then sends the position to the LLM model running locally using ollama.

About

Play chess with Stockfish engine.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published