X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCheckered.js;h=bca365d097a11a374d499244cbe5aefe0a1c3539;hb=57d9b2c4f08948bd5a5fc4a01a0b62d4c80523e2;hp=799c3e548f320e2bf957c62d3bce872f09ffa2b3;hpb=2f9fcef3eb606c6389249c35393265de7d8f392f;p=vchess.git diff --git a/client/src/variants/Checkered.js b/client/src/variants/Checkered.js index 799c3e54..bca365d0 100644 --- a/client/src/variants/Checkered.js +++ b/client/src/variants/Checkered.js @@ -429,37 +429,25 @@ export class CheckeredRules extends ChessRules { return "0-0"; } - // Translate final square const finalSquare = V.CoordsToSquare(move.end); - const piece = this.getPiece(move.start.x, move.start.y); + let notation = ""; if (piece == V.PAWN) { // Pawn move - let notation = ""; if (move.vanish.length > 1) { // Capture const startColumn = V.CoordToColumn(move.start.y); - notation = - startColumn + - "x" + - finalSquare + - "=" + - move.appear[0].p.toUpperCase(); - } //no capture - else { - notation = finalSquare; - if (move.appear.length > 0 && piece != move.appear[0].p) - //promotion - notation += "=" + move.appear[0].p.toUpperCase(); - } - return notation; + notation = startColumn + "x" + finalSquare; + } else notation = finalSquare; + } else { + // Piece movement + notation = + piece.toUpperCase() + + (move.vanish.length > 1 ? "x" : "") + + finalSquare; } - // Piece movement - return ( - piece.toUpperCase() + - (move.vanish.length > 1 ? "x" : "") + - finalSquare + - (move.vanish.length > 1 ? "=" + move.appear[0].p.toUpperCase() : "") - ); + if (move.appear[0].p != move.vanish[0].p) + notation += "=" + move.appear[0].p.toUpperCase(); + return notation; } };