From: Benjamin Auder Date: Thu, 28 May 2020 21:13:50 +0000 (+0200) Subject: Fix pawn promotions in Eightpieces X-Git-Url: https://git.auder.net/variants/Cwda/current/doc/screen_ranking.png?a=commitdiff_plain;h=7f1df0d95d2190fd69ef7c58f5a795aef3f92869;p=vchess.git Fix pawn promotions in Eightpieces --- 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) {