Jnrolfe / pychess

Automatically exported from code.google.com/p/pychess
GNU General Public License v3.0
0 stars 0 forks source link

parsing error #136

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
tamas@tami:~/svn$ p
/home/tamas/svn/pychess/lib/pychess/widgets/LogDialog.py:20: PangoWarning:
Error loading GPOS table 4097
  metrics = pango_ctx.get_metrics(font_desc)
/home/tamas/svn/pychess/lib/pychess/widgets/LogDialog.py:67: PangoWarning:
Error loading GPOS table 4097
  w.show_all()
Unhandled exception in thread started by <bound method CECProtocol.run of
<CECProtocol object (pychess+Players+CECP+CECProtocol) at 0xb64872ac>>
Traceback (most recent call last):
  File "/home/tamas/svn/pychess/lib/pychess/Players/CECP.py", line 271, in run
    self.parseLine(line)
  File "/home/tamas/svn/pychess/lib/pychess/Players/CECP.py", line 310, in
parseLine
    move = self.parseMove(movestr)
  File "/home/tamas/svn/pychess/lib/pychess/Players/CECP.py", line 283, in
parseMove
    except: return parseSAN(board, movestr)
  File "/home/tamas/svn/pychess/lib/pychess/Utils/Move.py", line 121, in
parseSAN
    if not notat: raise ParsingError, "Unable to parse sanmove '%s'" % san
pychess.Utils.Move.ParsingError: Unable to parse sanmove '='

Played with r326

Original issue reported on code.google.com by gbtami on 6 Jan 2007 at 3:18

Attachments:

GoogleCodeExporter commented 8 years ago
Can't produce with "Intermediate" or "Expert", only with "Beginner".

Original comment by gbtami on 6 Jan 2007 at 3:38

GoogleCodeExporter commented 8 years ago
The shortest triggering method of this bug to take a first move with "Beginner" 
white
player witch is not in the book.(f.e:Na3 or a4)

Original comment by gbtami on 6 Jan 2007 at 6:04

GoogleCodeExporter commented 8 years ago
The problem lies in PyChess.py
PyChess on easy will have sd=1.
When playing without time code looks like this:
mvs, scr = alphaBeta (table, history[-1], sd, -maxint, maxint)
but when playing with time, code is:
for depth in range(sd):
    mvs, scr = alphaBeta (table, history[-1], depth, -maxint, maxint)
Which causes PyChess to calculate until depth 0.
This means that move = mvs[0] will try to take move 0 from an empty list and 
fail.
This gives us the error in the log.
Then CECP.py try to parse the line as a move, and gives us "sanmove '='"

I think (and have testet) that the line should be changed to "for depth in
range(1,sd+1):"
I can commit it as soon as I get my svn working. If anybody else can commit it
earlier for testing, that would be great.

Original comment by lobais on 6 Jan 2007 at 6:48

GoogleCodeExporter commented 8 years ago
Tested with your suggested fix, and it's OK. thx

Original comment by gbtami on 6 Jan 2007 at 7:03

GoogleCodeExporter commented 8 years ago

Original comment by lobais on 10 Jan 2007 at 9:14