From fbaf2c67f80ae9a26950a0754128f0e366aea862 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sat, 11 Jul 2009 18:20:56 -0700 Subject: [PATCH 1/1] fixed parser error for knight move The parser had a strange quirk: it recognized bd2 as a valid Knight move (Nb1-d2) while this SAN format should be reserved for Pawn moves only. --- parser.l | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/parser.l b/parser.l index 29a2fa9..0d60813 100755 --- a/parser.l +++ b/parser.l @@ -470,9 +470,13 @@ extern void CopyBoard P((Board to, Board from)); if (WhiteOnMove(yyboardindex)) { if (yytext[2+skip] == ONE) return (int) ImpossibleMove; currentMoveString[1] = yytext[2+skip] - 1; + if(boards[yyboardindex][currentMoveString[1]-ONE][currentMoveString[0]-AAA] != WhitePawn) + return ImpossibleMove; } else { currentMoveString[1] = currentMoveString[3] + 1; if (currentMoveString[3] == ONE+BOARD_HEIGHT-1) return (int) ImpossibleMove; + if(boards[yyboardindex][currentMoveString[1]-ONE][currentMoveString[0]-AAA] != BlackPawn) + return ImpossibleMove; } if (yyleng-skip > 3) { if (yytext[yyleng-1] == ')') -- 1.7.0.4