From 7f1df0d95d2190fd69ef7c58f5a795aef3f92869 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Thu, 28 May 2020 23:13:50 +0200 Subject: [PATCH] Fix pawn promotions in Eightpieces --- TODO | 5 +++++ client/src/variants/Eightpieces.js | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 021a237e..86eb980d 100644 --- a/TODO +++ b/TODO @@ -29,6 +29,11 @@ Kingmaker: pawns can promote also into enemy king Eightkings: 8 pawns + 8 kings (non-royal until the last remains?) --> yes seems better, no king tracking + no underCheck/...etc when >= 2 kings +https://www.jatektan.hu/_2018_vissza/2011_ig/uj2001/isakk1.html +https://boardgamegeek.com/boardgame/18661/alapo +Alapo is a strategy game. Each player owns twelve abstract pieces, two each of six different kinds. Round pieces move in any of the eight directions on the 6 by 6 board; square pieces move only orthogonally and triangular pieces only diagonally. Large pieces move any distance, small pieces only one field per turn. +Opponent pieces can be eliminated by moving onto their position. The goal is to reach the opponent's base line with one of your pieces without the opponent being able to eliminate your piece in his/her next move. + ===== fanorona https://fr.wikipedia.org/wiki/Fanorona diff --git a/client/src/variants/Eightpieces.js b/client/src/variants/Eightpieces.js index 38f0d303..583b1c5a 100644 --- a/client/src/variants/Eightpieces.js +++ b/client/src/variants/Eightpieces.js @@ -406,12 +406,18 @@ export class EightpiecesRules extends ChessRules { // Pawns might be pushed on 1st rank and attempt to move again: if (!V.OnBoard(x + shiftX, y)) return []; - const finalPieces = - // A push cannot put a pawn on last rank (it goes backward) - x + shiftX == lastRank - ? Object.keys(V.LANCER_DIRS).concat( - [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN, V.SENTRY, V.JAILER]) - : [V.PAWN]; + // A push cannot put a pawn on last rank (it goes backward) + let finalPieces = [V.PAWN]; + if (x + shiftX == lastRank) { + // Only allow direction facing inside board: + const allowedLancerDirs = + lastRank == 0 + ? ['e', 'f', 'g', 'h', 'm'] + : ['c', 'd', 'e', 'm', 'o']; + finalPieces = + allowedLancerDirs + .concat([V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN, V.SENTRY, V.JAILER]); + } if (this.board[x + shiftX][y] == V.EMPTY) { // One square forward for (let piece of finalPieces) { -- 2.44.0