Initiale refactoring --> getPotentialMove_s(start, end) main
authorBenjamin Auder <benjamin.auder@somewhere>
Wed, 24 Jun 2026 22:44:09 +0000 (00:44 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Wed, 24 Jun 2026 22:44:09 +0000 (00:44 +0200)
js/base_rules.js

index a6c2c59..c3daac7 100644 (file)
@@ -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);