Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions locales/en/apgames.json
Original file line number Diff line number Diff line change
Expand Up @@ -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!",
Expand Down
5 changes: 0 additions & 5 deletions src/games/linage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/games/pippinzip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 8 additions & 6 deletions src/games/posit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
};

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -187,11 +183,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;
Expand All @@ -215,6 +211,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");
Expand Down
Loading