From 7993a7d66143ca4f3f951a51a23b11c191d39a14 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Tue, 9 Jun 2026 23:57:00 +0200 Subject: [PATCH] Emergo seems ok --- variants/Emergo/class.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/variants/Emergo/class.js b/variants/Emergo/class.js index 4eb5cdf..cf6db87 100644 --- a/variants/Emergo/class.js +++ b/variants/Emergo/class.js @@ -417,9 +417,10 @@ export default class EmergoRules extends ChessRules { getBasicMove([x1, y1], [x2, y2], capt) { const cp1 = this.board[x1][y1]; if (!capt) { + const color = this.getColor(x1, y1); return new Move({ - appear: [ new PiPo({ x: x2, y: y2, c: cp1[0], p: cp1[1] }) ], - vanish: [ new PiPo({ x: x1, y: y1, c: cp1[0], p: cp1[1] }) ] + appear: [ new PiPo({ x: x2, y: y2, c: color, p: cp1 }) ], + vanish: [ new PiPo({ x: x1, y: y1, c: color, p: cp1 }) ] }); } // Compute resulting types based on jumped + jumping pieces @@ -560,8 +561,6 @@ export default class EmergoRules extends ChessRules { getPotentialMovesFrom([x, y]) { const longestCaptures = this.getAllLongestCaptures(this.getColor(x, y)); - -console.log(longestCaptures); return this.getPossibleMovesFrom([x, y], longestCaptures); } @@ -569,6 +568,19 @@ console.log(longestCaptures); return moves; } + playOnBoard(move) { + for (let psq of move.vanish) + this.board[psq.x][psq.y] = ""; + for (let psq of move.appear) + this.board[psq.x][psq.y] = psq.p; + } + undoOnBoard(move) { + for (let psq of move.appear) + this.board[psq.x][psq.y] = ""; + for (let psq of move.vanish) + this.board[psq.x][psq.y] = psq.p; + } + play(move) { const color = this.turn; this.playOnBoard(move); -- 2.53.0