From 943aab1a146b66efcc1739ead8335d51436dcab7 Mon Sep 17 00:00:00 2001 From: Dany Thach Date: Thu, 27 Feb 2025 22:39:46 +0100 Subject: [PATCH] Fix: Rooks going up didn't consider the topleft square --- lib/functions/_partials/legal_moves_black.dart | 2 +- lib/functions/_partials/legal_moves_white.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/functions/_partials/legal_moves_black.dart b/lib/functions/_partials/legal_moves_black.dart index 0a15e27..9be64d3 100644 --- a/lib/functions/_partials/legal_moves_black.dart +++ b/lib/functions/_partials/legal_moves_black.dart @@ -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 { diff --git a/lib/functions/_partials/legal_moves_white.dart b/lib/functions/_partials/legal_moves_white.dart index 460cea4..11ece7b 100644 --- a/lib/functions/_partials/legal_moves_white.dart +++ b/lib/functions/_partials/legal_moves_white.dart @@ -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 {