From: Benjamin Auder Date: Tue, 16 Feb 2021 22:04:38 +0000 (+0100) Subject: Fix Pandemonium + Janggi (first move) X-Git-Url: https://git.auder.net/js/img/current/vendor/parser.js?a=commitdiff_plain;h=7721a36a50b840b1dfe4cfaf5ed7abcbf525ffd5;p=vchess.git Fix Pandemonium + Janggi (first move) --- diff --git a/client/src/variants/Janggi.js b/client/src/variants/Janggi.js index 27342422..aecc8fe2 100644 --- a/client/src/variants/Janggi.js +++ b/client/src/variants/Janggi.js @@ -107,8 +107,12 @@ export class JanggiRules extends ChessRules { if (this.movesCount <= 1) { const firstRank = (this.movesCount == 0 ? 9 : 0); const initDestFile = new Map([[1, 2], [7, 6]]); - // Only option is knight / elephant swap: - if (x == firstRank && !!initDestFile.get(y)) { + // Only option is knight --> elephant swap: + if ( + x == firstRank && + !!initDestFile.get(y) && + this.getPiece(x, y) == V.KNIGHT + ) { const destFile = initDestFile.get(y); moves.push( new Move({ diff --git a/client/src/variants/Pandemonium.js b/client/src/variants/Pandemonium.js index 7795a7b1..f4ae3c44 100644 --- a/client/src/variants/Pandemonium.js +++ b/client/src/variants/Pandemonium.js @@ -287,8 +287,12 @@ export class PandemoniumRules extends ChessRules { const firstRank = (this.movesCount == 0 ? 9 : 0); // TODO: initDestFile currently hardcoded for deterministic setup const initDestFile = new Map([[1, 2], [8, 7]]); - // Only option is knight / bishop swap: - if (x == firstRank && !!initDestFile.get(y)) { + // Only option is knight --> bishop swap: + if ( + x == firstRank && + !!initDestFile.get(y) && + this.getPiece(x, y) == V.KNIGHT + ) { const destFile = initDestFile.get(y); return [ new Move({