From: Benjamin Auder Date: Wed, 24 Jun 2026 22:44:09 +0000 (+0200) Subject: Initiale refactoring --> getPotentialMove_s(start, end) X-Git-Url: https://git.auder.net/app_dev.php/scripts/doc/html/pieces/cb.svg?a=commitdiff_plain;h=HEAD;p=xogo.git Initiale refactoring --> getPotentialMove_s(start, end) --- diff --git a/js/base_rules.js b/js/base_rules.js index a6c2c59..c3daac7 100644 --- a/js/base_rules.js +++ b/js/base_rules.js @@ -972,8 +972,7 @@ export default class ChessRules { (landingElt ? this.idToCoords(landingElt.id) : undefined); if (cd) { // NOTE: clearly suboptimal, but much easier, and not a big deal. - const potentialMoves = this.getPotentialMovesFrom([x, y]) - .filter(m => m.end.x == cd.x && m.end.y == cd.y); + const potentialMoves = this.getPotentialMove_s([x, y], [cd.x, cd.y]); const moves = this.filterValid(potentialMoves); if (moves.length >= 2) this.showChoices(moves, r);