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
2 changes: 1 addition & 1 deletion locales/en/apgames.json
Original file line number Diff line number Diff line change
Expand Up @@ -3208,7 +3208,7 @@
"INITIAL_INSTRUCTIONS": "Click one of your pieces to select it.",
"INITIAL_INSTRUCTIONS_PIE": "Click one of your pieces to select it, or use the pie rule to swap sides.",
"NOT_ADJACENT": "A piece can only move to an adjacent empty cell.",
"NO_PASS": "You cannot pass in this game.",
"NO_PASS": "You cannot pass in this game. Swapping sides (the pie rule) is only available to the second player, right after the first move.",
"PARTIAL": "Click an adjacent empty cell to move the selected piece there.",
"PIE": "Use the pie rule and swap sides.",
"PIE_UNAVAILABLE": "The pie rule can only be used by the second player right after the first move."
Expand Down
13 changes: 2 additions & 11 deletions src/games/selfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const gameApgamesEn = {
INITIAL_INSTRUCTIONS: "Click one of your pieces to select it.",
INITIAL_INSTRUCTIONS_PIE: "Click one of your pieces to select it, or use the pie rule to swap sides.",
NOT_ADJACENT: "A piece can only move to an adjacent empty cell.",
NO_PASS: "You cannot pass in this game.",
NO_PASS: "You cannot pass in this game. Swapping sides (the pie rule) is only available to the second player, right after the first move.",
PARTIAL: "Click an adjacent empty cell to move the selected piece there.",
PIE: "Use the pie rule and swap sides.",
PIE_UNAVAILABLE: "The pie rule can only be used by the second player right after the first move.",
Expand Down Expand Up @@ -218,7 +218,7 @@ export class SelfoGame extends GameBase {
},
],
categories: ["goal>connect", "mechanic>move", "mechanic>random>setup", "board>shape>hex", "board>connect>hex", "components>simple>1per"],
flags: ["experimental", "pie", "random-start", "custom-buttons"],
flags: ["experimental", "pie", "random-start"],
variants: [
{ uid: "r2f5", group: "board" },
{ uid: "#board" },
Expand Down Expand Up @@ -341,15 +341,6 @@ export class SelfoGame extends GameBase {
return !this.gameover && this.stack.length === 2 && this.currplayer === 2;
}

/** The pie rule is offered as a button on the second player's first turn. */
public getButtons(): Array<{label: string; move: string}> {
if (this.isPieTurn()) {
// the button sends "pass" (like Asli's pie button), which is accepted as "pie"
return [{label: "apgames:buttons.swap", move: "pass"}];
}
return [];
}

public moves(player?: playerid): string[] {
if (this.gameover) { return []; }
if (player === undefined) {
Expand Down
11 changes: 1 addition & 10 deletions test/games/selfo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,7 @@ describe("Selfo", () => {
expect(game.validateMove("pie").valid).to.be.true;
});

it("shows a pie button only on that turn", () => {
const game = new SelfoGame(undefined, ["r2f5"]);
expect(game.getButtons()).to.deep.equal([]);
game.move(firstMove(game));
expect(game.getButtons()).to.deep.equal([{label: "apgames:buttons.swap", move: "pass"}]);
game.move("pie");
expect(game.getButtons()).to.deep.equal([]);
});

it("accepts the pie button's pass and plays it as pie", () => {
it("plays the generic Pass button as pie on the pie turn", () => {
const game = new SelfoGame(undefined, ["r2f5"]);
expect(game.handleClick("", -1, -1, "_btn_pass").valid).to.be.false;
game.move(firstMove(game));
Expand Down
Loading