Skip to content

Shooter expects an opponent who hides from its hunt; placer notices a shooter who does - #21

Merged
AdminGodZ merged 5 commits into
mainfrom
t3/long-match-learning
Nov 29, 2026
Merged

AdminGodZ merged 5 commits into
mainfrom
t3/long-match-learning

Conversation

@AdminGodZ

Copy link
Copy Markdown
Owner

What changes

Shooter: a model of an opponent who hides from the hunt (crates/core/src/ai/hiding.rs)

An opponent who watches the engine's shots sees the order of some 45 cells per game; the engine sees 17 cells of a fleet. A placer that moves its ships to where the hunt came late cost the engine close to 3 shots a game over matches of 100 and more than 4 over matches of 10.

The engine knows its own shots, so it now keeps the record such an opponent would keep and scores, on every revealed fleet, views that expect ships where that record would send them. The views are trusted only as far as they have predicted better than assuming nothing. Shooter::learn now also receives the shots fired (what the opponent saw); the browser session records them. hide=N (thousandths) sets the starting belief, hide=0 turns the model off.

Placer: judged after each game, no bandit (AdaptivePlacer)

Against a shooter that expects hiding, a placer that keeps hiding is read (44.0 shots needed against it, fewer than against the equilibrium mix). The bandit on the shots of single games could not see that. After each game the placer now asks what fleets of both kinds (hidden by its record as it stood, drawn from the equilibrium mix) would have been worth against the hunt as it came, and places by which kind has done better of late.

Tools

  • compare --match N: the error bar counts matches, not games.
  • examples/match_probe.rs: a diagnostic for long matches (shots by stretch of the match, how concentrated each ship's places are).

Measurements

All on the 24-core Windows machine, search up to 3,000 placements unless noted.

Shooter model, mean shots needed:

Opponent's placement Matches of Without With Games
broadside (this PR's placer) 10 49.21 ± 0.10 44.39 ± 0.10 8,000
broadside (this PR's placer) 100 47.32 ± 0.11 44.64 ± 0.11 6,000
lateness 10 46.39 ± 0.09 45.51 ± 0.09 8,000
lateness 100 47.13 ± 0.06 44.55 ± 0.06 20,000
  • Default search depth, matches of 10 against the placer on main: 48.35 to 43.12, saved 5.2 ± 0.3 (3,000 games).
  • No cost against placers that do not react (paired, 6,000 games each): equilibrium mix 0.00 ± 0.01, random −0.01 ± 0.01, tilt2 0.00 ± 0.01, spaced 0.01 ± 0.02.
  • One small cost: repeat3 −0.05 ± 0.02 (the repeat model gains 4.9 there). A starting belief of 0.1% removes it but gives back 0.56 of the gain against the hiding placer, so 1% stays.

Placer, Broadside against the density bot (10,000 games each):

Placement Wins, matches of 100 Wins, matches of 10
this PR 86.1% ± 0.4 73.6% ± 0.4
main (bandit) 83.4% ± 0.4 69.6% ± 0.5

Placer in self-play, both shooters with the new model (8,000 games each): against the bandit version 51.7% ± 0.6 (matches of 100) and 53.8% ± 0.5 (matches of 10); against lateness 50.6% ± 0.5; against the equilibrium mix 49.2% ± 0.6.

Known limits

  • In matches of 10 against a shooter that expects hiding, the equilibrium mix alone is 0.6 shots harder to shoot at than the default placer (45.0 against 44.4).
  • Games with a learned belief take 20 to 40 ms on 24 cores instead of 5, because early positions are no longer shared between games.
  • The 20,000-game lateness row was measured before compare counted matches for its error bar, so its ± is somewhat too small.

Checks

cargo fmt --all --check, cargo clippy --all-targets -- -D warnings, cargo test --release (75 tests), cargo test --release -- --ignored (3), npm run check and npm run build in site/: all pass locally. The browser end-to-end tests run in CI.

@vercel

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
broadside Ready Ready Preview Nov 28, 2026 8:07pm UTC

@AdminGodZ
AdminGodZ merged commit 2dcbbcb into main Nov 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant