Custom chess engine built specifically to develop AIs
Project description
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.
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
Built Distribution
File details
Details for the file pyalapin-1.0.0.tar.gz
.
File metadata
- Download URL: pyalapin-1.0.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ae7e1855d19864f436507250fd94876bd41d467c750d00076c83dcafc33fd2e |
|
MD5 | 34610249f696dab5c822058a6f7da8f3 |
|
BLAKE2b-256 | 906f2026722b59b315d819230ed454d33b4ac9ce3f59307923cad31830250b56 |
File details
Details for the file pyalapin-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pyalapin-1.0.0-py3-none-any.whl
- Upload date:
- Size: 36.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1c733df2b1df6e2f664dd5de81109e57280e34d3e72fb9e43f5e9f02c0d677a |
|
MD5 | 28bb77073d1f1ea6efc66b2872146e76 |
|
BLAKE2b-256 | 045f23be1a38d62a9250d2992a41f1891303ddd034002a2aa42839257302140c |