Skip to main content

A simple alpha-beta chess engine with a Lichess bot interface.

Project description

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.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

applechess-0.1.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

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

applechess-0.1-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file applechess-0.1.tar.gz.

File metadata

  • Download URL: applechess-0.1.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for applechess-0.1.tar.gz
Algorithm Hash digest
SHA256 655878d4ed757cf94920aba1b4edfa97973de131720d293b94fbd7be553a4972
MD5 62de2873b86cdef6833c71496bedb659
BLAKE2b-256 8f9a9e389ceb753456079529858eed1cc7daf7af5fffeeeeba779a29f7892a97

See more details on using hashes here.

File details

Details for the file applechess-0.1-py3-none-any.whl.

File metadata

  • Download URL: applechess-0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for applechess-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 76d6a7d3eb1c30fd1ff132e41195b1957feae25319b3cf67aa58e8c9fbdf207f
MD5 6dabbcb0c387a1ee20536a27336afade
BLAKE2b-256 a280f9f11a5f94f88024b1d3fd3a615e5eb89873cc4ebde72d8ed558b0f6876a

See more details on using hashes here.

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