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
+35
View File
@@ -0,0 +1,35 @@
package game
// SimulateBattle resolves a hypothetical two-player battle between the given
// arranged decks (top of deck first) and returns the result. It runs on a
// scratch game, so it never touches real state — callers (notably the AI
// player) can roll out as many what-if battles as they like. Dice rolls are
// random unless rollDie is non-nil.
func SimulateBattle(round, prioritySeat int, deckA, deckB []Card, rollDie func() int) *BattleResult {
g := &Game{
Round: round,
PrioritySeat: prioritySeat,
RollDie: rollDie,
// Cards minted during the simulation (apples, bees) get IDs far away
// from real ones, purely to avoid confusion when reading results.
NextCardID: 1_000_000,
Players: []*Player{
{Name: "A", Seat: 0, Deck: append([]Card(nil), deckA...)},
{Name: "B", Seat: 1, Deck: append([]Card(nil), deckB...)},
},
}
g.resolveBattle()
return g.Battle
}
// TierContents returns the full printed contents of a tier's shop deck —
// public information from the box. Cards carry placeholder IDs; they are
// reference data, not live instances.
func TierContents(tier int) []Card {
scratch := &Game{}
scratch.buildShopDecks()
if tier < 1 || tier > len(scratch.ShopDecks) {
return nil
}
return scratch.ShopDecks[tier-1]
}