Skip to main content

Play international chess against AI opponents powered by local LLMs

Project description

LLM Chess

Play international chess against AI opponents powered by local large language models (LLMs).

Features

  • Interactive chess board with move highlighting and last-move indicators
  • Pawn promotion dialog
  • Undo moves support
  • FEN display and SAN move history
  • Dark theme Catppuccin-style UI
  • Game status detection (checkmate, stalemate, draw, etc.)

Supported LLM Backends

Connects to any OpenAI-compatible API endpoint:

Backend Default URL Notes
Ollama http://localhost:11434 ollama serve
llama.cpp Server http://localhost:8080 ./llama-server -m model.gguf --port 8080
LM Studio http://localhost:1234 Enable "Local Server" in Developer tab
Custom Any URL Configure in Settings

Installation

From DEB package (Ubuntu/Debian)

sudo dpkg -i llmchess_1.0.0_all.deb
llmchess

From source

# Install dependencies
pip install PyQt6 python-chess httpx

# Run
python3 main.py

Build DEB package

bash build_deb.sh
sudo dpkg -i llmchess_1.0.0_all.deb

Usage

  1. Start your LLM server (Ollama, llama.cpp, or LM Studio)
  2. Launch LLM Chess (llmchess or from application menu)
  3. Click Settings to configure your LLM connection
  4. Select White (you move first) or Black (AI moves first)
  5. Click a piece, then click the destination square to move

Settings

  • Provider: Select your backend (Ollama, llama.cpp, LM Studio, or Custom)
  • Base URL: API endpoint (auto-filled for presets)
  • Model: Model name to use
  • Temperature: Lower = more deterministic moves (default 0.3)
  • Max Tokens: Maximum response length (default 512)
  • Test Connection: Verify connectivity before playing

Project Structure

LLMChess/
├── main.py                    # Application entry point
├── requirements.txt           # Python dependencies
├── build_deb.sh              # DEB package build script
├── chess_app/
│   ├── board_widget.py       # Chess board UI (PyQt6)
│   ├── llm_connector.py      # LLM API connector
│   ├── game_controller.py    # Main window & game controller
│   └── settings_dialog.py    # LLM connection settings
└── deb_pkg/                  # DEB packaging files

How It Works

  1. Each turn, the current board state is sent to the LLM as a FEN string plus a list of legal moves in UCI format
  2. The LLM is prompted to respond with only one UCI move (e.g., e2e4, g1f3)
  3. The response is parsed to extract the UCI move and validated against legal moves
  4. If the LLM returns an invalid or empty response, the first legal move is used as fallback

Requirements

  • Python 3.9+
  • PyQt6
  • python-chess
  • httpx
  • A running LLM server (Ollama, llama.cpp, or LM Studio)

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llmchess-1.0.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llmchess-1.0.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file llmchess-1.0.1.tar.gz.

File metadata

  • Download URL: llmchess-1.0.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llmchess-1.0.1.tar.gz
Algorithm Hash digest
SHA256 63ffe518b37bd67e574cafb34bd0b7f9364b7befdc1a5608dc8d522fb51cd0bc
MD5 2bf4f420645ae7b63a2db3118fcd5190
BLAKE2b-256 47ca1a62b997c01c826726750700d60159030d80006ccacba0e4064fcedbaef7

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmchess-1.0.1.tar.gz:

Publisher: publish.yml on oemoem12/LLMChess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llmchess-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: llmchess-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llmchess-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ddeb634ad95269f2ab8495325d225a740f44b9d26e7ce5b3379f5b76af991f77
MD5 b2991458d836a267747ef8355d04f436
BLAKE2b-256 dd4d95dfb0967dc6f73850064a9b2b4ec5adebd8f9f8a01328f02182a9af477c

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmchess-1.0.1-py3-none-any.whl:

Publisher: publish.yml on oemoem12/LLMChess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page