The tally in the hall's about panel, with the board played and how each game was won
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
c553902d8a
commit
bac7182915
+12
-1
@@ -409,5 +409,16 @@ export const game: GameSpec<State, Input> = {
|
||||
return { from: Number.isInteger(r.from) ? (r.from as number) : -1, to: Number.isInteger(r.to) ? (r.to as number) : -1 };
|
||||
},
|
||||
validate: validateMove,
|
||||
nameOf: (state, seat) => state.players[seat]?.name ?? seat
|
||||
nameOf: (state, seat) => state.players[seat]?.name ?? seat,
|
||||
tally: (state) => {
|
||||
const lines: Record<string, number> = {};
|
||||
lines[state.set === 'tablut' ? 'played as Tablut' : 'played by Copenhagen rules'] = 1;
|
||||
const reason = state.over?.reason ?? '';
|
||||
if (/reaches/.test(reason)) lines["won by the king's escape"] = 1;
|
||||
else if (/taken/.test(reason)) lines["won by taking the king"] = 1;
|
||||
else if (/edge fort/.test(reason)) lines['won by an edge fort'] = 1;
|
||||
else if (/sealed/.test(reason)) lines['won by encirclement'] = 1;
|
||||
else if (/repetition|no move/.test(reason)) lines['decided by repetition or a stalemate'] = 1;
|
||||
return lines;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user