Skip to main content

Applechess

Applechess is a simple chess engine, written using the minimax and alpha-beta pruning algorithms along with a handcrafted heuristics function.

See more information about the two algorithms on the Wikipedia pages: minimax and alpha-beta pruning.

The easiest way to play the engine is to play the bot on Lichess by sending it a challenge request (variants and ultrabullet are not yet supported). The engine may run slow if too many people are playing it. If the bot is offline, you can run it locally.

Running Applechess Locally

In order to run the engine locally, first install Python from python.org or your package manager. Python 3.10+ is required.

Then, clone and install the requirements. You can optionally create a virtual environment before installing the packages.

git clone https://github.com/appleplectic/applechess.git
cd applechess
python -m pip install -r requirements.txt

To use the ChessAgent class:

from applechess.chess_agent import ChessAgent

agent = ChessAgent()
agent.interactive_terminal()

Check the documentation for usage details. Note that the API is not stable, and will change frequently.

Running the Lichess bot locally

Follow the same instructions above to clone and install dependencies.

Next, create a Lichess bot account by first registering on lichess.org and then obtaining a personal access token under settings.

Upgrade the account to a bot account by running the following command (an account with any games on it cannot become a bot account):

curl -d '' https://lichess.org/api/bot/account/upgrade -H "Authorization: Bearer <yourTokenHere>"

Finally, create a .env file in either the root directory or the applechess/ directory with the following contents:

LICHESS_API_KEY=<yourTokenHere>

The bot should be ready to run:

cd applechess
python lichess_bot.py

Building the Documentation

First, follow the previous instructions to download the dependencies.

Then, build the docs:

sphinx-build -M html docs/source/ docs/build/

The built docs should then be available in docs/build/html/.

Licensing and Contributing

Contributions are encouraged - create a pull request or issue!

See the LICENSE file for licensing information. All contributions will be under the same license.

Metadata

Release files for applechess 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for applechess 0.1
File Size Uploaded
applechess-0.1.tar.gz 22.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for applechess 0.1
File Interpreter ABI Platform
applechess-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 44.1 kB

Release files / applechess-0.1.tar.gz

Download URL applechess-0.1.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
655878d4ed757cf94920aba1b4edfa97973de131720d293b94fbd7be553a4972
BLAKE2b-256 checksum
How to use checksums
8f9a9e389ceb753456079529858eed1cc7daf7af5fffeeeeba779a29f7892a97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

Release files / applechess-0.1-py3-none-any.whl

Download URL applechess-0.1-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76d6a7d3eb1c30fd1ff132e41195b1957feae25319b3cf67aa58e8c9fbdf207f
BLAKE2b-256 checksum
How to use checksums
a280f9f11a5f94f88024b1d3fd3a615e5eb89873cc4ebde72d8ed558b0f6876a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page