X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FEightpieces.js;h=8cf8747aae2f385ee26cfd9805e6683eb7804ad3;hb=616561273f216debfeab7f5fc532d0b0a8bc8e2d;hp=a05ba1e220035b4d9644010b1b4c952e7c990b98;hpb=0a9cef131612079e55714f56f1466b4e2bd749af;p=vchess.git diff --git a/client/src/variants/Eightpieces.js b/client/src/variants/Eightpieces.js index a05ba1e2..8cf8747a 100644 --- a/client/src/variants/Eightpieces.js +++ b/client/src/variants/Eightpieces.js @@ -108,7 +108,7 @@ export class EightpiecesRules extends ChessRules { // 5) Check sentry push (if any) if ( fenParsed.sentrypush != "-" && - !fenParsed.sentrypush.match(/^([a-h][1-8],?)+$/) + !fenParsed.sentrypush.match(/^([a-h][1-8]){2,2}$/) ) { return false; } @@ -131,7 +131,7 @@ export class EightpiecesRules extends ChessRules { // Condensate path: just need initial and final squares: return [0, spL - 1] .map(i => V.CoordsToSquare(this.sentryPush[L-1][i])) - .join(","); + .join(""); } setOtherVariables(fen) { @@ -145,8 +145,8 @@ export class EightpiecesRules extends ChessRules { if (parsedFen.sentrypush == "-") this.sentryPush = [null]; else { // Expand init + dest squares into a full path: - const [init, dest] = - parsedFen.sentrypush.split(",").map(sq => V.SquareToCoords(sq)); + const init = V.SquareToCoords(parsedFen.sentrypush.substr(0, 2)), + dest = V.SquareToCoords(parsedFen.sentrypush.substr(2)); let newPath = [init]; const delta = ['x', 'y'].map(i => Math.abs(dest[i] - init[i])); // Check that it's not a knight movement: