X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FAlice.js;h=a15c30c3002c03028194378ec5c1174e7d35a9c7;hb=0f51ef985c094530a63d242dddf514e66d23959b;hp=3d79580fd7977c92effb4046e39c9ddd1e531726;hpb=9de73b71a1db5464f89a202e6cdfdc7b6b6b0753;p=vchess.git diff --git a/public/javascripts/variants/Alice.js b/public/javascripts/variants/Alice.js index 3d79580f..a15c30c3 100644 --- a/public/javascripts/variants/Alice.js +++ b/public/javascripts/variants/Alice.js @@ -189,31 +189,6 @@ class AliceRules extends ChessRules this.kingPos[c] = [move.start.x, move.start.y]; } - getNotation(move) - { - if (move.appear.length == 2 && move.appear[0].p == VariantRules.KING) - { - if (move.end.y < move.start.y) - return "0-0-0"; - else - return "0-0"; - } - - const finalSquare = - String.fromCharCode(97 + move.end.y) + (VariantRules.size[0]-move.end.x); - const piece = this.getPiece(move.start.x, move.start.y); - - // Piece or pawn movement - let notation = piece.toUpperCase() + - (move.vanish.length > move.appear.length ? "x" : "") + finalSquare; - if (['s','p'].includes(piece) && !['s','p'].includes(move.appear[0].p)) - { - // Promotion - notation += "=" + move.appear[0].p.toUpperCase(); - } - return notation; - } - checkGameEnd() { const color = this.turn; @@ -245,4 +220,33 @@ class AliceRules extends ChessRules 'l': 1000 }; } + + getNotation(move) + { + if (move.appear.length == 2 && move.appear[0].p == VariantRules.KING) + { + if (move.end.y < move.start.y) + return "0-0-0"; + else + return "0-0"; + } + + const finalSquare = + String.fromCharCode(97 + move.end.y) + (VariantRules.size[0]-move.end.x); + const piece = this.getPiece(move.start.x, move.start.y); + + const captureMark = (move.vanish.length > move.appear.length ? "x" : ""); + let pawnMark = ""; + if (["p","s"].includes(piece) && captureMark.length == 1) + pawnMark = String.fromCharCode(97 + move.start.y); //start column + + // Piece or pawn movement + let notation = piece.toUpperCase() + pawnMark + captureMark + finalSquare; + if (['s','p'].includes(piece) && !['s','p'].includes(move.appear[0].p)) + { + // Promotion + notation += "=" + move.appear[0].p.toUpperCase(); + } + return notation; + } }