Fix: Rooks going up didn't consider the topleft square

master
Dany Thach 2025-02-27 22:39:46 +01:00
parent 49d8d675d4
commit 943aab1a14
2 changed files with 2 additions and 2 deletions

View File

@ -203,7 +203,7 @@ class _LegalMovesBlack {
// up
bool hasEncounteredPiece = false;
int j = i-8;
while (!hasEncounteredPiece && j > 0) {
while (!hasEncounteredPiece && j >= 0) {
if (Piece.emptySquare == position.board[j]) {
yield ("${Position.squareIndexToString(i)}${Position.squareIndexToString(j)}", Position.from(position)..playMoveIndices(i, j));
} else {

View File

@ -203,7 +203,7 @@ class _LegalMovesWhite {
// up
bool hasEncounteredPiece = false;
int j = i-8;
while (!hasEncounteredPiece && j > 0) {
while (!hasEncounteredPiece && j >= 0) {
if (Piece.emptySquare == position.board[j]) {
yield ("${Position.squareIndexToString(i)}${Position.squareIndexToString(j)}", Position.from(position)..playMoveIndices(i, j));
} else {