Commit 07e3c77
committed
Fixed a bug that missed having a legal move for White in a rare case.
The WhiteCanMove() function returned false (i.e. saying that White
did not have any legal moves) in the rare case where the only
legal move was an en passant capture toward White's left.
The problem was testing (board[x] == BP_MASK) instead of
(board[x] & BP_MASK). The piece bit mask is only part of the
data inside Chenard's representation of a square on the board.
I discovered this while generating unit test data for my new
C# chess engine "Gearbox". Ironically, Gearbox got it right
and Chenard got it wrong.
It has been a long time since I found a bug in Chenard!1 parent 4994c8c commit 07e3c77
1 file changed
+5
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
| 161 | + | |
163 | 162 | | |
164 | 163 | | |
165 | 164 | | |
| |||
171 | 170 | | |
172 | 171 | | |
173 | 172 | | |
174 | | - | |
175 | | - | |
176 | | - | |
| 173 | + | |
| 174 | + | |
177 | 175 | | |
178 | 176 | | |
179 | 177 | | |
| |||
640 | 638 | | |
641 | 639 | | |
642 | 640 | | |
643 | | - | |
644 | | - | |
| 641 | + | |
645 | 642 | | |
646 | 643 | | |
647 | 644 | | |
| |||
653 | 650 | | |
654 | 651 | | |
655 | 652 | | |
656 | | - | |
657 | | - | |
| 653 | + | |
658 | 654 | | |
659 | 655 | | |
660 | 656 | | |
| |||
0 commit comments