X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FJanggi.js;fp=client%2Fsrc%2Fvariants%2FJanggi.js;h=e22a786965c86c14f207178c7ba2052f856b1adf;hb=45d52e8a6a0faa784a545eae7b1ea551c3e8061b;hp=895e23ff06ce136ffbd2fcf3b8767a8873ae401e;hpb=2baa6f2c65b1d6289b3cf5fbc88bba2897cca58c;p=vchess.git diff --git a/client/src/variants/Janggi.js b/client/src/variants/Janggi.js index 895e23ff..e22a7869 100644 --- a/client/src/variants/Janggi.js +++ b/client/src/variants/Janggi.js @@ -35,10 +35,6 @@ export class JanggiRules extends ChessRules { return false; } - static get LoseOnRepetition() { - return true; - } - static get ELEPHANT() { return "e"; } @@ -110,9 +106,10 @@ export class JanggiRules extends ChessRules { // TODO: next "if" is mutually exclusive with the block above if (this.movesCount <= 1) { const firstRank = (this.movesCount == 0 ? 9 : 0); - const [initFile, destFile] = (this.subTurn == 1 ? [1, 2] : [7, 6]); + const initDestFile = new Map([[1, 2], [7, 6]]); // Only option is knight / elephant swap: - if (x == firstRank && y == initFile) { + if (x == firstRank && !!initDestFile.get(y)) { + const destFile = initDestFile.get(y); moves.push( new Move({ appear: [