The ledger gate replays with the table's options
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
9e672e48b4
commit
32844a5976
@@ -34,11 +34,13 @@ async function main(): Promise<void> {
|
|||||||
const seats: Seat[] = [];
|
const seats: Seat[] = [];
|
||||||
let state: ReturnType<typeof game.create> | null = null;
|
let state: ReturnType<typeof game.create> | null = null;
|
||||||
let turns = 0;
|
let turns = 0;
|
||||||
|
// The host's table options ride the room line; a game created without them is a different game.
|
||||||
|
const options = (lines[0]?.t === 'room' ? lines[0].options : undefined) as Record<string, string> | undefined;
|
||||||
try {
|
try {
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
if (line.t === 'seat') seats.push(line);
|
if (line.t === 'seat') seats.push(line);
|
||||||
else if (line.t === 'unseat') seats.splice(seats.findIndex((s) => s.id === line.id), 1);
|
else if (line.t === 'unseat') seats.splice(seats.findIndex((s) => s.id === line.id), 1);
|
||||||
else if (line.t === 'start') state = game.create(Object.fromEntries(seats.map((s) => [s.id, s.name])), line.seed, line.rules ?? 1);
|
else if (line.t === 'start') state = game.create(Object.fromEntries(seats.map((s) => [s.id, s.name])), line.seed, line.rules ?? 1, options);
|
||||||
else if (line.t === 'turn' && state) {
|
else if (line.t === 'turn' && state) {
|
||||||
state = game.resolve(state, line.inputs);
|
state = game.resolve(state, line.inputs);
|
||||||
turns += 1;
|
turns += 1;
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
# deploy/verify-ledgers.sh <droplet-ip-or-host> [https://site]
|
# deploy/verify-ledgers.sh <droplet-ip-or-host> [https://site]
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
HOST="${1:?usage: verify-ledgers.sh <droplet-ip-or-host> [https://site]}"
|
HOST="${1:?usage: verify-ledgers.sh <droplet-ip-or-host> [https://site]}"
|
||||||
SITE="${2:-https://tafl.kestrelsnest.social}"
|
# SITE in the environment overrides the name, for a machine whose DNS has not caught up with a new record.
|
||||||
|
SITE="${2:-${SITE:-https://tafl.kestrelsnest.social}}"
|
||||||
DIR="$(mktemp -d)"
|
DIR="$(mktemp -d)"
|
||||||
trap 'rm -rf "$DIR"' EXIT
|
trap 'rm -rf "$DIR"' EXIT
|
||||||
rsync -az "root@$HOST:/var/lib/hnefatafl/rooms/" "$DIR/"
|
rsync -az "root@$HOST:/var/lib/hnefatafl/rooms/" "$DIR/"
|
||||||
|
|||||||
Reference in New Issue
Block a user