Skip to main content

PyAlapin, your customized chess engine

Is it the best, most efficient and state of the art chess engine ? I'm pretty sure not.

However, driven by passion and madness, I have developed my own chess game in Python. For your pretty eyes and your devilish smile, I share it with you. But only with you.

Special thanks and dedication to LeMerluche, crushing its opponents on chess.com with alapin openings ❤️

How to install

Simply use:

pip install pyalapin

You only need numpy to play with with terminal interface and with Python. You will need kivy to play with the interface.

How to play with interface

from pyalapin.interface import ChessApp

if __name__ == '__main__':
    ChessApp(
        play_with_ai=False # Set to True if you want to play agains AI
    ).run()

You can play against Stockfish by installing the official Python interface.

from pyalapin.player.player import Player
from pyalapin.player.stockfish_player import StockfishPlayer
from pyalapin.interface import ChessApp

sfp = StockfishPlayer(path_to_stockfish_engine, white_side=False)
app = ChessApp(w_player=Player(True), b_player=sfp, play_with_ai=True)
app.run()

How to play with Python commands

from pyalapin.engine import ChessGame

game = ChessGame(
    automatic_draw=True, # Set to True if you want
                         # to have each turn drawn in terminal
    ai=False, # set to True if you want to play agains AI
    save_pgn=False # set to True if you want to
                   # save moves as PGN
)
game.move_from_coordinates(game.player1, 1, 4, 3, 4)
game.move_from_coordinates(game.player2, 6, 4, 4, 4)
game.move_from_coordinates(game.player1, 0, 5, 3, 2)
game.move_from_coordinates(game.player2, 6, 3, 5, 4)
game.move_from_coordinates(game.player1, 0, 3, 2, 5)
game.move_from_coordinates(game.player2, 6, 2, 4, 2)
game.move_from_coordinates(game.player2, 2, 5, 6, 5)

There are colors in the command line not showing here in the GIF, though...

How to change interface colors

With line command you can create new illustrations by specifying the RGB colors you want. You can specify the colors of the cells and of the pieces (outer and inner colors). Use the following command with the colors you want:

python interface/colorize.py -ccb 0 191 255 -ccw 207 185 151 -ibp 109 7 26 -obp 0 0 0 -iwp 200 200 200 -owp 255 255 255

Arguments are:

  • -ccb/--color_cell_black: RGB, default 0, 191, 255
  • -ccw/--color_cell_white: RGB, default 207, 185, 151
  • -ibp/--inner_black_piece: RGB, default 109, 7, 26
  • -obp/--outer_black_piece: RGB, default 0, 0, 0
  • -iwp/--inner_white_piece: RGB, default 200, 200, 200
  • -owp/--outer_white_piece: RGB, default 255, 255, 255

The command creates (or replaces) the illustrations that are in the temp_images/ folder. If the folder exists, the interface uses theses illustrations. Destroy it to come back to standard illustrations.

Metadata

Release files for pyalapin 1.0.0

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

Source distribution (sdist)

Source distribution for pyalapin 1.0.0
File Size Uploaded Provenance Actions
pyalapin-1.0.0.tar.gz 1.0 MB Without provenance Details for pyalapin-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.1 MB

Release files / pyalapin-1.0.0.tar.gz

Download URL pyalapin-1.0.0.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
8ae7e1855d19864f436507250fd94876bd41d467c750d00076c83dcafc33fd2e
BLAKE2b-256 checksum
How to use checksums
906f2026722b59b315d819230ed454d33b4ac9ce3f59307923cad31830250b56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / pyalapin-1.0.0-py3-none-any.whl

Download URL pyalapin-1.0.0-py3-none-any.whl
Size 36.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1c733df2b1df6e2f664dd5de81109e57280e34d3e72fb9e43f5e9f02c0d677a
BLAKE2b-256 checksum
How to use checksums
045f23be1a38d62a9250d2992a41f1891303ddd034002a2aa42839257302140c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Security for pyalapin 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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