X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FSuction.js;h=297eef75e2b9c37579534289edf44c22fa7db900;hp=38ee5c2e0b3589a9bd0006efd7b8d47746fd3f17;hb=71ef1664983cd58db3c3bbfdf6cb7c362474e9a5;hpb=e3e2cc443054cfb273b28b3ba46f559117c5ceae diff --git a/client/src/variants/Suction.js b/client/src/variants/Suction.js index 38ee5c2e..297eef75 100644 --- a/client/src/variants/Suction.js +++ b/client/src/variants/Suction.js @@ -236,4 +236,28 @@ export const VariantRules = class SuctionRules extends ChessRules { // Very simple criterion for now: kings position return this.kingPos["w"][0] + this.kingPos["b"][0]; } + + getNotation(move) { + // Translate final square + const finalSquare = V.CoordsToSquare(move.end); + + const piece = this.getPiece(move.start.x, move.start.y); + if (piece == V.PAWN) { + // Pawn move + let notation = ""; + if (move.vanish.length == 2) { + // Capture + const startColumn = V.CoordToColumn(move.start.y); + notation = startColumn + "x" + finalSquare; + } + else notation = finalSquare; + return notation; + } + // Piece movement + return ( + piece.toUpperCase() + + (move.vanish.length == 2 ? "x" : "") + + finalSquare + ); + } };