From 027ef676ce59ee947b25d9f2ca200a828076b54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Neto?= <886455+jpneto@users.noreply.github.com> Date: Mon, 8 Jun 2026 21:00:57 +0100 Subject: [PATCH 1/2] Updated Posit solved a bug that allowed to moves to non-adjacent cells --- locales/en/apgames.json | 1 + src/games/posit.ts | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/locales/en/apgames.json b/locales/en/apgames.json index 186b4137..2ef8e913 100644 --- a/locales/en/apgames.json +++ b/locales/en/apgames.json @@ -5914,6 +5914,7 @@ "INSTRUCTIONS": "Select your piece.", "SELECT_MOVE": "Select a square to move your piece. The piece cannot go down, move up two or more levels at once, or climb on top of a 3-stack.", "SELECT_PLACEMENT": "Select a square to place a neutral piece. Stacks cannot have more than three neutral pieces. It is invalid to place a neutral stone on top of a player's piece.", + "NOT_ADJACENT": "The piece may only move to adjacent squares!", "SELECT_ERROR": "The player needs first to move his piece!", "CANNOT_GO_DOWN": "The piece cannot move to a smaller stack!", "CANNOT_GO_UPUP": "The piece cannot move up two or more levels at once!", diff --git a/src/games/posit.ts b/src/games/posit.ts index 1d68f229..f807736c 100644 --- a/src/games/posit.ts +++ b/src/games/posit.ts @@ -187,11 +187,11 @@ export class PositGame extends GameBase { return result; } + const g = this.getGraph(); const moves = m.split(/[,-]/); const piece = this.findPiece(); // get where the single piece is try { // check if all cells' selection are valid cells - const g = this.getGraph(); for (const cell of moves) { g.algebraic2coords(cell); } } catch { result.valid = false; @@ -215,6 +215,12 @@ export class PositGame extends GameBase { const oppPiece = this.findPiece(this.currplayer % 2 + 1 as playerid); // get where the opponent's piece is + if (! g.neighbours(moves[0]).includes(moves[1]) ) { + result.valid = false; + result.message = i18next.t("apgames:validation.posit.NOT_ADJACENT"); + return result; + } + if ( moves[1] === oppPiece ) { // cannot move to the opponent's player square result.valid = false; result.message = i18next.t("apgames:validation.posit.OPPONENT_MOVE"); From c9a054f6e9b33989f8c86ec6a30b2953f63a82b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Neto?= <886455+jpneto@users.noreply.github.com> Date: Mon, 8 Jun 2026 21:28:06 +0100 Subject: [PATCH 2/2] removed method moves() of some new games --- src/games/linage.ts | 5 ----- src/games/pippinzip.ts | 4 ---- src/games/posit.ts | 6 +----- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/games/linage.ts b/src/games/linage.ts index babb9ef7..87199170 100644 --- a/src/games/linage.ts +++ b/src/games/linage.ts @@ -243,11 +243,6 @@ export class LinageGame extends GameBase { return result; } - // Generates a full list of valid moves from the current game state. - public moves(): string[] { - return []; // costly to compute - } - public handleClick(move: string, row: number, col: number, piece?: string): IClickResult { try { if (this.isKomiTurn()) { // Komi time, so no clicks are acceptable diff --git a/src/games/pippinzip.ts b/src/games/pippinzip.ts index b5e4e90d..c6a0df7f 100644 --- a/src/games/pippinzip.ts +++ b/src/games/pippinzip.ts @@ -182,10 +182,6 @@ export class PippinzipGame extends GameBase { return this.zipPlayer === this.currplayer; } - public moves(): string[] { - return []; // too many moves - } - public handleClick(move: string, row: number, col: number, piece?: string): IClickResult { try { const cell = PippinzipGame.coords2algebraic(col, row, this.boardSize); diff --git a/src/games/posit.ts b/src/games/posit.ts index f807736c..796d56b6 100644 --- a/src/games/posit.ts +++ b/src/games/posit.ts @@ -47,7 +47,7 @@ export class PositGame extends GameBase { }, ], categories: ["goal>immobilize", "mechanic>move", "mechanic>place", "mechanic>stack", "board>shape>rect", "board>connect>rect", "components>simple>1per"], - flags: ["experimental"], + flags: ["no-moves", "experimental"], variants: [] }; @@ -143,10 +143,6 @@ export class PositGame extends GameBase { return this.board.has(cell) ? this.board.get(cell)![1] : 0; } - public moves(): string[] { - return []; // too many moves - } - public handleClick(move: string, row: number, col: number, piece?: string): IClickResult { try { const cell = this.getGraph().coords2algebraic(col, row);