diff --git a/frontend.tsx b/frontend.tsx index 9dd4f7f..60060c3 100644 --- a/frontend.tsx +++ b/frontend.tsx @@ -213,7 +213,7 @@ function Arena({ round, total }: { round: RoundState; total: number }) {
- ROUND {round.num} / {total} + ROUND {round.num} {total !== null && / {total}}
{phaseLabel}
@@ -334,7 +334,7 @@ function Sidebar({ scores, activeRound, completed }: { scores: Record
- {score} + {score} {score === 1 ? 'win' : 'wins'}
diff --git a/game.ts b/game.ts index 887c0f7..cbb1eac 100644 --- a/game.ts +++ b/game.ts @@ -381,8 +381,11 @@ export async function runGame( round.scoreA = votesA * 100; round.scoreB = votesB * 100; round.phase = "done"; - state.scores[contA.name] = (state.scores[contA.name] || 0) + round.scoreA; - state.scores[contB.name] = (state.scores[contB.name] || 0) + round.scoreB; + if (votesA > votesB) { + state.scores[contA.name] = (state.scores[contA.name] || 0) + 1; + } else if (votesB > votesA) { + state.scores[contB.name] = (state.scores[contB.name] || 0) + 1; + } rerender(); await new Promise((r) => setTimeout(r, 2000)); diff --git a/quipslop.tsx b/quipslop.tsx index 17d1d0e..21bf1aa 100644 --- a/quipslop.tsx +++ b/quipslop.tsx @@ -50,7 +50,7 @@ function RoundView({ round, total }: { round: RoundState; total: number }) { {/* Header */} - {` ROUND ${round.num}/${total} `} + {` ROUND ${round.num}${total !== Infinity && total !== null ? `/${total}` : ''} `} {"─".repeat(50)} @@ -196,7 +196,7 @@ function Scoreboard({ scores }: { scores: Record }) { {name.padEnd(NAME_PAD)} {bar} - {score} + {score} {score === 1 ? 'win' : 'wins'} {medal} ); @@ -258,7 +258,8 @@ function Game({ runs }: { runs: number }) { // ── Main ──────────────────────────────────────────────────────────────────── const runsArg = process.argv.find((a) => a.startsWith("runs=")); -const runs = runsArg ? parseInt(runsArg.split("=")[1] ?? "5", 10) : 5; +const runsVal = runsArg ? runsArg.split("=")[1] : "infinite"; +const runs = runsVal === "infinite" ? Infinity : parseInt(runsVal || "infinite", 10); if (!process.env.OPENROUTER_API_KEY) { console.error("Error: Set OPENROUTER_API_KEY environment variable"); diff --git a/server.ts b/server.ts index 8dc54e9..5df4b3b 100644 --- a/server.ts +++ b/server.ts @@ -11,7 +11,8 @@ import { // ── Game state ────────────────────────────────────────────────────────────── const runsArg = process.argv.find((a) => a.startsWith("runs=")); -const runs = runsArg ? parseInt(runsArg.split("=")[1] ?? "5", 10) : 5; +const runsStr = runsArg ? runsArg.split("=")[1] : "infinite"; +const runs = runsStr === "infinite" ? Infinity : parseInt(runsStr || "infinite", 10); if (!process.env.OPENROUTER_API_KEY) { console.error("Error: Set OPENROUTER_API_KEY environment variable");