ichabod801 / t_games

A collection of command-line interface games written in Python.
GNU General Public License v3.0
20 stars 4 forks source link

Chess Disambiguation Not Working #563

Closed ichabod801 closed 4 years ago

ichabod801 commented 4 years ago

Note the following sequence in a game of chess:

What is your move? Rac8
Rac8 is not a legal move.

 1 R . . . . . . .
 2 P P K . . . . .
 3 . . N P P P Q P
 4 . . B . . . . .
 5 . . . . p p . q
 6 . . . p . B n p
 7 p p p . . . . .
 8 . k r . . . . r
   H G F E D C B A

What is your move? a8c8

 1 R . . . . . . .
 2 P P K . . . . .
 3 . . N P P P Q P
 4 . . B . . . . .
 5 . . . . p p . q
 6 . . . p . B n p
 7 p p p . . . . .
 8 . k r . . r . .
   H G F E D C B A

Paul's move is c6b7.

 1 R . . . . . . .
 2 P P K . . . . .
 3 . . N P P P Q P
 4 . . B . . . . .
 5 . . . . p p . q
 6 . . . p . . n p
 7 p p p . . . B .
 8 . k r . . r . .
   H G F E D C B A

What is your move? Rcd8

 1 R . . . . . . .
 2 P P K . . . . .
 3 . . N P P P Q P
 4 . . B . . . . .
 5 . . . . p p . q
 6 . . . p . . n p
 7 p p p . . . B .
 8 . k . . r r . .
   H G F E D C B A

Paul's move is b7c8.

 1 R . . . . . . .
 2 P P K . . . . .
 3 . . N P P P Q P
 4 . . B . . . . .
 5 . . . . p p . q
 6 . . . p . . n p
 7 p p p . . . . .
 8 . k . . r B . .
   H G F E D C B A

First it wouldn't let me do Rac8, an obviously legal move that was then done with a8c8. Then when I tried to do Rcd8, it instead moved Rfd8. Maybe it has the columns backward because it's black? So the a disambiguation is checked in h, which no rook. Then the c disambiguation is checked in f and the wrong rook is moved.

ichabod801 commented 4 years ago

Added conversions of the disambiguation variables for when the player is black. Tested it for rows and columns for both black and white.

ichabod801 commented 4 years ago

Whoops, the commit with the fix is 74163ab (added under issue #536 instead of this one).