Compare commits

...
Author SHA1 Message Date
claude 6f4b351065 Merge pull request '[ui-b] Normal bot plays sim-balance's lookahead on the engine view' (#49) from night/ui-b/bots-engine into night/2026-11-16 2026-11-17 17:02:04 +00:00
claudeandClaude Opus 5.5 0a163697dc Night 1: IOS.md records the macOS install progress at shutdown (#52)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 06:15:00 +00:00
claudeandClaude Opus 5.5 33b11a5491 Night 1 fix: results card explains on-topic tie-breaks (#51)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 06:14:52 +00:00
claudeandClaude Opus 5.5 4dba8b3653 Night 1: BALANCE.md labels the seat figures as pre-#38 (#48)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 06:04:32 +00:00
claudeandClaude Opus 5.5 655edf25b5 Normal bot plays sim-balance's lookahead on the engine view
Issue #5 follow-up. When ui-a's adapter attaches MatchView.engine (viewFor
output only), the normal bot uses shared/bots makeViewBot('lookahead-lite').
Easy stays a view-model bot. Real engine via ui-a's adapter: normal beats
random 93% (100 matches) and beats easy 77%; the default test run plays 16
matches per pairing (~50 s); UI_BOTS_FULL=1 plays 100.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 01:02:22 -05:00
8 changed files with 57 additions and 10 deletions
+4 -2
View File
@@ -15,6 +15,8 @@ Owner: sim-balance (claude/wikideck#4). Harness: `shared/bots/`, `scripts/sim/`
## v1.1 re-run on the real engine hooks (00:31)
> **Seat figures are pre-#38.** Every first-player and seat number in this report was measured on an engine before #38, which removed `opponent.queuedCount` from `PlayerView`. The bots never read the queue split (`stateFromView` uses the total hand, and an invariance test covers it), so the effect should be nil. A re-run on the merged head is still the clean number, and it is open for v1.2.
**Engine:** `night/engine/v1-1` @ 4a0dbd0, with `RULESET_V1_1` (DESIGN #32): `viral {base 1, cap 3}`, `encyclopedic {sides 1}`, `rising.powerDelta -1`, `cultureKeyword: home`, `costThresholds [26,39,51,63,78]`. It is the same focused run as above: the §2.1 starters plus 4 owned decks (cost thresholds and Culture keyword per v1.1), 2,000 matches per ruleset.
| | v1 | **v1.1 (#32, exact)** | v1.1 + item 6 |
@@ -22,7 +24,7 @@ Owner: sim-balance (claude/wikideck#4). Harness: `shared/bots/`, `scripts/sim/`
| starter deck WR, overall (FG / Head / Pio / Star) | 65 / 40 / 57 / 54 | **52 / 52 / 52 / 53** ✅ | 50 / 56 / 50 / 52 |
| starter pairings, min–max | 23–77% | 39–61% (only FG–Head 61%, n = 51, is outside 45–55) | 42–58% |
| owned vs starters (FG / Head / Pio / Star) | 37 / 54 / 40 / 41 | 51 / 42 / 47 / 43 | 51 / 41 / 46 / 48 |
| first player | 53.4% | **51.2% [48.8–53.6]** ✅ | 51.0% [48.6–53.5] |
| first player (pre-#38) | 53.4% | **51.2% [48.8–53.6]** ✅ | 51.0% [48.6–53.5] |
| decided in the first third | 4.1% | 3.3% | 4.1% |
| greedy > maxpower, lookahead-lite > greedy | 62%, 60% | 63%, 65% | 51%, 70% |
@@ -110,7 +112,7 @@ Raw tables:
### TL;DR for the council (report v1, 00:25; see the v1.1 re-run above for the updated recommendation)
1. **Seat and initiative are fine:** 51.5% [49.6–53.5] for the turn-1 initiative holder (n = 2,421 symmetric games), and seat 0 51.2%. Draws are 0.4%. The tie-break (total power) decides 4.7% of games. *This full-field run started before the bot-side queue-count fix (PR #14); the effect is at most a 0.02 nudge to the heuristic. The focused starters run, after the fix, gives a borderline 53.4% [51.0–55.8] under v1 and **51.0% [48.6–53.4]** under the recommended v1.1. Initiative only matters through reveal order, and v1.1 removes most of the order-sensitive power.*
1. **Seat and initiative are fine (pre-#38):** 51.5% [49.6–53.5] for the turn-1 initiative holder (n = 2,421 symmetric games), and seat 0 51.2%. Draws are 0.4%. The tie-break (total power) decides 4.7% of games. *This full-field run started before the bot-side queue-count fix (PR #14); the effect is at most a 0.02 nudge to the heuristic. The focused starters run, after the fix, gives a borderline 53.4% [51.0–55.8] under v1 and **51.0% [48.6–53.4]** under the recommended v1.1. Initiative only matters through reveal order, and v1.1 removes most of the order-sensitive power.*
2. **Keyword values are lopsided, confirming the critic's figures within 0.2:**
| keyword | power per card |
+19 -2
View File
@@ -81,8 +81,25 @@ Note: the VNC keyboard via `vncdotool` drops Shift (everything types lowercase,
- **SSO (#7):** `Info.plist` registers the `dev.eom.wikideck` URL scheme; redirect `dev.eom.wikideck:/oauth/callback`
returns to the app via `@capacitor/app`'s `appUrlOpen`.
## Progress at shutdown
_(filled in before 01:25)_
## Progress at shutdown (01:06, 2026-11-17)
- **23:21** recovery `.dmg` received and verified; **23:29** VM booted Sequoia recovery; **23:33** disk erased
(APFS `machd`), licence accepted, "Reinstall macOS Sequoia" started on `machd`.
- **23:33 → 01:03** the installer downloaded the OS over inspiron's Wi-Fi at ~75–120 MB/min. The VM disk grew from
21 MB to **9.7 GB**. Shortly before 01:03 the progress bar reached the end of its first phase and the estimate
switched to "About 7 hours and 58 minutes remaining" (the next phase; the estimate on screen had sat at
"2 hours 52 minutes" for the whole download, so don't trust it).
- **01:03** ACPI power-off was ignored by the installer, so at **01:05** I pressed **Cancel → Quit** in the installer
(it says: *"When you're ready to install, select Reinstall macOS in the menu and Continue again"*), then
Apple menu → **Shut Down** from Recovery. QEMU exited cleanly at **01:06**. `qemu-img check`: no errors.
- **macOS is not installed yet.** No user account exists, so there is no `CREDENTIALS.txt` and SSH isn't on yet.
The partial download stays on `machd` (9.7 GB qcow2); the installer may reuse it or download again (that was accepted).
**To resume** (inspiron-3670):
```
cd ~/worker/jobs/macos && setsid ./boot-macos.sh > qemu.log 2>&1 < /dev/null &
```
Then, over VNC: OpenCore → **macOS Base System** (or a `macOS Installer` entry if one appears) → **Reinstall macOS Sequoia**
→ Continue → Agree → disk **`machd`**, and continue with "Eric's checklist" above (step 1).
## What's verified
- `BaseSystem.dmg` sha256 matches macos-fetch's `SHA256SUMS`; converted `BaseSystem.img` is 3,221,110,784 bytes.
+1 -1
View File
@@ -14,7 +14,7 @@ export function Results({ result, modeName, onRematch, onLobby }: { result: Resu
: `You won ${won} of ${result.lanes.length} Topics${tiebreak ? ', so total power decided it' : ''}.`}</p>
<ol className="result-lanes">
{result.lanes.map(l => <li key={l.name} className={l.winner === 0 ? 'won' : l.winner === 1 ? 'lost' : 'tied'}>
<span>{l.name}</span><b>{l.myPower} – {l.theirPower}</b><small>{l.winner === 0 ? 'Won' : l.winner === 1 ? 'Lost' : 'Tied'}</small>
<span>{l.name}</span><b>{l.myPower} – {l.theirPower}</b><small>{l.winner === 0 ? 'Won' : l.winner === 1 ? 'Lost' : 'Tied'}</small>{l.winner !== null && l.myPower === l.theirPower && <small className="tie-note">Tie, decided by on-topic cards</small>}
</li>)}
</ol>
<p className="muted small">Matches are off-chain. No card was moved or burned.</p>
+10
View File
@@ -0,0 +1,10 @@
// Engine-level chooser for the "normal" browser bot: sim-balance's determinized lookahead
// (shared/bots), fed only the engine's hidden-information PlayerView (viewFor output),
// never the full MatchState (night-lead's rule on #5).
import { makeViewBot } from '../../../shared/bots/game-adapter.ts';
import type { PlayerView } from '../../../shared/game/index.ts';
import type { EngineChoice } from './index.ts';
const lookahead = makeViewBot('lookahead-lite');
export const normalEngineChoice: EngineChoice = (ev, rng) => lookahead(ev.view as PlayerView, rng);
+5 -2
View File
@@ -6,6 +6,7 @@
// Hard rule (night-lead, #5): bots get only `viewFor` output, never the full MatchState.
// The MatchView never contains the human's queued plays either.
import type { MatchView, UIAction } from '../types.ts';
import { normalEngineChoice } from './engine.ts';
export type BotLevel = 'easy' | 'normal';
export type Rng = () => number;
@@ -59,7 +60,7 @@ export function makeUiBot(level: BotLevel, engineChoice?: EngineChoice): Bot {
name: level === 'easy' ? 'Easy' : 'Normal', // the lobby renders `${name} bot`
description: level === 'easy'
? 'Plays big cards, but often makes a random move. Good for learning.'
: 'Plays for the lead in each Topic. It cannot see your hidden plays.',
: 'Looks a few moves ahead and plays for the lead in each Topic. It cannot see your hidden plays.',
choose(view, legal, rand) {
const ev = (view as MatchView & { engine?: { view: unknown } }).engine;
const mapped = legal as (UIAction & WithEngine)[];
@@ -72,4 +73,6 @@ export function makeUiBot(level: BotLevel, engineChoice?: EngineChoice): Bot {
};
}
export const BOTS: Bot[] = [makeUiBot('easy'), makeUiBot('normal')];
// Normal plays sim-balance's lookahead whenever the adapter attaches the engine view; easy stays a
// view-model bot (it measured weaker and more human-beatable than the engine maxpower mix).
export const BOTS: Bot[] = [makeUiBot('easy'), makeUiBot('normal', normalEngineChoice)];
+1
View File
@@ -206,3 +206,4 @@ html.wd-in-match .auth-wrap,body:has(.match) .auth-wrap{display:none}
.show-narrow{display:none}
@media(max-width:480px){.show-narrow{display:inline}.play-actions .button{min-width:0}}
.lane-bonus{color:var(--ctp-yellow)!important;margin-left:2px}
.result-lanes .tie-note{font-size:10px;color:var(--ctp-yellow);line-height:1.3}
+6 -3
View File
@@ -38,6 +38,9 @@ function winRate(a: B, b: B, n: number) {
}
const [easy, normal] = BOTS;
// Normal runs sim-balance's lookahead (~1.5 s of CPU per match), so the default run is small;
// UI_BOTS_FULL=1 plays 100 matches per pairing.
const N = process.env.UI_BOTS_FULL ? 100 : 16;
test('BOTS exports easy and normal in the Bot shape', () => {
assert.deepEqual(BOTS.map(b => b.id), ['easy', 'normal']);
@@ -46,14 +49,14 @@ test('BOTS exports easy and normal in the Bot shape', () => {
});
test('normal bot beats random play more than 80% of the time', () => {
const r = winRate(normal, randomBot, 100);
const r = winRate(normal, randomBot, N);
console.log(`normal vs random ${r}`); assert.ok(r > 0.8, `normal vs random ${r}`);
});
test('easy bot beats random, and normal beats easy', () => {
const e = winRate(easy, randomBot, 100), g = winRate(normal, easy, 100);
const e = winRate(easy, randomBot, 100), g = winRate(normal, easy, N);
console.log(`easy vs random ${e}, normal vs easy ${g}`); assert.ok(e > 0.5, `easy vs random ${e}`);
assert.ok(g > 0.6, `normal vs easy ${g}`);
assert.ok(g > 0.55, `normal vs easy ${g}`);
});
test('bots never concede or un-queue, and end the turn when nothing fits', () => {
+11
View File
@@ -141,3 +141,14 @@ test('the final board shows scoring power, and queued cards preview their lane p
assert.equal(q.power, q.basePower + q.trend + bonus);
}
});
test('results explain a tied Topic decided by the on-topic tie-break', async () => {
const { renderToStaticMarkup } = await import('react-dom/server');
const { createElement } = await import('react');
const { Results } = await import('../src/game/Results.tsx');
const html = renderToStaticMarkup(createElement(Results, { modeName: 'Standard', onRematch() {}, onLobby() {}, result: {
winner: 1, turns: 6, reason: 'topics', totalPower: [37, 42],
lanes: [{ name: 'Current Events', myPower: 13, theirPower: 13, winner: 1 }, { name: 'Archive', myPower: 10, theirPower: 10, winner: 0 },
{ name: 'Stub', myPower: 14, theirPower: 19, winner: 1 }] } }));
assert.equal(html.match(/Tie, decided by on-topic cards/g)?.length, 2);
});