Skip to content

Tavern Coach

A Mac overlay for Hearthstone Battlegrounds that tells me what to buy every turn, and why.

Platform
Mac
Stack
Swift, SwiftUI, TypeSafe Jev, Claude Opus
Status
Personal
Tavern Coach on turn 9 of its demo game: a plan that starts with selling Buzzing Vermin, a coach note marked Sample, and calls on whether to level and refresh

01Problem

I kept losing, and the turn timer kept running out.

Hearthstone Battlegrounds is an eight-player strategy game, and every turn you buy cards in a shop against a timer. I’d play on one screen and search for the current builds on the other, and my time would run out before I found the right hero and trinkets. People built quest helpers for World of Warcraft, and I used those back then. So why not something like that for Hearthstone?

02Idea

A coach that sits right on top of the game.

Every turn it shows the plan in the order to click, grades every card in the shop and says whether to level up. No second screen and no searching.

Tavern Coach on turn 9: the plan in click order starting with Sell Buzzing Vermin, a coach note, calls on level and refresh, and every card in the tavern graded S to D with its reason

03Features

It picks the build for me, from what I have and what the others play.

It checks my board against the current builds and shows the cards each one still needs. It also warns me when someone else in the lobby goes for my tribe. I can leave it on Auto or pick a build myself, and the plan follows it.

Pick the build to play: Lobster Beasts 42%, Beetle Beasts 14%, Mech APM 4% and Deathrattle Deity 5%, each with the cards it still needs, and Auto checked, now on Lobster Beasts

03Features

It tells me which hero to take.

At the start it ranks the heroes I’m offered, and later the trinkets, by how they actually place. What I pick then steers the build it suggests.

Pick your hero: Rokara marked Pick with average place 4.08 and a note to keep Cleave and Windfury minions alive, then Infinite Toki, Forest Warden Omu and Zerek, Master Cloner

03Features

It says which spells to cast, and on what.

Spells are part of the plan, in the right order. Buffs go on the minion I’m keeping, the shop’s spell gets weighed against the minions, and when I discover a spell it grades the options against my board.

Turn 14 of one of my games: sell Tyrael, play Barrier Banshee, then cast Butchering three times, with a hint to buy Friendly Geist before casting the 6 spells

04How it works

It reads the game’s log, and two models read the cards.

Nothing is injected and no memory is read. The game already writes every move to a log file, the same one popular trackers read. Jev, a small fast model from TypeSafe, reads every card in the shop, and Claude Opus plans the next turn while the fight plays.

Why two models

Before wiring in a model, I gave fresh models ten decisions from games I had lost. Claude Opus got about eight right, and honestly I was surprised how good it is. But a shop needs an answer within a second.

Jev picks from a fixed set of answers. My first prompt asked it how much each card strengthens the board. It was fast and weak, because a card’s payoff is often indirect. So Jev now answers only literal questions. Does this card make spells? Does it pay off spells? Code then pairs the makers with the payoffs on your board.

Claude Opus gets the board, the opponents and next turn’s gold, plus a cached primer on the rules and this season’s builds. The search follows its plan: the named build steers what to buy, and its key cards are never sold. Without a key, or on any error, the rules still decide.

Why I switched from rules to a search

The first version was rules: fixed phases, each with a threshold. It never weighed a buy against a level-up, and boards drifted into one card from each of four builds.

Now card texts compile into effects the planner can simulate. A beam search plays out sequences of clicks and scores each end state in gold: stats, the risk of losing the next fight, progress toward a strong build, and options kept for later. The same shop always gives the same plan.

04How it works

Every change has to win hundreds of games first.

The first version kind of worked. Then I got more ambitious, and now it’s kind of an obsession. To know whether a change actually helps, the coach plays hundreds of games in code against real boards from my own matches. The goal is to beat the best players.

Commits
200
Lines of Swift, with 255 tests
16,000
Simulated games per lobby, for every change
300
What the simulated lobby found

The arena is a whole eight-player lobby in code. Bots were too easy, so the other seats replay real boards from my games, turn by turn. A change ships only if no lobby gets worse and at least one improves, on the same seeds.

It also showed where the coach falls behind: through turn 5 it keeps up, but by turn 7 real players’ boards have scaled with engines and the coach’s haven’t.

Next projectMarktritaA shelf-sorting game for my girlfriend and me, stocked with the groceries we actually buy.

Changelog

  • Tavern Coach reads the cards with Jev

    Tavern Coach’s advice came from rules, and rules can’t tell what a card does on your board. Two models now read the cards. Jev, a fast model from TypeSafe, answers yes-or-no questions about each card in about 0.2 seconds, and code pairs the answers into synergies. Claude Opus plans the next shop while the fight plays. Without a key, or on any error, the rules still decide.

    I picked the split after a blind test on ten decisions from games I lost.

  • Hero and trinket picks, the whole lobby and board order

    Tavern Coach now ranks heroes and trinkets at the start by how they actually place, and what I pick steers the build it suggests. It shows every opponent’s tier, health and last board, marks who I fight next, and warns when someone else goes for my tribe. There’s a graph of where I’ll probably finish, and a strip that says how to order my board.

  • No more telling me to level to Tier 7

    The coach told me to level to Tier 7, which doesn’t exist this season. It now reads the highest tier from the game itself. It also only says to freeze a card when next turn’s plan will actually buy it.

  • Advice no longer freezes halfway through a game

    The advice kept freezing mid-game. Turns out Hearthstone stops writing its log at 10 MB, so the coach just stopped seeing the game. Now the app switches that limit off and asks you to restart the game if the log got cut.

  • First version of Tavern Coach runs on top of the game

    The first version of Tavern Coach works. It reads Hearthstone’s log and shows advice in a small panel pinned to the game window, fullscreen too. Every turn it says whether to level or refresh, what to freeze, and grades each card in the shop. It checks my board against 20 current builds.