SUNFISH - a new chess engine written in Python !

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

Moderators: hgm, Rebel, chrisw

User avatar
Sylwy
Posts: 4467
Joined: Fri Apr 21, 2006 4:19 pm
Location: IASI - the historical capital of MOLDOVA
Full name: SilvianR

SUNFISH - a new chess engine written in Python !

Post by Sylwy »

Hello CCC folks !

Like I promised ! :lol:

Author: Mr.Thomas Dybdahl Ahle/Denmark.

Only 111 lines of code ! About:

Image

Mr. Tord Romstad about it:

Image

http://www.reddit.com/r/programming/com ... in_python/

Run it in Winboard GUI using pypy !

Two logos Ruxy copyrighted:

Image

Image

Ruxy vs. Sunfish some minutes ago:

Image

Download link:

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

Have a superb day & night !

SilvianR :wink:
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: SUNFISH - a new chess engine written in Python !

Post by zullil »

Sylwy wrote:Hello CCC folks !

Like I promised ! :lol:

Author: Mr.Thomas Dybdahl Ahle/Denmark.

Only 111 lines of code ! :
Looks interesting. Has a hash table, but no qsearch.
User avatar
Sylwy
Posts: 4467
Joined: Fri Apr 21, 2006 4:19 pm
Location: IASI - the historical capital of MOLDOVA
Full name: SilvianR

Re: Chess written in Python for this weekend !

Post by Sylwy »

Hello folks !

The weekend is imminent. Some computer chess material written in Python. All originals. The authors even don't know about WB or UCI communication protocols. They are all native chess apps. Play (or autoplay for amusement) in console-mode. For example Mastah 0.5 is super !!! You need a Pyton interpreter (2.7/3.3) installed on your machine:

http://www.python.org/ftp/python/3.3.4/ ... .amd64.msi
http://www.python.org/ftp/python/2.7.6/ ... .amd64.msi

Hello ComputerChessWiki !

The links:

=========================
1.-ChessMastah_05

https://sites.google.com/site/marsarsit ... ects=0&d=1

2.-Smash

https://github.com/duilio/smashpy

3.-Python-chess

https://github.com/niklasf/python-chess

4.-Python-chess 0.0.5

https://pypi.python.org/pypi/python-chess
========================

Have - you all - a fantastic weekend !

SilvianR :wink:
Bram Visser
Posts: 52
Joined: Wed Oct 19, 2011 3:37 pm
Location: NL

Re: SUNFISH - a new chess engine written in Python !

Post by Bram Visser »

Very nice, thanks for engine and the link :D .
Norbert Raimund Leisner
Posts: 1643
Joined: Tue May 20, 2008 4:57 pm
Location: Augsburg - Germany

Re: SUNFISH - a new chess engine written in Python !

Post by Norbert Raimund Leisner »

Hello Silvian,

I added Chess Mastah , Smashpy and Python Chess Library to
"Native Engine List" of CCWiki. :D

Sunfish
I have installed Python 2.7.6 ttp://www.python.org/download/releases/2.7.6/ and PyPy 2.2.1 win32 http://pypy.org/download.html on my Intel Core 2 Duo E6600 with Windows XP SP3-32 bit OS.

With Notepad++ http://notepad-plus-plus.org/ a .bat -file like
python -u test.py
can be created - but in two 5 min-games under Arena-GUI Sunfish executes only moves with the black pieces and after 1.e4 Nc6 2.d4 e5 4.Nf3 Nf6 4.Nc3 the program forfeits because of time exceeding (no further moves were made)

It would be surely a good idea to publish a step-by-step manual for running Sunfish into external graphical interfaces.

Best wishes,
Norbert : :!:
Norbert Raimund Leisner
Posts: 1643
Joined: Tue May 20, 2008 4:57 pm
Location: Augsburg - Germany

Re: SUNFISH - a new chess engine written in Python !

Post by Norbert Raimund Leisner »

User avatar
Sylwy
Posts: 4467
Joined: Fri Apr 21, 2006 4:19 pm
Location: IASI - the historical capital of MOLDOVA
Full name: SilvianR

Re: SUNFISH - a new chess engine written in Python !

Post by Sylwy »

Norbert Raimund Leisner wrote:
1.-I added Chess Mastah , Smashpy and Python Chess Library to
"Native Engine List" of CCWiki. :D

Sunfish

2.-It would be surely a good idea to publish a step-by-step manual for running Sunfish into external graphical interfaces.



Hello Norbert !

1.-THANK YOU !
2.-I'll try this weekend to make one ( but in my poor semi-English :lol:) !

Best to you !
SilvianR :wink:

PS: Sunfish works super in console mode ! No Winboard GUI or Arena GUI. "Somebody" just wait for....to accuse me for new voltages in Winboard/Arena relations (maybe a war..... :roll: ) !
thomasahle
Posts: 94
Joined: Thu Feb 27, 2014 8:19 pm

Re: SUNFISH - a new chess engine written in Python !

Post by thomasahle »

Hey guys, thanks for bringing this up. I pushed a new module to github, which adds better cecp/xboard/wb support. It also fixes the hang Nobert was talking about.

I would love to add qsearch to sunfish. Right now horizontal effects make it blunder pretty badly in some positions. I'm not sure what the simplest way to do it would be though.

I also made some graphics inspired by Ruxy:
Image
Image
Adam Hair
Posts: 3226
Joined: Wed May 06, 2009 10:31 pm
Location: Fuquay-Varina, North Carolina

Re: SUNFISH - a new chess engine written in Python !

Post by Adam Hair »

Welcome to CCC, Thomas! And thanks for sharing your engine with us. I will be trying out Sunfish very soon.
Norbert Raimund Leisner
Posts: 1643
Joined: Tue May 20, 2008 4:57 pm
Location: Augsburg - Germany

Re: SUNFISH - a new chess engine written in Python !

Post by Norbert Raimund Leisner »

Yes, you can use Sunfish to play a console-based match with a double-mouse click on sunfish.py

your move: e2e4
searched 67590 nodes depth 6 score -107
my move: b6c6

your move: d2d4
searched 26472 nodes depth 5 score 160
my move: e7e5

your move: d4d5
searched 46168 nodes depth 5 score 101
my move: c6e7

etc.

But playing under WinBoard-protocol with a bat.-file python -u test.py
or python -u test.py -xboard failed with Arena http://www.playwitharena.com/ failed because no moves were made
(in contrast to yesterday) by the program


Be aware that you can run another Python Engine "Shatranj"
https://code.google.com/p/shatranjpy/ with a .bat-file like
python -u shatranj117.py -xboard to run normally into the same interface (with Python 2.7.6) and an editor like Notepad++


Best wishes,
Norbert