|
1 | 1 | 
|
2 | 2 |
|
3 | 3 | ## Introduction
|
4 |
| -Sunfish is a simple, but strong chess engine, written in Python, mostly for teaching purposes. Without tables and its simple interface, it takes up just 111 lines of code! (see [`compressed.py`](https://github.com/thomasahle/sunfish/blob/master/compressed.py)) Yet [it plays at ratings above 2000 at Lichess](https://lichess.org/@/sunfish-engine). |
| 4 | +Sunfish is a simple, but strong chess engine, written in Python. With its simple [UCI](http://wbec-ridderkerk.nl/html/UCIProtocol.html) interface, and removing comments and whitespace, it takes up just 131 lines of code! (`build/clean.sh sunfish.py | wc -l`). |
| 5 | +Yet [it plays at ratings above 2000 at Lichess](https://lichess.org/@/sunfish-engine). |
5 | 6 |
|
6 | 7 | Because Sunfish is small and strives to be simple, the code provides a great platform for experimenting. People have used it for testing parallel search algorithms, experimenting with evaluation functions, and developing deep learning chess programs. Fork it today and see what you can do!
|
7 | 8 |
|
8 |
| -## Screenshot |
9 |
| - |
10 |
| - My move: g8f6 |
11 |
| - |
12 |
| - 8 ♖ ♘ ♗ ♕ ♔ ♗ · ♖ |
13 |
| - 7 ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙ |
14 |
| - 6 · · · · · ♘ · · |
15 |
| - 5 · · · · · · · · |
16 |
| - 4 · · · · ♟ · · · |
17 |
| - 3 · · · · · · · · |
18 |
| - 2 ♟ ♟ ♟ ♟ · ♟ ♟ ♟ |
19 |
| - 1 ♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜ |
20 |
| - a b c d e f g h |
21 |
| - |
22 |
| - |
23 |
| - Your move: |
24 |
| - |
25 |
| -# Run it! |
26 |
| - |
27 |
| -Sunfish is self contained in the `sunfish.py` file from the repository. I recommend running it with `pypy` or `pypy3` for optimal performance. |
28 |
| - |
29 |
| -If you want a more "fancy" terminal experience, run `fancy.py` instead. (Note this requires the [python-chess](https://github.com/niklasf/python-chess/) package.) |
30 |
| - |
31 |
| -It is also possible to run Sunfish with a graphical interface, such as [PyChess](http://pychess.org), [Arena](http://www.playwitharena.com) or your chess interface of choice. Sunfish' can communicate through the [XBoard](http://www.gnu.org/software/xboard/)/CECP protocol by the command `pypy -u xboard.py`. Ruxy Sylwyka has [a note on making it all work on Windows](http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&p=560462). |
32 |
| - |
33 |
| -You can [play sunfish now on Lichess](https://lichess.org/@/sunfish-engine) (requires log in) or play against [Recursing's Rust port](https://github.com/Recursing/sunfish_rs), |
| 9 | +# Play against sunfish! |
| 10 | + |
| 11 | +The simplest way to run sufish is through the "fancy" terminal interface: |
| 12 | +<pre> |
| 13 | +$ <b>tools/fancy.py -cmd ./sunfish.py</b> |
| 14 | +Playing against sunfish 2023. |
| 15 | +Do you want to be white or black? <b>black</b> |
| 16 | + 1 ♖ ♘ ♗ ♔ ♕ ♗ ♘ ♖ |
| 17 | + 2 ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙ |
| 18 | + 3 |
| 19 | + 4 |
| 20 | + 5 |
| 21 | + 6 |
| 22 | + 7 ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟ |
| 23 | + 8 ♜ ♞ ♝ ♚ ♛ ♝ ♞ ♜ |
| 24 | + h g f e d c b a |
| 25 | + |
| 26 | +Score: 23, nodes: 11752, nps: 13812, time: 0.9 |
| 27 | + My move: d4 |
| 28 | + 1 ♖ ♘ ♗ ♔ ♕ ♗ ♘ ♖ |
| 29 | + 2 ♙ ♙ ♙ ♙ ♙ ♙ ♙ |
| 30 | + 3 |
| 31 | + 4 ♙ |
| 32 | + 5 |
| 33 | + 6 |
| 34 | + 7 ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟ |
| 35 | + 8 ♜ ♞ ♝ ♚ ♛ ♝ ♞ ♜ |
| 36 | + h g f e d c b a |
| 37 | + |
| 38 | +Your move (e.g. c6 or g8h6): <b>Nf6</b> |
| 39 | +</pre> |
| 40 | + |
| 41 | +Note this requires the [python-chess](https://github.com/niklasf/python-chess/) package. |
| 42 | +For a true minimalist experience, first we can "pack" sunfish into a compressed executable (less than 3KB!) and run it directly: |
| 43 | +<pre> |
| 44 | +$ <b>build/pack.sh sunfish.py packed.sh</b> |
| 45 | +Total length: 2953 |
| 46 | +$ <b>./packed.sh</b> |
| 47 | +<b>go wtime 1000 btime 1000 winc 1000 binc 1000</b> |
| 48 | +info depth 1 score cp 0 pv d2d4 |
| 49 | +bestmove d2d4 |
| 50 | +</pre> |
| 51 | +(See the [UCI specification](http://wbec-ridderkerk.nl/html/UCIProtocol.html) for the full set of commands.) |
| 52 | + |
| 53 | +It is also possible to run Sunfish with a graphical interface, such as [PyChess](http://pychess.org) or [Arena](http://www.playwitharena.de). |
| 54 | + |
| 55 | +Finally you can [play sunfish now on Lichess](https://lichess.org/@/sunfish-engine) (requires log in) or play against [Recursing's Rust port](https://github.com/Recursing/sunfish_rs), |
34 | 56 | also [on Lichess](https://lichess.org/@/sunfish_rs), which is about 100 ELO stronger.
|
35 | 57 |
|
36 | 58 | # Features
|
|
0 commit comments