X-Git-Url: https://git.auder.net/doc/html/img/rock_paper_scissors_lizard_spock.gif?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCwda.js;h=40127208b7a22b2fcc00fce2bf8124d0f27f2d37;hb=f25f375ad0ee4797277510aab55fdb632adfde50;hp=c5ecf092e64fdab34db0972608efd0c8786fd310;hpb=74afb57db5e15af26de042ba3f70f3409f13cb5f;p=vchess.git
diff --git a/client/src/variants/Cwda.js b/client/src/variants/Cwda.js
index c5ecf092..40127208 100644
--- a/client/src/variants/Cwda.js
+++ b/client/src/variants/Cwda.js
@@ -192,6 +192,30 @@ export class CwdaRules extends ChessRules {
);
}
+ getEpSquare(moveOrSquare) {
+ if (!moveOrSquare) return undefined; //TODO: necessary line?!
+ if (typeof moveOrSquare === "string") {
+ const square = moveOrSquare;
+ if (square == "-") return undefined;
+ return V.SquareToCoords(square);
+ }
+ // Argument is a move:
+ const move = moveOrSquare;
+ const s = move.start,
+ e = move.end;
+ if (
+ s.y == e.y &&
+ Math.abs(s.x - e.x) == 2 &&
+ ['p', 'u', 'v'].includes(move.appear[0].p)
+ ) {
+ return {
+ x: (s.x + e.x) / 2,
+ y: s.y
+ };
+ }
+ return undefined; //default
+ }
+
getPotentialMovesFrom(sq) {
switch (this.getPiece(sq[0], sq[1])) {
case V.C_ROOK: return this.getPotentialC_rookMoves(sq);
@@ -572,4 +596,11 @@ export class CwdaRules extends ChessRules {
return 2;
}
+ getNotation(move) {
+ let notation = super.getNotation(move);
+ if (['u', 'v'].includes(move.appear[0].p))
+ notation = notation.slice(0, -2);
+ return notation;
+ }
+
};