Add bot to play against.

This commit is contained in:
Greyson Parrelli
2026-07-23 15:58:12 -04:00
parent 3825dbacec
commit db1a6ef290
23 changed files with 1852 additions and 23 deletions
+17 -2
View File
@@ -1,7 +1,8 @@
# Super Auto Pets: The Board Game — Online
A web app for playing the Super Auto Pets board game remotely. 1v1 for now;
the engine is built to grow to more players.
the engine is built to grow to more players. Play a friend by room code, or
play solo against a computer opponent (easy / medium / hard).
## Stack
@@ -94,8 +95,22 @@ All six tiers use the real card data:
```
cmd/server/ entrypoint
internal/game/ rules engine (pure, fully tested)
internal/server/ HTTP + WebSocket rooms
internal/ai/ computer opponent (decides from a player View only)
internal/server/ HTTP + WebSocket rooms; drives bot turns
internal/store/ SQLite persistence
internal/env/ .env loading
web/ React frontend
```
## The computer opponent
Any seat can be a bot (`Player.IsBot`); humans and bots are interchangeable
to the engine, which is what will let future >2-player games mix them
freely. The AI in `internal/ai` never touches the `Game` — it decides from a
`game.View`, the same per-player state a human client is sent, plus a
persisted memory of public observations (battle lineups, the event log, shop
row changes). It cannot see your deck order, hidden trade picks, or the
shuffled shop decks. It scores candidate moves by Monte-Carlo battle
rollouts (`game.SimulateBattle`) against sampled guesses of your deck and
ordering, blended with a long-term deck-value heuristic; difficulty tunes a
softmax over the scored moves plus the rollout budget.