New version of Sunfish
Moderator: Ras
-
Sven
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: Side note on Pypy
Maybe there is an undesired blank after the backslash at the end of the "print ..." line?
-
Guenther
- Posts: 4718
- Joined: Wed Oct 01, 2008 6:33 am
- Location: Regensburg, Germany
- Full name: Guenther Simon
Re: Side note on Pypy
Hi Sven, that was my first idea too, but there is no space at line end.
Here is the relevant code (which works invoking Python 2.7):
Here is the relevant code (which works invoking Python 2.7):
Code: Select all
class Move:
def __init__(self,from_square,to_square,move_name="",
captured_piece="",promoted_piece=""):
self.from_square = from_square
self.to_square = to_square
self.move_name = move_name
self.captured_piece = captured_piece
self.promoted_piece = promoted_piece
def __repr__(self):
print "Move: from square = %s to square = %s name = %s" % \
(bin2alg[self.from_square],bin2alg[self.to_square],self.move_name)
print " captured piece = %s promoted piece = %s" % \
(str(self.captured_piece),str(self.promoted_piece))
return("")-
Guenther
- Posts: 4718
- Joined: Wed Oct 01, 2008 6:33 am
- Location: Regensburg, Germany
- Full name: Guenther Simon
Re: Side note on Pypy
It seems I have found an answer which explains the behaviour:
source:
https://bbs.archlinux.org/viewtopic.php ... 4#p1385734
...really hate it that Python 3 has no backward compatibility.
@Thomas (Sunfish) will Sunfish also run with a pypy based on 2.7(9)?
I just want to get ridd off too much python or pypy installations when not needed.
Guenther
Code: Select all
print 80 * "*"
This is correct syntax for Python 2.
This is NOT correct syntax for Python 3. In Python 3, "print" is a function.https://bbs.archlinux.org/viewtopic.php ... 4#p1385734
...really hate it that Python 3 has no backward compatibility.
@Thomas (Sunfish) will Sunfish also run with a pypy based on 2.7(9)?
I just want to get ridd off too much python or pypy installations when not needed.
Guenther
-
gbtami
- Posts: 389
- Joined: Wed Sep 26, 2012 1:29 pm
- Location: Hungary
Re: Side note on Pypy
Seems you installed some old python3 version.Guenther wrote:After I successfully installed pypy on my machine I thought why not generalize my other python program installed,
which is Shatranj in a few versions. Before it was linked to a Python 2.7 installation which worked.
With pypy 3.21 I get the error below. Any idea? Or do I need an earleir pypy?
Code: Select all
0.000: - Starting server: C:/pypy321/pypy.exe -u C:/Engines/WB/Shatranj_117/Shatranj.py -xboard 0.016: - Priority class set to 16384 0.016: - Thread priority set to normal 0.250: < File "C:/Engines/WB/Shatranj_117/Shatranj.py", line 71 0.250: < print "Move: from square = %s to square = %s name = %s" % \ 0.250: < ^ 0.250: < SyntaxError: invalid syntax
Python3 is not compatible with Python2. For example in 3 print() is a function while in 2 print is a statement.
Try to install the latest Python2 version from here:
http://pypy.org/download.html#other-versions
-
thomasahle
- Posts: 94
- Joined: Thu Feb 27, 2014 8:19 pm
Re: New version of Sunfish
Good idea about using the extra fields for the free text. I'll look into that.
-
thomasahle
- Posts: 94
- Joined: Thu Feb 27, 2014 8:19 pm
Re: Side note on Pypy
As Tamás says, you are running python2 code with a python3 interpreter.Guenther wrote:After I successfully installed pypy on my machine I thought why not generalize my other python program installed,
which is Shatranj in a few versions. Before it was linked to a Python 2.7 installation which worked.
With pypy 3.21 I get the error below. Any idea? Or do I need an earleir pypy?
Code: Select all
0.000: - Starting server: C:/pypy321/pypy.exe -u C:/Engines/WB/Shatranj_117/Shatranj.py -xboard 0.016: - Priority class set to 16384 0.016: - Thread priority set to normal 0.250: < File "C:/Engines/WB/Shatranj_117/Shatranj.py", line 71 0.250: < print "Move: from square = %s to square = %s name = %s" % \ 0.250: < ^ 0.250: < SyntaxError: invalid syntax
I test Sunfish with python2, pypy2, python3 and pypy3. I recommend pypy3.
-
thomasahle
- Posts: 94
- Joined: Thu Feb 27, 2014 8:19 pm
Re: New version of Sunfish
I have a new version on github now, which fixes this.
-
Guenther
- Posts: 4718
- Joined: Wed Oct 01, 2008 6:33 am
- Location: Regensburg, Germany
- Full name: Guenther Simon
Re: Side note on Pypy
BTW you realize that the newest available pypy3 build for WIN is alreadygbtami wrote:
Seems you installed some old python3 version.
more than 2 years old (June 2014)?
No idea why they are stuck since then. I bet the info below is there since long.
Code: Select all
Windows binary (32bit) (hopefully availabe soon) -
Guenther
- Posts: 4718
- Joined: Wed Oct 01, 2008 6:33 am
- Location: Regensburg, Germany
- Full name: Guenther Simon
Re: New version of Sunfish
I downloaded it and now all is shown! I will run some test games under WBthomasahle wrote:I have a new version on github now, which fixes this.
against PyChess.
BTW I forgot to ask if you could add a version number or a time stamp
for each release? - for now I added the date to the according print function
in the xboard.py.
Code: Select all
e.g. print('feature myname="Sunfish_20160823"')
Last edited by Guenther on Tue Aug 23, 2016 12:16 pm, edited 1 time in total.
-
gbtami
- Posts: 389
- Joined: Wed Sep 26, 2012 1:29 pm
- Location: Hungary
Re: Side note on Pypy
I hope this will change next year.Guenther wrote:BTW you realize that the newest available pypy3 build for WIN is alreadygbtami wrote:
Seems you installed some old python3 version.
more than 2 years old (June 2014)?
No idea why they are stuck since then. I bet the info below is there since long.
Code: Select all
Windows binary (32bit) (hopefully availabe soon)
https://morepypy.blogspot.hu/2016/08/py ... a-for.html