3 ms·
For people interested in making their own, I highly recommend reading through https://github.com/thomasahle/sunfish/blob/master/sunfish.py https://github.com/th
by Recursing 9mo ago
For people interested in making their own, I highly recommend reading through https://github.com/thomasahle/sunfish/blob/master/sunfish.py https://github.com/thomasahle/sunfish/blob/master/sunfish.py , a surprisingly readable and surprisingly strong chess engine in 111 lines of Python
https://www.chessprogramming.org/ https://www.chessprogramming.org/ is also really interesting, see e.g. https://www.chessprogramming.org/Sunfish https://www.chessprogramming.org/Sunfish and https://www.chessprogramming.org/Quiescence_Search https://www.chessprogramming.org/Quiescence_Search
- utopiah 9mo ago> surprisingly readable and surprisingly strong chess engine in 111 lines of Python Link I get shows 500 lines and it starts with 50 lines of piece-square tables. Maybe it's obvious when you are into the domain but otherwise... that's pretty much of opposite of what I would call "readable".
- Recursing 9mo agoYes it's "surprisingly readable" only for being so strong and so concise, definitely not production code. The file is 500 lines because of the piece square tables (as you mentioned), comments, and the CLI interface logic Previous HN thread here: https://news.ycombinator.com/item?id=20068651 https://news.ycombinator.com/item?id=20068651
- svat 9mo agoIt appears that the “111 lines” is a reference to the version as of 2014-02-11: https://github.com/thomasahle/sunfish/blob/e2b7fc29ce2a112beb4beecd63bb139b3a79481d/sunfish.py https://github.com/thomasahle/sunfish/blob/e2b7fc29ce2a112be... (386 lines), about which the author says (https://www.reddit.com/r/programming/comments/1xmj1a/comment/cfcpjx6/ https://www.reddit.com/r/programming/comments/1xmj1a/comment...): > I got 111 by deleting the tables in the top, and the UI code in the bottom, and then running 'cloc' on the result. That gave 20 blanks, 56 comments and 111 lines of code. ;-)