From: Benjamin Auder Date: Wed, 22 Apr 2020 13:09:37 +0000 (+0200) Subject: Fix Gridolina isAttacked() X-Git-Url: https://git.auder.net/images/pieces/img/current/gitweb.css?a=commitdiff_plain;h=fa74f6247c0360fe49140c4d5f515a05c600499e;p=vchess.git Fix Gridolina isAttacked() --- diff --git a/TODO b/TODO index 886aaf38..3c6a3ac6 100644 --- a/TODO +++ b/TODO @@ -10,6 +10,10 @@ https://www.chessvariants.com/crossover.dir/koopachess.html --> Can a stunned piece capture? Maybe not. ...recover? After 5 moves? Never? + Chakart :) +Name ? +you need to win all the pawns to win the game +kings are not royal + https://www.chessvariants.com/diffmove.dir/checkers.html --> "Forward" in 1974 by Hans Multhopp diff --git a/client/src/variants/Chakart.js b/client/src/variants/Chakart.js index a1caed45..8c0a837d 100644 --- a/client/src/variants/Chakart.js +++ b/client/src/variants/Chakart.js @@ -32,7 +32,7 @@ export class ChakartRules extends ChessRules { // dessus une pièce immédiatement adjacente (en atterissant juste derrière). } - // Coups en 2 temps (si pose) + // Coups en 2 temps (si pose possible) getPotentialRookMoves(sq) { //Donkey : tour // pose une banane (optionnel) sur une case adjacente (diagonale) à celle d'arrivée diff --git a/client/src/variants/Gridolina.js b/client/src/variants/Gridolina.js index fd43be3f..797190cd 100644 --- a/client/src/variants/Gridolina.js +++ b/client/src/variants/Gridolina.js @@ -34,4 +34,24 @@ export class GridolinaRules extends BerolinaRules { }) ); } + + isAttackedBySlideNJump([x, y], color, piece, steps, oneStep) { + for (let step of steps) { + let rx = x + step[0], + ry = y + step[1]; + while (V.OnBoard(rx, ry) && this.board[rx][ry] == V.EMPTY && !oneStep) { + rx += step[0]; + ry += step[1]; + } + if ( + V.OnBoard(rx, ry) && + this.getPiece(rx, ry) == piece && + this.getColor(rx, ry) == color && + V.OnDifferentGrids([x, y], [rx, ry]) + ) { + return true; + } + } + return false; + } };