X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FKoopa.js;h=3f2e855ad2ddf5965067498f996074907afcbd7d;hp=f24e5b2f995f74855bb2471074dcd7a1fdbfade9;hb=e50a802531b99829c533f22ecd21e359e7e1e049;hpb=204b0bb5dc8b5f2760fcbf60cc23deb4552f4305 diff --git a/client/src/variants/Koopa.js b/client/src/variants/Koopa.js index f24e5b2f..3f2e855a 100644 --- a/client/src/variants/Koopa.js +++ b/client/src/variants/Koopa.js @@ -49,11 +49,9 @@ export class KoopaRules extends ChessRules { } getStunnedFen() { - return ( - Object.keys(this.stunned) - .map(square => square + this.stunned[square]) - .join(",") - ); + const squares = Object.keys(this.stunned); + if (squares.length == 0) return "-"; + return squares.map(square => square + this.stunned[square]).join(","); } // Base GenRandInitFen() is fine because en-passant indicator will @@ -80,7 +78,7 @@ export class KoopaRules extends ChessRules { this.INIT_COL_KING["w"] = k; break; default: { - const num = parseInt(fenRows[i].charAt(j)); + const num = parseInt(fenRows[i].charAt(j), 10); if (!isNaN(num)) k += num - 1; } } @@ -100,7 +98,7 @@ export class KoopaRules extends ChessRules { .map(s => { return { square: s.substr(0, 2), - state: parseInt(s[2]) + state: parseInt(s[2], 10) }; }); }