X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FSuction.js;h=297eef75e2b9c37579534289edf44c22fa7db900;hb=e3ef199cdac142f1ca14fa6ceb259eb380f63929;hp=38ee5c2e0b3589a9bd0006efd7b8d47746fd3f17;hpb=241bf8f2a9a2c48d793aeb0b1d20207f6371de70;p=vchess.git 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 + ); + } };