pyalapin


Namepyalapin JSON
Version 1.0.0 PyPI version JSON
download
home_page
SummaryCustom chess engine built specifically to develop AIs
upload_time2023-12-29 15:49:34
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords chess ai interface
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:
```bash
pip install pyalapin
```
You only need [numpy](https://numpy.org/) to play with with terminal interface and with Python.
You will need [kivy](https://kivy.org/) to play with the interface.

## How to play with interface
```python
from pyalapin.interface import ChessApp

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

```
![](docs/scholars_mate_interface.gif)


You can play against Stockfish by installing the official [Python interface](https://github.com/zhelyabuzhsky/stockfish).
```python
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

<img align="right" src="docs/scholars_mate_command.gif">

```python
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:
```bash
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.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pyalapin",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "chess,ai,interface",
    "author": "",
    "author_email": "Vincent Auriau <vincent.auriau.dev@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/90/6f/2026722b59b315d819230ed454d33b4ac9ce3f59307923cad31830250b56/pyalapin-1.0.0.tar.gz",
    "platform": null,
    "description": "# PyAlapin, your customized chess engine\nIs it the best, most efficient and state of the art chess engine ? I'm pretty sure not.\n\nHowever, driven by passion and madness, I have developed my own chess game in Python.\nFor your pretty eyes and your devilish smile, I share it with you. But only with you.\n\nSpecial thanks and dedication to LeMerluche, crushing its opponents on chess.com with alapin openings \u2764\ufe0f\n\n## How to install\nSimply use:\n```bash\npip install pyalapin\n```\nYou only need [numpy](https://numpy.org/) to play with with terminal interface and with Python.\nYou will need [kivy](https://kivy.org/) to play with the interface.\n\n## How to play with interface\n```python\nfrom pyalapin.interface import ChessApp\n\nif __name__ == '__main__':\n    ChessApp(\n        play_with_ai=False # Set to True if you want to play agains AI\n    ).run()\n\n```\n![](docs/scholars_mate_interface.gif)\n\n\nYou can play against Stockfish by installing the official [Python interface](https://github.com/zhelyabuzhsky/stockfish).\n```python\nfrom pyalapin.player.player import Player\nfrom pyalapin.player.stockfish_player import StockfishPlayer\nfrom pyalapin.interface import ChessApp\n\nsfp = StockfishPlayer(path_to_stockfish_engine, white_side=False)\napp = ChessApp(w_player=Player(True), b_player=sfp, play_with_ai=True)\napp.run()\n```\n\n## How to play with Python commands\n\n<img align=\"right\" src=\"docs/scholars_mate_command.gif\">\n\n```python\nfrom pyalapin.engine import ChessGame\n\ngame = ChessGame(\n    automatic_draw=True, # Set to True if you want\n                         # to have each turn drawn in terminal\n    ai=False, # set to True if you want to play agains AI\n    save_pgn=False # set to True if you want to\n                   # save moves as PGN\n)\ngame.move_from_coordinates(game.player1, 1, 4, 3, 4)\ngame.move_from_coordinates(game.player2, 6, 4, 4, 4)\ngame.move_from_coordinates(game.player1, 0, 5, 3, 2)\ngame.move_from_coordinates(game.player2, 6, 3, 5, 4)\ngame.move_from_coordinates(game.player1, 0, 3, 2, 5)\ngame.move_from_coordinates(game.player2, 6, 2, 4, 2)\ngame.move_from_coordinates(game.player2, 2, 5, 6, 5)\n```\nThere are colors in the command line not showing here in the GIF, though...\n\n## How to change interface colors\n\nWith 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).\nUse the following command with the colors you want:\n```bash\npython 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\n```\nArguments are:\n- -ccb/--color_cell_black: RGB, default 0, 191, 255\n- -ccw/--color_cell_white: RGB, default 207, 185, 151\n- -ibp/--inner_black_piece: RGB, default 109, 7, 26\n- -obp/--outer_black_piece: RGB, default 0, 0, 0\n- -iwp/--inner_white_piece: RGB, default 200, 200, 200\n- -owp/--outer_white_piece: RGB, default 255, 255, 255\n\nThe 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.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Custom chess engine built specifically to develop AIs",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/VincentAuriau/custom-chess-engine"
    },
    "split_keywords": [
        "chess",
        "ai",
        "interface"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "045f23be1a38d62a9250d2992a41f1891303ddd034002a2aa42839257302140c",
                "md5": "28bb77073d1f1ea6efc66b2872146e76",
                "sha256": "c1c733df2b1df6e2f664dd5de81109e57280e34d3e72fb9e43f5e9f02c0d677a"
            },
            "downloads": -1,
            "filename": "pyalapin-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "28bb77073d1f1ea6efc66b2872146e76",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 36869,
            "upload_time": "2023-12-29T15:49:32",
            "upload_time_iso_8601": "2023-12-29T15:49:32.801323Z",
            "url": "https://files.pythonhosted.org/packages/04/5f/23be1a38d62a9250d2992a41f1891303ddd034002a2aa42839257302140c/pyalapin-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "906f2026722b59b315d819230ed454d33b4ac9ce3f59307923cad31830250b56",
                "md5": "34610249f696dab5c822058a6f7da8f3",
                "sha256": "8ae7e1855d19864f436507250fd94876bd41d467c750d00076c83dcafc33fd2e"
            },
            "downloads": -1,
            "filename": "pyalapin-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "34610249f696dab5c822058a6f7da8f3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 1036798,
            "upload_time": "2023-12-29T15:49:34",
            "upload_time_iso_8601": "2023-12-29T15:49:34.782454Z",
            "url": "https://files.pythonhosted.org/packages/90/6f/2026722b59b315d819230ed454d33b4ac9ce3f59307923cad31830250b56/pyalapin-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-29 15:49:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "VincentAuriau",
    "github_project": "custom-chess-engine",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyalapin"
}
        
Elapsed time: 0.18517s