Skip to content

Commit c6bb4ce

Browse files
committed
Arimaa: Couple fixes
1 parent c62bea3 commit c6bb4ce

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

locales/en/apgames.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"amoeba": "Manipulate stacks of pieces to entrap your opponent's kernel or leave them with no legal moves.",
1212
"anache": "In Anache, the goal is to occupy the opponent's corner squares by coordinating your pieces.",
1313
"archimedes": "A game based on the legend of Archimedes teaching the Syracuse soldiers how to focus the sun's rays with their shields to set ships on fire. The goal is to begin your turn with a piece in your enemy's port. At the end of each turn, any enemy ships in sight of three of your pieces are destroyed by fire. Destroyed ships can eventually be rebuilt.",
14-
"arimaa": "A Chess-like game where the pieces are animals of various strengths jockeying for position, trying to get one of their rabbits to the far row. But watch out for traps!",
14+
"arimaa": "The pieces are animals of various strengths jockeying for position, trying to get one of their rabbits to the far row. But watch out for traps!",
1515
"armadas": "A miniatures-style game played with Looney pyramids where you captain a fleet of ships on the open seas, trying to sink all who stand against you.",
1616
"asli": "Conquer territory and capture enemy groups by cutting them off from all their allies. A group is cut off when it has no free path (straight or otherwise) to other groups of its color. Captured groups are sent to an off-board prison where they give additional moves to their captor. Win by leaving your opponent with no moves.",
1717
"assembly": "A simultaneous selection game where you try to trigger scoring when high-value products are on your sections of the assembly line. Highest score at the end of the game wins.",
@@ -386,11 +386,11 @@
386386
"arimaa": {
387387
"#setup": {
388388
"name": "Standard setup",
389-
"description": "Chess-like complement placed on your closest two ranks"
389+
"description": "Array your 16 pieces on your closest two ranks in any way you wish"
390390
},
391391
"eee": {
392392
"name": "Endless Endgame",
393-
"description": "An algorithmic setup that gives each side the same armies"
393+
"description": "Randomly generated setup with reduced army size"
394394
},
395395
"free": {
396396
"name": "Free placement",

src/games/arimaa.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,17 @@ export class ArimaaGame extends GameBase {
472472
const cell = ArimaaGame.coords2algebraic(col, row);
473473
// clicking a placed cell unplaces it
474474
if (cloned.board.has(cell)) {
475-
const idx = steps.findIndex(([pc,,f,]) => pc === piece![0] && f === cell);
476-
if (idx === -1) {
477-
throw new Error("This should never happen");
475+
// clicking an occupied cell after selecting a piece to place
476+
if (lastmove.length === 0) {
477+
const idx = steps.findIndex(([pc,,f,]) => pc === piece![0] && f === cell);
478+
if (idx === -1) {
479+
throw new Error("This should never happen");
480+
}
481+
steps.splice(idx, 1);
482+
newmove = steps.map(([pc, p, f,]) => `${p === 1 ? pc : pc.toLowerCase()}${f}`).join(",");
483+
} else {
484+
newmove = stub;
478485
}
479-
steps.splice(idx, 1);
480-
newmove = steps.map(([pc, p, f,]) => `${p === 1 ? pc : pc.toLowerCase()}${f}`).join(",");
481486
} else {
482487
newmove = `${stub}${stub.length > 0 ? "," : ""}${lastmove}${cell}`;
483488
}

0 commit comments

Comments
 (0)