Closed mkondel closed 6 years ago
Same issue for me, as I saw in the code, the parser is not ready, nor the available moves report castling :-( Time for a fork ;-)
I can fix this. For a start, it appears all the +
and -
symbols are backwards, although then the game crashes (during my testing the AI played Ng4xh2 just before this!):
Making move : Nxh2
a b c d e f g h
8 R N B Q K B x R 8
7 p p p p p p p p 7
6 x x x x x x x x 6
5 x x x x x x x x 5
4 x x x x x x x x 4
3 x x x x x x p x 3
2 p p p p p p B N 2
1 R N B Q K x x R 1
a b c d e f g h
AI thinking...
Making move : a5
a b c d e f g h
8 R N B Q K B x R 8
7 x p p p p p p p 7
6 x x x x x x x x 6
5 p x x x x x x x 5
4 x x x x x x x x 4
3 x x x x x x p x 3
2 p p p p p p B N 2
1 R N B Q K x x R 1
a b c d e f g h
Traceback (most recent call last):
File "src/main.py", line 130, in <module>
startGame(board, playerSide, opponentAI)
File "src/main.py", line 78, in startGame
if board.isCheckmate():
File "/home/lila/command-line-chess/src/Board.py", line 125, in isCheckmate
if len(self.getAllMovesLegal(self.currentSide)) == 0:
File "/home/lila/command-line-chess/src/Board.py", line 411, in getAllMovesLegal
if self.moveIsLegal(move):
File "/home/lila/command-line-chess/src/Board.py", line 401, in moveIsLegal
self.makeMove(move)
File "/home/lila/command-line-chess/src/Board.py", line 332, in makeMove
self.movePieceToPosition(rookToMove, move.rookMovePos)
AttributeError: 'Move' object has no attribute 'rookMovePos'
Fixing makeMove
then results in command l
being able to list the move, although I can't play O-O
.
It's your move. Type '?' for options. ? O-O
Couldn't parse input, enter a valid command or move.
a b c d e f g h
8 R x B Q K B N R 8
7 p x p p p p x p 7
6 N p x x x x x x 6
5 x x x x x x p x 5
4 x x x x x x x x 4
3 x x x x x N p x 3
2 p p p p p p B p 2
1 R N B Q K x x R 1
a b c d e f g h
Well done, thanks for that first patch ;-)
Glad to submit a patch the entire community may benefit from!
Just as an example, here is the board, player is white. As you can see, castling is not in the list of possible moves. There is a Board.getShortNotationOfMove() that should return '0-0-0' and '0-0', but move.kingsideCastle and move.queensideCastle are not getting recognized at that point.