Skip to content

Commit 936af29

Browse files
committed
Fix click handler after placing last piece
1 parent e32470b commit 936af29

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

locales/en/apgames.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@
389389
"description": "Array your 16 pieces on your closest two ranks in any way you wish"
390390
},
391391
"eee": {
392-
"name": "Endless Endgame",
392+
"name": "Endless endgame",
393393
"description": "Randomly generated setup with reduced army size"
394394
},
395395
"free": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"build": "npm run json2ts && npm run build-ts && npm run lint",
99
"build-ts": "tsc && npm pack",
10-
"test0": "mocha -r ts-node/register test/games/lasca.test.ts",
10+
"test0": "mocha -r ts-node/register test/games/arimaa.test.ts",
1111
"test": "mocha -r ts-node/register test/**/*.test.ts",
1212
"lint": "npx eslint .",
1313
"dist-dev": "rimraf dist && webpack",

src/games/arimaa.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,12 @@ export class ArimaaGame extends GameBase {
472472
cloned.move(stub, {partial: true});
473473

474474
// placing pieces
475-
if (cloned.hands !== undefined && cloned.hands[cloned.currplayer - 1].length > 0) {
475+
// - either still pieces in hand
476+
// - or we're in standard setup and ply 1 or 2, no matter the hands
477+
if (
478+
(cloned.hands !== undefined && cloned.hands[cloned.currplayer - 1].length > 0) ||
479+
(this.variants.length === 0 && this.stack.length <= 2)
480+
) {
476481
// clicking off the board resets
477482
if (row === -1 || col === -1) {
478483
const [pc, pstr] = piece!.split("");

0 commit comments

Comments
 (0)