SUNFISH - a new chess engine written in Python !

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

Moderator: Ras

JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: Increasing the performances !

Post by JoshPettus »

Well never mind that fairymax has the C++ advantage, I wouldn't necessarily call it a slouch (despite it's lineage) :)

I think a more interesting comparison would be how it compares to other engines from odd code/scripting languages: python, java,... ruby...lua... C is boring, everyone does it. :lol:

There is a saying, "art from adversity."
Last edited by JoshPettus on Thu Mar 06, 2014 8:01 pm, edited 1 time in total.
User avatar
Sylwy
Posts: 4793
Joined: Fri Apr 21, 2006 4:19 pm
Location: IAȘI - the historical capital of MOLDOVA
Full name: Silvian Rucsandescu

Re: Increasing the performances !

Post by Sylwy »

ZirconiumX wrote:I have to agree with you Ruxy, the engine can be very aggressive. Mind you, so can others.

Poor Sunfish was helpless against Fairy-Max...

[pgn]
[Event "Computer Chess Game"]
[Site "THUNDERBIRD"]
[Date "2014.03.06"]
[Round "-"]
[White "Sunfish"]
[Black "Fairy-Max 4.8S"]
[Result "0-1"]
[TimeControl "40/300"]
[Annotator "1. +0.02 1... +0.25"]

1. Nc3 {+0.02/6} d6 {+0.25/9 8} 2. Nf3 {+0.54/6 4} Nf6 {+0.23/9 13} 3. e4
{+0.83/6 6} c6 {+0.10/9 11} 4. Be2 {+1.34/5 2.7} Nbd7 {-0.14/9 6} 5. O-O
{+1.33/5 2.9} g6 {-0.04/10 6} 6. Nd4 {+1.24/5 3} Bg7 {+0.09/10 12} 7. d3
{+0.25/5 4} O-O {+0.18/9 4} 8. Bg5 {-0.11/5 6} Qb6 {+0.12/9 6} 9. Nb3
{-0.14/5 2.9} Ne5 {+0.02/9 6} 10. d4 {+0.48/5 1.9} Ned7 {-0.14/10 8} 11.
Bxf6 {+0.27/5 6} Nxf6 {+0.45/10 5} 12. f4 {+0.10/5 6} h5 {+0.50/10 16} 13.
Rc1 {+0.12/4 2.5} Be6 {+0.51/9 5} 14. Na4 {+0.24/5 5} Qb4 {+0.62/10 6} 15.
Nc3 {+0.16/5 5} Bxb3 {+0.59/10 4} 16. cxb3 {-0.44/5 2.6} Ng4 {+0.68/11 15}
17. Bc4 {-0.81/5 4} Qb6 {+1.99/10 5} 18. Na4 {-1.33/5 4} Qxd4+ {+3.22/12 4}
19. Qxd4 {-3.00/7 4} Bxd4+ {+3.27/12 7} 20. Kh1 {-3.50/7 6} b5 {+2.98/12 5}
21. Rcd1 {-3.78/6 4} Nf2+ {+4.38/13 4} 22. Rxf2 {-3.95/7 4} Bxf2
{+4.43/13 5} 23. Rd2 {-5.05/6 2.4} Be3 {+5.18/13 4} 24. Re2 {-5.58/6 2.3}
Bxf4 {+5.19/13 5} 25. Rf2 {-5.89/6 2.4} Be5 {+5.27/13 7} 26. Rxf7
{-6.73/6 5} bxc4 {+6.87/15 5} 27. Rf3 {-6.73/7 3} cxb3 {+7.09/15 12} 28.
axb3 {-7.55/7 3} Rxf3 {+7.75/16 4} 29. gxf3 {-7.94/9 4} Rb8 {+7.48/16 5}
30. Kg2 {-8.17/9 5} Rxb3 {+8.15/15 3} 31. Kf2 {-8.18/9 8} Bxh2 {+8.43/16 6}
32. Kg2 {-8.38/8 4} Be5 {+9.10/16 4} 33. Kf2 {-8.57/8 4} Rb4 {+10.82/17 15}
34. b3 {-10.51/8 9} Rxb3 {+11.63/17 5} 35. f4 {-10.92/8 4} Bxf4
{+12.92/16 4} 36. Kg2 {-11.34/8 14} h4 {+19.32/17 5} 37. Nc3 {-17.42/8 2.7}
Rxc3 {+79.93/18 3} 38. Kg1 {-21.80/10 10} Rc2 {+79.95/12 3} 39. e5
{-21.79/10 2.1} h3 {+79.96/27 3}
{White resigns} 0-1
[/pgn]

Note: this is a version where I have added a few patches to help it along, like LMR (questionably sound at the moment) and making the TT move before any others. You can see my patches at https://github.com/ZirconiumX/sunfish (shameless plug).

Matthew:out
Well, this year is a little fish , the next will be a PYTHON+SHARK !!!!! :lol:

Thank YOU a lot, ZirconiumX !
SilvianR :wink:
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: Increasing the performances !

Post by JoshPettus »

Sylwy wrote: Well, this year is a little fish , the next will be a PYTHON+SHARK !!!!! :lol:
How about a sea snake? :wink:
User avatar
Sylwy
Posts: 4793
Joined: Fri Apr 21, 2006 4:19 pm
Location: IAȘI - the historical capital of MOLDOVA
Full name: Silvian Rucsandescu

Re: Increasing the performances !

Post by Sylwy »

JoshPettus wrote:
Sylwy wrote: Well, this year is a little fish , the next will be a PYTHON+SHARK !!!!! :lol:
How about a sea snake? :wink:
:lol:

The father & the mother are PYTHON(s) !
ZirconiumX
Posts: 1346
Joined: Sun Jul 17, 2011 11:14 am
Full name: Hannah Ravensloft

Re: Increasing the performances !

Post by ZirconiumX »

Sylwy wrote:
ZirconiumX wrote:I have to agree with you Ruxy, the engine can be very aggressive. Mind you, so can others.

Poor Sunfish was helpless against Fairy-Max...

[pgn]
[Event "Computer Chess Game"]
[Site "THUNDERBIRD"]
[Date "2014.03.06"]
[Round "-"]
[White "Sunfish"]
[Black "Fairy-Max 4.8S"]
[Result "0-1"]
[TimeControl "40/300"]
[Annotator "1. +0.02 1... +0.25"]

1. Nc3 {+0.02/6} d6 {+0.25/9 8} 2. Nf3 {+0.54/6 4} Nf6 {+0.23/9 13} 3. e4
{+0.83/6 6} c6 {+0.10/9 11} 4. Be2 {+1.34/5 2.7} Nbd7 {-0.14/9 6} 5. O-O
{+1.33/5 2.9} g6 {-0.04/10 6} 6. Nd4 {+1.24/5 3} Bg7 {+0.09/10 12} 7. d3
{+0.25/5 4} O-O {+0.18/9 4} 8. Bg5 {-0.11/5 6} Qb6 {+0.12/9 6} 9. Nb3
{-0.14/5 2.9} Ne5 {+0.02/9 6} 10. d4 {+0.48/5 1.9} Ned7 {-0.14/10 8} 11.
Bxf6 {+0.27/5 6} Nxf6 {+0.45/10 5} 12. f4 {+0.10/5 6} h5 {+0.50/10 16} 13.
Rc1 {+0.12/4 2.5} Be6 {+0.51/9 5} 14. Na4 {+0.24/5 5} Qb4 {+0.62/10 6} 15.
Nc3 {+0.16/5 5} Bxb3 {+0.59/10 4} 16. cxb3 {-0.44/5 2.6} Ng4 {+0.68/11 15}
17. Bc4 {-0.81/5 4} Qb6 {+1.99/10 5} 18. Na4 {-1.33/5 4} Qxd4+ {+3.22/12 4}
19. Qxd4 {-3.00/7 4} Bxd4+ {+3.27/12 7} 20. Kh1 {-3.50/7 6} b5 {+2.98/12 5}
21. Rcd1 {-3.78/6 4} Nf2+ {+4.38/13 4} 22. Rxf2 {-3.95/7 4} Bxf2
{+4.43/13 5} 23. Rd2 {-5.05/6 2.4} Be3 {+5.18/13 4} 24. Re2 {-5.58/6 2.3}
Bxf4 {+5.19/13 5} 25. Rf2 {-5.89/6 2.4} Be5 {+5.27/13 7} 26. Rxf7
{-6.73/6 5} bxc4 {+6.87/15 5} 27. Rf3 {-6.73/7 3} cxb3 {+7.09/15 12} 28.
axb3 {-7.55/7 3} Rxf3 {+7.75/16 4} 29. gxf3 {-7.94/9 4} Rb8 {+7.48/16 5}
30. Kg2 {-8.17/9 5} Rxb3 {+8.15/15 3} 31. Kf2 {-8.18/9 8} Bxh2 {+8.43/16 6}
32. Kg2 {-8.38/8 4} Be5 {+9.10/16 4} 33. Kf2 {-8.57/8 4} Rb4 {+10.82/17 15}
34. b3 {-10.51/8 9} Rxb3 {+11.63/17 5} 35. f4 {-10.92/8 4} Bxf4
{+12.92/16 4} 36. Kg2 {-11.34/8 14} h4 {+19.32/17 5} 37. Nc3 {-17.42/8 2.7}
Rxc3 {+79.93/18 3} 38. Kg1 {-21.80/10 10} Rc2 {+79.95/12 3} 39. e5
{-21.79/10 2.1} h3 {+79.96/27 3}
{White resigns} 0-1
[/pgn]

Note: this is a version where I have added a few patches to help it along, like LMR (questionably sound at the moment) and making the TT move before any others. You can see my patches at https://github.com/ZirconiumX/sunfish (shameless plug).

Matthew:out
Well, this year is a little fish , the next will be a PYTHON+SHARK !!!!! :lol:

Thank YOU a lot, ZirconiumX !
SilvianR :wink:
No problem - it's one of the few engines I can play with under the Great Firewall of School.

It's pretty strong for its size. I don't think Python was designed for something like this, since I can wring out of vanilla python 12.5KNPS. This is opposed to the 4MNPS that SFDD gets.

Matthew:out
tu ne cede malis, sed contra audentior ito
User avatar
Sylwy
Posts: 4793
Joined: Fri Apr 21, 2006 4:19 pm
Location: IAȘI - the historical capital of MOLDOVA
Full name: Silvian Rucsandescu

Re: Increasing the performances !

Post by Sylwy »

ZirconiumX wrote: I don't think Python was designed for something like this, since I can wring out of vanilla python 12.5KNPS. This is opposed to the 4MNPS that SFDD gets.

Matthew:out
Agreed ! That's because of it is very interesting !

SilvianR :wink:
User avatar
Sylwy
Posts: 4793
Joined: Fri Apr 21, 2006 4:19 pm
Location: IAȘI - the historical capital of MOLDOVA
Full name: Silvian Rucsandescu

Re: A new version is out !

Post by Sylwy »

https://github.com/thomasahle/sunfish/a ... master.zip

(code cleaned up mainly).

THANK YOU , Thomas !

SilvianR :wink:
drowsy
Posts: 14
Joined: Thu Nov 06, 2008 5:34 am

Re: A new version is out !

Post by drowsy »

[Event "?"]
[Site "?"]
[Date "2014.03.09"]
[Round "?"]
[White "me"]
[Black "Sunfish"]
[Result "1-0"]

1. d4 Nf6 2. c4 Nc6 3. Nc3 d5 4. cxd5 Nxd5 5. e4 Nxc3 6. bxc3 f5 7. Bd3 e5 8. exf5 exd4 9. Qh5+ Kd7 10. Ne2 dxc3 11. O-O Bb4 12. Rd1 Qf6 13. Bg5 Qf8 14. Nxc3 Bd6 15. Ne4 h6 16. Bh4 Nd4 17. f6 gxf6 18. Nxf6+ Kc6 19. Qd5+ Kb6 20. Rab1+ Bb4 21. Qxd4+ Ka5 22. a3 Be1 23. Rb5+ *

You won

Hehe, beat it on the first try.
drowsy
Posts: 14
Joined: Thu Nov 06, 2008 5:34 am

Re: A new version is out !

Post by drowsy »

The second game.

[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "Toporov"]
[Black "Sunfish"]
[Result "1-0"]

1. e4 Nf6 2. e5 Ne4 3. d3 Nc5 4. d4 Ne6 5. Nf3 d5 6. Be2 Nd7 7. O-O c5 8. c3 f6 9. Be3 fxe5 10. dxe5 Qb6 11. Qxd5 Qxb2 12. Nbd2 Nb6 13. Qe4 Qxc3 14. Rfc1 Qb2 15. Rab1 Qxa2 16. Ng5 Nxg5 17. Bxg5 e6 18. Bh5+ g6 19. Bxg6+ hxg6 20. Qxg6+ Kd7 21. Qf7+ Kc6 22. Bd8 Nd5 23. Nb3 Bd7 24. Nd4# *
User avatar
Sylwy
Posts: 4793
Joined: Fri Apr 21, 2006 4:19 pm
Location: IAȘI - the historical capital of MOLDOVA
Full name: Silvian Rucsandescu

Re: My final opinion about Sunfish 12_03_2014

Post by Sylwy »

Tоварищами,

The best chess engine written in Python ever (working in Windows) !
An attacker in its class !
After a lot of tests, at various TCs and opponents, I think this version is equal with Talvmenni 0.1 (1059 ELO CCRL_4_40) !

Have a nice day !

SilvianR :wink:

Image