Skip to content

Commit 45488a2

Browse files
committed
Arimaa: Make setup faster
1 parent 4b89943 commit 45488a2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/games/arimaa.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,11 @@ export class ArimaaGame extends GameBase {
499499
newmove = stub;
500500
}
501501
} else {
502+
// if just clicking directly on the board, select the strongest piece in hand
503+
if (lastmove === undefined || lastmove === "") {
504+
const sorted = [...cloned.hands![cloned.currplayer - 1]].sort((a,b) => ArimaaGame.strength(b) - ArimaaGame.strength(a));
505+
lastmove = cloned.currplayer === 1 ? sorted[0] : sorted[0].toLowerCase();
506+
}
502507
newmove = `${stub}${stub.length > 0 ? "," : ""}${lastmove}${cell}`;
503508
}
504509
}

0 commit comments

Comments
 (0)