(Strongest?) python engine: D-house

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

alvinypeng
Posts: 36
Joined: Thu Mar 03, 2022 7:29 am
Full name: Alvin Peng

(Strongest?) python engine: D-house

Post by alvinypeng »

I'm curious to see how strong a chess engine in python can get. So, I'm writing one to try and find out.

https://github.com/alvinypeng/d-house

D-house only uses the python standard library. I feel it would defeat the purpose of the project if I were to offload computationally intensive work onto third-party libraries written in C/C++. In terms of search logic, a lot is yoinked from Berserk (thank you, Jay).

It hits around 5-6k nodes/s single core on my machine. The slow speed makes it relatively much weaker in faster tc. D-house plays best in long repeating time controls like 40/15 because it becomes more prone to tactical mistakes in time scrambles.
dkappe
Posts: 1632
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: (Strongest?) python engine: D-house

Post by dkappe »

King of the hill is a0lite, but it’s a mcts/nn engine, so speed is less important. https://github.com/dkappe/a0lite

Add in a gpu and it can go all the way to 2850++. It made it all the way to L4 a few TCEC seasons ago.
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".
alvinypeng
Posts: 36
Joined: Thu Mar 03, 2022 7:29 am
Full name: Alvin Peng

Re: (Strongest?) python engine: D-house

Post by alvinypeng »

dkappe wrote: Sun Mar 20, 2022 10:58 am King of the hill is a0lite, but it’s a mcts/nn engine, so speed is less important. https://github.com/dkappe/a0lite

Add in a gpu and it can go all the way to 2850++. It made it all the way to L4 a few TCEC seasons ago.
I am aware of a0lite's existence, but it relies on external libraries. So according to my arbitrary guidelines, I wouldn't personally consider it "pure" python.

I do however think that a0lite is an amazing piece of work. I want to eventually write another engine with mcts/nn and I will definitely be looking at your source code for help. Leela's code is a bit over my head at the moment.
dkappe
Posts: 1632
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: (Strongest?) python engine: D-house

Post by dkappe »

Well, python-chess isn’t exactly a speed burner, and you’ll have a hard time operating a Nvidia gpu in “pure” python, but to each their own. Best of luck.
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".
User avatar
gbtami
Posts: 389
Joined: Wed Sep 26, 2012 1:29 pm
Location: Hungary

Re: (Strongest?) python engine: D-house

Post by gbtami »

Possible the best pure Python competitor is https://github.com/pychess/pychess
User avatar
Sylwy
Posts: 5005
Joined: Fri Apr 21, 2006 4:19 pm
Location: IAȘI - the historical capital of MOLDOVA
Full name: Silvian Rucsandescu

Re: (Strongest?) python engine: D-house

Post by Sylwy »

alvinypeng wrote: Sun Mar 20, 2022 9:04 am I'm curious to see how strong a chess engine in python can get. So, I'm writing one to try and find out.

https://github.com/alvinypeng/d-house

D-house only uses the python standard library. I feel it would defeat the purpose of the project if I were to offload computationally intensive work onto third-party libraries written in C/C++. In terms of search logic, a lot is yoinked from Berserk (thank you, Jay).

It hits around 5-6k nodes/s single core on my machine. The slow speed makes it relatively much weaker in faster tc. D-house plays best in long repeating time controls like 40/15 because it becomes more prone to tactical mistakes in time scrambles.
THANK YOU !

Best pure Python chess engine (in my tests) is PyChess 0.99.4. No GPU ( a0lite) :lol: only CPU !
Sunfish is also OK.........Feeks-IZII-Lopez & co...... :wink:

Image

The slow speed ......this is the problem......

I'll test your chess engine !
connor_mcmonigle
Posts: 544
Joined: Sun Sep 06, 2020 4:40 am
Full name: Connor McMonigle

Re: (Strongest?) python engine: D-house

Post by connor_mcmonigle »

alvinypeng wrote: Sun Mar 20, 2022 9:04 am I'm curious to see how strong a chess engine in python can get. So, I'm writing one to try and find out.

https://github.com/alvinypeng/d-house

D-house only uses the python standard library. I feel it would defeat the purpose of the project if I were to offload computationally intensive work onto third-party libraries written in C/C++. In terms of search logic, a lot is yoinked from Berserk (thank you, Jay).

It hits around 5-6k nodes/s single core on my machine. The slow speed makes it relatively much weaker in faster tc. D-house plays best in long repeating time controls like 40/15 because it becomes more prone to tactical mistakes in time scrambles.
Hmm. It might be worth mentioning explicitly in the README that this is more of less a direct translation of Berserk to python (given the evaluation function is also yoinked from an older version of Berserk). Are there any components of the engine which differ from Berserk (outside of their translation to Python)? In any case, I guess it's somewhat interesting to see how a top engine performs when rewritten in Python, though why did you choose Berserk over Stockfish?
alvinypeng
Posts: 36
Joined: Thu Mar 03, 2022 7:29 am
Full name: Alvin Peng

Re: (Strongest?) python engine: D-house

Post by alvinypeng »

connor_mcmonigle wrote: Sun Mar 20, 2022 5:51 pm
alvinypeng wrote: Sun Mar 20, 2022 9:04 am I'm curious to see how strong a chess engine in python can get. So, I'm writing one to try and find out.

https://github.com/alvinypeng/d-house

D-house only uses the python standard library. I feel it would defeat the purpose of the project if I were to offload computationally intensive work onto third-party libraries written in C/C++. In terms of search logic, a lot is yoinked from Berserk (thank you, Jay).

It hits around 5-6k nodes/s single core on my machine. The slow speed makes it relatively much weaker in faster tc. D-house plays best in long repeating time controls like 40/15 because it becomes more prone to tactical mistakes in time scrambles.
Hmm. It might be worth mentioning explicitly in the README that this is more of less a direct translation of Berserk to python (given the evaluation function is also yoinked from an older version of Berserk). Are there any components of the engine which differ from Berserk (outside of their translation to Python)? In any case, I guess it's somewhat interesting to see how a top engine performs when rewritten in Python, though why did you choose Berserk over Stockfish?
While it is primarily based off Berserk, the transposition table is not, among several other things. I did credit the sources of where I took ideas/logic from in my README. The code is all public under the GPL-3.0 License anyway, so anyone is free to look and take my code as well.

As for picking Berserk, it was because the Stockfish NNUE requires a complete recalculation every time the king moves. I thought this would be too slow for python, especially in the endgame. The Berserk 6 network architecture is not indexed by the king so the network could be incrementally updated for every move. And after choosing to use Berserk's NNUE, I decided to use the search too. I do think the Stockfish search is superior though. It would take a lot of work to translate it into python, but maybe I'll have a go at it in the future...
alvinypeng
Posts: 36
Joined: Thu Mar 03, 2022 7:29 am
Full name: Alvin Peng

Re: (Strongest?) python engine: D-house

Post by alvinypeng »

Sylwy wrote: Sun Mar 20, 2022 4:54 pm I'll test your chess engine !
Thanks! I wasn't sure if there was gonna be anyone interested in doing so.
supersharp77
Posts: 1266
Joined: Sat Jul 05, 2014 7:54 am
Location: Southwest USA

Re: (Strongest?) python engine: D-house

Post by supersharp77 »

dkappe wrote: Sun Mar 20, 2022 10:58 am King of the hill is a0lite, but it’s a mcts/nn engine, so speed is less important. https://github.com/dkappe/a0lite

Add in a gpu and it can go all the way to 2850++. It made it all the way to L4 a few TCEC seasons ago.
Based on what I've viewed online...very few people have been able to run A0 "lite" at all......the master contained no exe and the .bat file was unsuccessful in initiating the python file.....Failed for me in Arena...Banksia....Cutechess & Pythonchess Gui's (CPU) even more difficult to execute for GPU....AR :) :wink: