X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FSuction.js;h=0fc88ce431849089fb964172e69d79eb17897cae;hb=8d1fcc37a933554e13bc996b5611f8307a4701e8;hp=38ee5c2e0b3589a9bd0006efd7b8d47746fd3f17;hpb=241bf8f2a9a2c48d793aeb0b1d20207f6371de70;p=vchess.git diff --git a/client/src/variants/Suction.js b/client/src/variants/Suction.js index 38ee5c2e..0fc88ce4 100644 --- a/client/src/variants/Suction.js +++ b/client/src/variants/Suction.js @@ -189,9 +189,9 @@ export const VariantRules = class SuctionRules extends ChessRules { } } - static GenRandInitFen() { + static GenRandInitFen(randomness) { // Add empty cmove: - return ChessRules.GenRandInitFen() + " -"; + return ChessRules.GenRandInitFen(randomness) + " -"; } getFen() { @@ -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 + ); + } };