stockfish


Namestockfish JSON
Version 3.28.0 PyPI version JSON
download
home_pagehttps://github.com/zhelyabuzhsky/stockfish
SummaryWraps the open-source Stockfish chess engine for easy integration into python.
upload_time2022-07-05 04:38:28
maintainer
docs_urlNone
authorIlya Zhelyabuzhsky
requires_python>=3.7
licenseMIT
keywords chess stockfish
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Stockfish
Implements an easy-to-use Stockfish class to integrates the Stockfish chess engine with Python.

## Install
```bash
$ pip install stockfish
```

#### Ubuntu
```bash
$ sudo apt install stockfish
``` 

#### Mac OS
```bash
$ brew install stockfish
```

## Features and usage examples

### Initialize Stockfish class

You should install the stockfish engine in your operating system globally or specify path to binary file in class constructor

```python
from stockfish import Stockfish

stockfish = Stockfish(path="/Users/zhelyabuzhsky/Work/stockfish/stockfish-9-64")
```

There are some default engine settings used by this wrapper. For increasing Stockfish's strength and speed, the "Threads" and "Hash" parameters can be modified.
```python
{
    "Debug Log File": "",
    "Contempt": 0,
    "Min Split Depth": 0,
    "Threads": 1, # More threads will make the engine stronger, but should be kept at less than the number of logical processors on your computer.
    "Ponder": "false",
    "Hash": 16, # Default size is 16 MB. It's recommended that you increase this value, but keep it as some power of 2. E.g., if you're fine using 2 GB of RAM, set Hash to 2048 (11th power of 2).
    "MultiPV": 1,
    "Skill Level": 20,
    "Move Overhead": 10,
    "Minimum Thinking Time": 20,
    "Slow Mover": 100,
    "UCI_Chess960": "false",
    "UCI_LimitStrength": "false",
    "UCI_Elo": 1350
}
```

You can change them, as well as the default search depth, during your Stockfish class initialization:
```python
stockfish = Stockfish(path="/Users/zhelyabuzhsky/Work/stockfish/stockfish-9-64", depth=18, parameters={"Threads": 2, "Minimum Thinking Time": 30})
```

These parameters can also be updated at any time by calling the "update_engine_parameters" function:
```python
stockfish.update_engine_parameters({"Hash": 2048, "UCI_Chess960": "true"}) # Gets stockfish to use a 2GB hash table, and also to play Chess960.
```

### Set position by a sequence of moves from the starting position
```python
stockfish.set_position(["e2e4", "e7e6"])
```

### Update position by making a sequence of moves from the current position
```python
stockfish.make_moves_from_current_position(["g4d7", "a8b8", "f1d1"])
```

### Set position by Forsyth–Edwards Notation (FEN)
If you'd like to first check if your fen is valid, call the is_fen_valid() function below.  
Also, if you want to play Chess960, it's recommended you first update the "UCI_Chess960" engine parameter to be "true", before calling set_fen_position.
```python
stockfish.set_fen_position("rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2")
```

### Check whether the given FEN is valid
This function returns a bool saying whether the passed in FEN is valid (both syntax wise and whether the position represented is legal).  
The function isn't perfect and won't catch all cases, but generally it should return the correct answer.
For example, one exception is positions which are legal, but have no legal moves. 
I.e., for checkmates and stalemates, this function will incorrectly say the fen is invalid.
```python
stockfish.is_fen_valid("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1")
```
```text
True
```
```python
stockfish.is_fen_valid("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -") # will return False, in this case because the FEN is missing two of the six required fields.
```
```text
False
```

### Get best move
```python
stockfish.get_best_move()
```
```text
d2d4
```
It's possible to specify remaining time on black and/or white clock. Time is in milliseconds.
```python
stockfish.get_best_move(wtime=1000, btime=1000)
```

### Get best move based on a time constraint
```python
stockfish.get_best_move_time(1000)
```
Time constraint is in milliseconds
```text
e2e4
```

### Check is move correct with current position
```python
stockfish.is_move_correct('a2a3')
```
```text
True
```

### Get info on the top n moves
```python
stockfish.get_top_moves(3)
```
```text
[
    {'Move': 'f5h7', 'Centipawn': None, 'Mate': 1},
    {'Move': 'f5d7', 'Centipawn': 713, 'Mate': None},
    {'Move': 'f5h5', 'Centipawn': -31, 'Mate': None}
]
```

### Get Stockfish's win/draw/loss stats for the side to move in the current position  
Before calling this function, it is recommended that you first check if your version of Stockfish is recent enough to display WDL stats. To do this,  
use the "does_current_engine_version_have_wdl_option()" function below.
```python
stockfish.get_wdl_stats()
```
```text
[87, 894, 19]
```

### Find if your version of Stockfish is recent enough to display WDL stats
```python
stockfish.does_current_engine_version_have_wdl_option()
```
```text
True
```

### Set current engine's skill level (ignoring ELO rating)
```python
stockfish.set_skill_level(15)
```

### Set current engine's ELO rating (ignoring skill level)
```python
stockfish.set_elo_rating(1350)
```

### Set current engine's depth
```python
stockfish.set_depth(15)
```

### Get current engine's parameters
```python
stockfish.get_parameters()
```
```text
{
    "Debug Log File": "",
    "Contempt": 0,
    "Min Split Depth": 0,
    "Threads": 1,
    "Ponder": "false",
    "Hash": 16,
    "MultiPV": 1,
    "Skill Level": 20,
    "Move Overhead": 10,
    "Minimum Thinking Time": 20,
    "Slow Mover": 100,
    "UCI_Chess960": "false",
    "UCI_LimitStrength": "false",
    "UCI_Elo": 1350
}
```

### Reset the engine's parameters to the default
```python
stockfish.reset_engine_parameters()
```

### Get current board position in Forsyth–Edwards notation (FEN)
```python
stockfish.get_fen_position()
```
```text
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
```

### Get current board visual
```python 
stockfish.get_board_visual()
```
```text
+---+---+---+---+---+---+---+---+
| r | n | b | q | k | b | n | r | 8
+---+---+---+---+---+---+---+---+
| p | p | p | p | p | p | p | p | 7
+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   |   |   | 6
+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   |   |   | 5
+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   |   |   | 4
+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   |   |   | 3
+---+---+---+---+---+---+---+---+
| P | P | P | P | P | P | P | P | 2
+---+---+---+---+---+---+---+---+
| R | N | B | Q | K | B | N | R | 1
+---+---+---+---+---+---+---+---+
  a   b   c   d   e   f   g   h
```
This function has an optional boolean (True by default) as a parameter that indicates whether the board should be seen from the view of white. So it is possible to get the board from black's point of view like this:
```python 
stockfish.get_board_visual(False)
```
```text
+---+---+---+---+---+---+---+---+
| R | N | B | K | Q | B | N | R | 1
+---+---+---+---+---+---+---+---+
| P | P | P | P | P | P | P | P | 2
+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   |   |   | 3
+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   |   |   | 4
+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   |   |   | 5
+---+---+---+---+---+---+---+---+
|   |   |   |   |   |   |   |   | 6
+---+---+---+---+---+---+---+---+
| p | p | p | p | p | p | p | p | 7
+---+---+---+---+---+---+---+---+
| r | n | b | k | q | b | n | r | 8
+---+---+---+---+---+---+---+---+
  h   g   f   e   d   c   b   a
```

### Get current board evaluation in centipawns or mate in x
```python 
stockfish.get_evaluation()
```
Positive is advantage white, negative is advantage black
```text
{"type":"cp", "value":12}
{"type":"mate", "value":-3}
```

### Run benchmark

#### BenchmarkParameters
```python
params = BenchmarkParameters(**kwargs)
```
parameters required to run the benchmark function. kwargs can be used to set custom values.
```text
ttSize: range(1,128001)
threads: range(1,513)
limit: range(1,10001)
fenFile: "path/to/file.fen"
limitType: "depth", "perft", "nodes", "movetime"
evalType: "mixed", "classical", "NNUE"
```

```python 
stockfish.benchmark(params)
```
This will run the bench command with BenchmarkParameters.
It is an additional custom non-UCI command, mainly for debugging.
Do not use this command during a search!

### Get current major version of stockfish engine
E.g., if the engine being used is Stockfish 14.1 or Stockfish 14, then the function would return 14.
Meanwhile, if a development build of the engine is being used (not an official release), then the function returns an 
int with 5 or 6 digits, representing the date the engine was compiled on. 
For example, 20122 is returned for the development build compiled on January 2, 2022.
```python 
stockfish.get_stockfish_major_version()
```
```text
15
```

### Find if the version of Stockfish being used is a development build
```python
stockfish.is_development_build_of_engine()
```
```text
False
```

### Find what is on a certain square
If the square is empty, the None object is returned. Otherwise, one of 12 enum members of a custom  
Stockfish.Piece enum will be returned. Each of the 12 members of this enum is named in the following pattern:  
*colour* followed by *underscore* followed by *piece name*, where the colour and piece name are in all caps.  
For example, say the current position is the starting position:  
```python
stockfish.get_what_is_on_square("e1") # returns Stockfish.Piece.WHITE_KING
stockfish.get_what_is_on_square("d8") # returns Stockfish.Piece.BLACK_QUEEN
stockfish.get_what_is_on_square("h2") # returns Stockfish.Piece.WHITE_PAWN
stockfish.get_what_is_on_square("b5") # returns None
```

### Find if a move will be a capture (and if so, what type of capture)
The argument must be a string that represents the move, using the notation that Stockfish uses (i.e., the coordinate of the starting square followed by the coordinate of the ending square).   
The function will return one of the following enum members from a custom Stockfish.Capture enum: DIRECT_CAPTURE, EN_PASSANT, or NO_CAPTURE.  
For example, say the current position is the one after 1.e4 Nf6 2.Nc3 e6 3.e5 d5.
```python
stockfish.will_move_be_a_capture("c3d5")  # returns Stockfish.Capture.DIRECT_CAPTURE  
stockfish.will_move_be_a_capture("e5f6")  # returns Stockfish.Capture.DIRECT_CAPTURE  
stockfish.will_move_be_a_capture("e5d6")  # returns Stockfish.Capture.EN_PASSANT  
stockfish.will_move_be_a_capture("f1e2")  # returns Stockfish.Capture.NO_CAPTURE  
```

### StockfishException

The `StockfishException` is a newly defined Exception type. It is thrown when the underlying Stockfish process created by the wrapper crashes. This can happen when an incorrect input like an invalid FEN (for example ```8/8/8/3k4/3K4/8/8/8 w - - 0 1``` with both kings next to each other) is given to Stockfish. \
Not all invalid inputs will lead to a `StockfishException`, but only those which cause the Stockfish process to crash. \
To handle a `StockfishException` when using this library, import the `StockfishException` from the library and use a `try/except`-block:
```python
from stockfish import StockfishException

try:
    # Evaluation routine

except StockfishException:
    # Error handling
```

## Testing
```bash
$ python setup.py test
```

## Security
If you discover any security related issues, please email zhelyabuzhsky@icloud.com instead of using the issue tracker.

## Credits
- [Ilya Zhelyabuzhsky](https://github.com/zhelyabuzhsky)
- [All Contributors](https://github.com/zhelyabuzhsky/stockfish/graphs/contributors)

## License
MIT License. Please see [License File](https://github.com/zhelyabuzhsky/stockfish/blob/master/LICENSE) for more information.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zhelyabuzhsky/stockfish",
    "name": "stockfish",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "chess stockfish",
    "author": "Ilya Zhelyabuzhsky",
    "author_email": "zhelyabuzhsky@icloud.com",
    "download_url": "https://files.pythonhosted.org/packages/dc/bd/b06883b957530867179da3672fa3d8b87a08a1e3c11ca9737d94b60689d2/stockfish-3.28.0.tar.gz",
    "platform": null,
    "description": "# Stockfish\nImplements an easy-to-use Stockfish class to integrates the Stockfish chess engine with Python.\n\n## Install\n```bash\n$ pip install stockfish\n```\n\n#### Ubuntu\n```bash\n$ sudo apt install stockfish\n``` \n\n#### Mac OS\n```bash\n$ brew install stockfish\n```\n\n## Features and usage examples\n\n### Initialize Stockfish class\n\nYou should install the stockfish engine in your operating system globally or specify path to binary file in class constructor\n\n```python\nfrom stockfish import Stockfish\n\nstockfish = Stockfish(path=\"/Users/zhelyabuzhsky/Work/stockfish/stockfish-9-64\")\n```\n\nThere are some default engine settings used by this wrapper. For increasing Stockfish's strength and speed, the \"Threads\" and \"Hash\" parameters can be modified.\n```python\n{\n    \"Debug Log File\": \"\",\n    \"Contempt\": 0,\n    \"Min Split Depth\": 0,\n    \"Threads\": 1, # More threads will make the engine stronger, but should be kept at less than the number of logical processors on your computer.\n    \"Ponder\": \"false\",\n    \"Hash\": 16, # Default size is 16 MB. It's recommended that you increase this value, but keep it as some power of 2. E.g., if you're fine using 2 GB of RAM, set Hash to 2048 (11th power of 2).\n    \"MultiPV\": 1,\n    \"Skill Level\": 20,\n    \"Move Overhead\": 10,\n    \"Minimum Thinking Time\": 20,\n    \"Slow Mover\": 100,\n    \"UCI_Chess960\": \"false\",\n    \"UCI_LimitStrength\": \"false\",\n    \"UCI_Elo\": 1350\n}\n```\n\nYou can change them, as well as the default search depth, during your Stockfish class initialization:\n```python\nstockfish = Stockfish(path=\"/Users/zhelyabuzhsky/Work/stockfish/stockfish-9-64\", depth=18, parameters={\"Threads\": 2, \"Minimum Thinking Time\": 30})\n```\n\nThese parameters can also be updated at any time by calling the \"update_engine_parameters\" function:\n```python\nstockfish.update_engine_parameters({\"Hash\": 2048, \"UCI_Chess960\": \"true\"}) # Gets stockfish to use a 2GB hash table, and also to play Chess960.\n```\n\n### Set position by a sequence of moves from the starting position\n```python\nstockfish.set_position([\"e2e4\", \"e7e6\"])\n```\n\n### Update position by making a sequence of moves from the current position\n```python\nstockfish.make_moves_from_current_position([\"g4d7\", \"a8b8\", \"f1d1\"])\n```\n\n### Set position by Forsyth\u2013Edwards Notation (FEN)\nIf you'd like to first check if your fen is valid, call the is_fen_valid() function below.  \nAlso, if you want to play Chess960, it's recommended you first update the \"UCI_Chess960\" engine parameter to be \"true\", before calling set_fen_position.\n```python\nstockfish.set_fen_position(\"rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2\")\n```\n\n### Check whether the given FEN is valid\nThis function returns a bool saying whether the passed in FEN is valid (both syntax wise and whether the position represented is legal).  \nThe function isn't perfect and won't catch all cases, but generally it should return the correct answer.\nFor example, one exception is positions which are legal, but have no legal moves. \nI.e., for checkmates and stalemates, this function will incorrectly say the fen is invalid.\n```python\nstockfish.is_fen_valid(\"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1\")\n```\n```text\nTrue\n```\n```python\nstockfish.is_fen_valid(\"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -\") # will return False, in this case because the FEN is missing two of the six required fields.\n```\n```text\nFalse\n```\n\n### Get best move\n```python\nstockfish.get_best_move()\n```\n```text\nd2d4\n```\nIt's possible to specify remaining time on black and/or white clock. Time is in milliseconds.\n```python\nstockfish.get_best_move(wtime=1000, btime=1000)\n```\n\n### Get best move based on a time constraint\n```python\nstockfish.get_best_move_time(1000)\n```\nTime constraint is in milliseconds\n```text\ne2e4\n```\n\n### Check is move correct with current position\n```python\nstockfish.is_move_correct('a2a3')\n```\n```text\nTrue\n```\n\n### Get info on the top n moves\n```python\nstockfish.get_top_moves(3)\n```\n```text\n[\n    {'Move': 'f5h7', 'Centipawn': None, 'Mate': 1},\n    {'Move': 'f5d7', 'Centipawn': 713, 'Mate': None},\n    {'Move': 'f5h5', 'Centipawn': -31, 'Mate': None}\n]\n```\n\n### Get Stockfish's win/draw/loss stats for the side to move in the current position  \nBefore calling this function, it is recommended that you first check if your version of Stockfish is recent enough to display WDL stats. To do this,  \nuse the \"does_current_engine_version_have_wdl_option()\" function below.\n```python\nstockfish.get_wdl_stats()\n```\n```text\n[87, 894, 19]\n```\n\n### Find if your version of Stockfish is recent enough to display WDL stats\n```python\nstockfish.does_current_engine_version_have_wdl_option()\n```\n```text\nTrue\n```\n\n### Set current engine's skill level (ignoring ELO rating)\n```python\nstockfish.set_skill_level(15)\n```\n\n### Set current engine's ELO rating (ignoring skill level)\n```python\nstockfish.set_elo_rating(1350)\n```\n\n### Set current engine's depth\n```python\nstockfish.set_depth(15)\n```\n\n### Get current engine's parameters\n```python\nstockfish.get_parameters()\n```\n```text\n{\n    \"Debug Log File\": \"\",\n    \"Contempt\": 0,\n    \"Min Split Depth\": 0,\n    \"Threads\": 1,\n    \"Ponder\": \"false\",\n    \"Hash\": 16,\n    \"MultiPV\": 1,\n    \"Skill Level\": 20,\n    \"Move Overhead\": 10,\n    \"Minimum Thinking Time\": 20,\n    \"Slow Mover\": 100,\n    \"UCI_Chess960\": \"false\",\n    \"UCI_LimitStrength\": \"false\",\n    \"UCI_Elo\": 1350\n}\n```\n\n### Reset the engine's parameters to the default\n```python\nstockfish.reset_engine_parameters()\n```\n\n### Get current board position in Forsyth\u2013Edwards notation (FEN)\n```python\nstockfish.get_fen_position()\n```\n```text\nrnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1\n```\n\n### Get current board visual\n```python \nstockfish.get_board_visual()\n```\n```text\n+---+---+---+---+---+---+---+---+\n| r | n | b | q | k | b | n | r | 8\n+---+---+---+---+---+---+---+---+\n| p | p | p | p | p | p | p | p | 7\n+---+---+---+---+---+---+---+---+\n|   |   |   |   |   |   |   |   | 6\n+---+---+---+---+---+---+---+---+\n|   |   |   |   |   |   |   |   | 5\n+---+---+---+---+---+---+---+---+\n|   |   |   |   |   |   |   |   | 4\n+---+---+---+---+---+---+---+---+\n|   |   |   |   |   |   |   |   | 3\n+---+---+---+---+---+---+---+---+\n| P | P | P | P | P | P | P | P | 2\n+---+---+---+---+---+---+---+---+\n| R | N | B | Q | K | B | N | R | 1\n+---+---+---+---+---+---+---+---+\n  a   b   c   d   e   f   g   h\n```\nThis function has an optional boolean (True by default) as a parameter that indicates whether the board should be seen from the view of white. So it is possible to get the board from black's point of view like this:\n```python \nstockfish.get_board_visual(False)\n```\n```text\n+---+---+---+---+---+---+---+---+\n| R | N | B | K | Q | B | N | R | 1\n+---+---+---+---+---+---+---+---+\n| P | P | P | P | P | P | P | P | 2\n+---+---+---+---+---+---+---+---+\n|   |   |   |   |   |   |   |   | 3\n+---+---+---+---+---+---+---+---+\n|   |   |   |   |   |   |   |   | 4\n+---+---+---+---+---+---+---+---+\n|   |   |   |   |   |   |   |   | 5\n+---+---+---+---+---+---+---+---+\n|   |   |   |   |   |   |   |   | 6\n+---+---+---+---+---+---+---+---+\n| p | p | p | p | p | p | p | p | 7\n+---+---+---+---+---+---+---+---+\n| r | n | b | k | q | b | n | r | 8\n+---+---+---+---+---+---+---+---+\n  h   g   f   e   d   c   b   a\n```\n\n### Get current board evaluation in centipawns or mate in x\n```python \nstockfish.get_evaluation()\n```\nPositive is advantage white, negative is advantage black\n```text\n{\"type\":\"cp\", \"value\":12}\n{\"type\":\"mate\", \"value\":-3}\n```\n\n### Run benchmark\n\n#### BenchmarkParameters\n```python\nparams = BenchmarkParameters(**kwargs)\n```\nparameters required to run the benchmark function. kwargs can be used to set custom values.\n```text\nttSize: range(1,128001)\nthreads: range(1,513)\nlimit: range(1,10001)\nfenFile: \"path/to/file.fen\"\nlimitType: \"depth\", \"perft\", \"nodes\", \"movetime\"\nevalType: \"mixed\", \"classical\", \"NNUE\"\n```\n\n```python \nstockfish.benchmark(params)\n```\nThis will run the bench command with BenchmarkParameters.\nIt is an additional custom non-UCI command, mainly for debugging.\nDo not use this command during a search!\n\n### Get current major version of stockfish engine\nE.g., if the engine being used is Stockfish 14.1 or Stockfish 14, then the function would return 14.\nMeanwhile, if a development build of the engine is being used (not an official release), then the function returns an \nint with 5 or 6 digits, representing the date the engine was compiled on. \nFor example, 20122 is returned for the development build compiled on January 2, 2022.\n```python \nstockfish.get_stockfish_major_version()\n```\n```text\n15\n```\n\n### Find if the version of Stockfish being used is a development build\n```python\nstockfish.is_development_build_of_engine()\n```\n```text\nFalse\n```\n\n### Find what is on a certain square\nIf the square is empty, the None object is returned. Otherwise, one of 12 enum members of a custom  \nStockfish.Piece enum will be returned. Each of the 12 members of this enum is named in the following pattern:  \n*colour* followed by *underscore* followed by *piece name*, where the colour and piece name are in all caps.  \nFor example, say the current position is the starting position:  \n```python\nstockfish.get_what_is_on_square(\"e1\") # returns Stockfish.Piece.WHITE_KING\nstockfish.get_what_is_on_square(\"d8\") # returns Stockfish.Piece.BLACK_QUEEN\nstockfish.get_what_is_on_square(\"h2\") # returns Stockfish.Piece.WHITE_PAWN\nstockfish.get_what_is_on_square(\"b5\") # returns None\n```\n\n### Find if a move will be a capture (and if so, what type of capture)\nThe argument must be a string that represents the move, using the notation that Stockfish uses (i.e., the coordinate of the starting square followed by the coordinate of the ending square).   \nThe function will return one of the following enum members from a custom Stockfish.Capture enum: DIRECT_CAPTURE, EN_PASSANT, or NO_CAPTURE.  \nFor example, say the current position is the one after 1.e4 Nf6 2.Nc3 e6 3.e5 d5.\n```python\nstockfish.will_move_be_a_capture(\"c3d5\")  # returns Stockfish.Capture.DIRECT_CAPTURE  \nstockfish.will_move_be_a_capture(\"e5f6\")  # returns Stockfish.Capture.DIRECT_CAPTURE  \nstockfish.will_move_be_a_capture(\"e5d6\")  # returns Stockfish.Capture.EN_PASSANT  \nstockfish.will_move_be_a_capture(\"f1e2\")  # returns Stockfish.Capture.NO_CAPTURE  \n```\n\n### StockfishException\n\nThe `StockfishException` is a newly defined Exception type. It is thrown when the underlying Stockfish process created by the wrapper crashes. This can happen when an incorrect input like an invalid FEN (for example ```8/8/8/3k4/3K4/8/8/8 w - - 0 1``` with both kings next to each other) is given to Stockfish. \\\nNot all invalid inputs will lead to a `StockfishException`, but only those which cause the Stockfish process to crash. \\\nTo handle a `StockfishException` when using this library, import the `StockfishException` from the library and use a `try/except`-block:\n```python\nfrom stockfish import StockfishException\n\ntry:\n    # Evaluation routine\n\nexcept StockfishException:\n    # Error handling\n```\n\n## Testing\n```bash\n$ python setup.py test\n```\n\n## Security\nIf you discover any security related issues, please email zhelyabuzhsky@icloud.com instead of using the issue tracker.\n\n## Credits\n- [Ilya Zhelyabuzhsky](https://github.com/zhelyabuzhsky)\n- [All Contributors](https://github.com/zhelyabuzhsky/stockfish/graphs/contributors)\n\n## License\nMIT License. Please see [License File](https://github.com/zhelyabuzhsky/stockfish/blob/master/LICENSE) for more information.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Wraps the open-source Stockfish chess engine for easy integration into python.",
    "version": "3.28.0",
    "project_urls": {
        "Homepage": "https://github.com/zhelyabuzhsky/stockfish"
    },
    "split_keywords": [
        "chess",
        "stockfish"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "95b2b3a204dd7754685fef5e62bf19b82d2572b321df619775502326cf7d383e",
                "md5": "524fe23e7ed83bd800564309cbf742a3",
                "sha256": "e432e57112448fe1271dff402db3a4747bf00d1721815ce0a36cfa26582cf360"
            },
            "downloads": -1,
            "filename": "stockfish-3.28.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "524fe23e7ed83bd800564309cbf742a3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 13907,
            "upload_time": "2022-07-05T04:38:25",
            "upload_time_iso_8601": "2022-07-05T04:38:25.910589Z",
            "url": "https://files.pythonhosted.org/packages/95/b2/b3a204dd7754685fef5e62bf19b82d2572b321df619775502326cf7d383e/stockfish-3.28.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dcbdb06883b957530867179da3672fa3d8b87a08a1e3c11ca9737d94b60689d2",
                "md5": "628c58f0c182852bfe235af9da88afb3",
                "sha256": "8764127c00434aa85b7fca1c064800e7ea907bb3626ccd4b583f0e911b014070"
            },
            "downloads": -1,
            "filename": "stockfish-3.28.0.tar.gz",
            "has_sig": false,
            "md5_digest": "628c58f0c182852bfe235af9da88afb3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16264,
            "upload_time": "2022-07-05T04:38:28",
            "upload_time_iso_8601": "2022-07-05T04:38:28.217395Z",
            "url": "https://files.pythonhosted.org/packages/dc/bd/b06883b957530867179da3672fa3d8b87a08a1e3c11ca9737d94b60689d2/stockfish-3.28.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-07-05 04:38:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zhelyabuzhsky",
    "github_project": "stockfish",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "stockfish"
}
        
Elapsed time: 0.11564s