An AI workshop for sales teams is usually about prompts. This post is about something else: a branching sales call that runs as one static HTML file, with no backend and no model call at runtime, and the checks it had to pass before it was allowed out. The game is called The Hard Buyer. Claude wrote the dialogue tree, the engine, the 3D scene and the tests. This is how the pieces fit together, and what broke on the way.  ## What the game does You have booked ten minutes with Henrik, head of finance at Stenvad Fragt ApS, an invented freight company with 45 people. Each turn you get three replies to pick from. Henrik answers, and a patience value moves up or down. Under him sit eight tiles for the letters of MEDDPICC: Metrics, Economic buyer, Decision criteria, Decision process, Paper process, Identify pain, Champion and Competition. A tile lights only when Henrik says something that belongs to it. There are three endings. He books a meeting with the right people, he asks you to send material, or he hangs up. Everything in it is fiction, and the screen says so. From an engineering point of view it is a small state machine with a scoring rule. The content and the logic sit in the same JSON file, so that file had to be proven sound before anything else mattered. ## The data model The whole conversation lives in one JSON document. The top level has a meta\ block, a start\ node id and a map of nodes. meta\ carries the rules of play: \json { "meta": { "startPatience": 100, "maxTurns": 12, "hangupAt": 0, "letters": \[ { "key": "M", "letter": "M", "da": "...", "en": "Metrics" }, { "key": "Dc", "letter": "D", "da": "...", "en": "Decision criteria" } \], "coachingOrder": \["I", "M", "E", "Dp", "Dc", "Ch", "P", "Co"\] }, "start": "n01" } \\ Each letter has a key\ and a display letter\. Dc\ and Dp\ both show as D (criteria and process), and Ch\ and Co\ both show as C (champion and competition). Keeping the key separate from what is drawn on the tile removes a whole class of bug where a "D" lights the wrong tile. coaching\ holds one line per letter, said to the seller, on what they should have asked, and coachingOrder\ sets the order those lines come in. A node looks like this, trimmed: \json { "mood": "guarded", "reveals": \["M"\], "say": { "da": "...", "en": "..." }, "choices": \[ { "patience": 5, "next": "n07", "say": { "da": "...", "en": "..." } }, { "patience": 0, "next": "n05", "say": { "da": "...", "en": "..." } }, { "patience": -25, "next": "n03", "say": { "da": "...", "en": "..." } } \] } \\ Three design choices carry most of the weight. **reveals\ sits on the buyer's line, never on the seller's choice.** Without it, the game would reward questions that only sound good. A seller can ask a perfect question, and if Henrik dodges it, nothing lights. The tiles measure what you found out, not what you asked. Putting the field on the node rather than on the choice makes that impossible to get wrong by accident. **Patience is a delta on the choice.** A good question earns a little back, a neutral one costs nothing, and a pitch costs a lot. The prompt that generated the tree fixed the scale: about +5 for a good question, 0 for neutral, -10 to -30 for pitching, and -40 for ignoring a clear no. When patience reaches zero the call ends, whatever node you were on. **next\ is either a node id or a list of rules.** Most choices point straight at a node. The ones near the end of the call need to look at what the seller has earned so far: \json "next": \[ { "if": { "has": \["E", "I"\], "patience": 30 }, "to": "end\_booked" }, { "if": { "missing": \["E"\] }, "to": "n10\_who" }, { "to": "end\_material" } \] \\ The engine walks the list and takes the first rule whose condition holds. The last rule has no condition, so there is always a fallback. That one construct is what lets the same closing question lead to a booked meeting for a seller who did the work, and to "send me something" for one who did not. ## The engine The engine is short because the data does the work. Per turn it does five things: 1. Render Henrik's line for the current node in the chosen language. 2. Add any letters in reveals\ to the lit set. 3. Show the three choices. 4. On a click, apply the patience delta and clamp it to 0 to 100. 5. Resolve next\: a string is a node id, a list is evaluated rule by rule. Then it checks the end conditions: patience at zero, an ending node, or the turn limit. There is no randomness. The same choices always produce the same call, which matters for training, because two people can compare what they did. ## Proving the tree before shipping it A generated tree with 42 nodes and 117 replies will have mistakes in it. A next\ that points at a node that was renamed. A node no path reaches. An ending that looks reachable but sits behind a condition nobody can satisfy. You do not find those by playing ten times. So the release had to pass a test that walks the tree. The checks were the same ones the generation prompt asks Claude to run on its own output: - Every next\ points at a node that exists. - Every node can be reached from start\. - All three endings can be reached. - A booked ending exists within ten turns. Reachability on a plain graph is a breadth-first search. Here it is not quite that, because the rules in next\ depend on state. So the search runs over states, not nodes: the current node, the patience value and the set of lit letters. Two visits to the same node with different patience or different letters are different states, because they can lead to different places. Counted that way, 7,799 distinct states can be reached. That number is the size of the space a player can wander through. It is also why two sellers playing the same game rarely take the same road. The search also gives you the interesting paths for free. The shortest booking is ten turns, and it starts with the worst opening line in the game: "We help companies like yours save 40% of their time with AI automation." Henrik answers "Everybody says that" and patience drops by 25. The lesson for a seller is that a bad opening can be repaired if you stop pitching. The lesson for the builder is that a search over states finds routes no designer would draw by hand. Lighting all eight letters takes eleven turns. Picking the top reply every time ends the call in four.  ## One file, no network The game runs entirely in the browser. It fetches nothing, stores nothing and calls no model while you play. Henrik can only say what is in the tree. For a training tool that is a feature: nobody can talk him into saying something odd, and no conversation data leaves the machine. The JSON tree is inlined into the HTML as a data script: \html { ... } \\ and parsed when the page loads. One gotcha bit here. If any string in the tree contains https://asmashpqdoushvxdyiwu.supabase.co/storage/v1/object/public/content-images/claude-news/brinvik-lab-the-hard-buyer-poster-en-1080.png) ## Swapping in your own buyer Three files are free to download from the article: the whole game as a zip that opens offline, the dialogue tree as JSON, and the prompt to give Claude for a buyer of your own. The prompt asks for a buyer, a product and one fact per MEDDPICC letter. It asks for at least 40 nodes, roughly ten turns to a booking, three replies per node, the patience scale above, and reveals only on the buyer's line. Then it asks Claude to check its own output against the same four rules the release test used before it hands the tree over. That self-check does not replace the walk described above, but it catches most broken references before you ever open the file. To play the new buyer, replace the contents of the \treescript element with the new JSON, remember the \<\/` escape, and open the file. No build step. If you would rather not touch code at all, print the tree and read it aloud with a colleague. It works as a role play script too. ## What it does not train The game cannot hear tone, silence or timing, and those decide a lot of real calls. It trains what you ask and in what order. That is a deliberate scope, and it is the part a static file can do well. ## Where to play it The game is embedded at the top of the full write-up, [The Hard Buyer: a sales call you can play against a sceptical head of finance](https://brinvik.com/en/resources/the-hard-buyer?utm_source=devto&utm_medium=article&utm_campaign=backfill-the-hard-buyer&utm_content=devto-en), with a film of a whole call and the three downloads. The Danish edition, where Henrik speaks Danish from the first line, is [Den Svære Kunde: et salgsopkald, du kan spille mod en skeptisk økonomichef](https://brinvik.com/da/ressourcer/den-svaere-kunde?utm_source=devto&utm_medium=article&utm_campaign=backfill-the-hard-buyer&utm_content=devto-da). For teams that want to build a buyer from their own lost deals in a day, with customer names stripped before anything reaches Claude, there is an [AI workshop for sales teams](https://brinvik.com/en/services/ai-workshop?utm_source=devto&utm_medium=article&utm_campaign=backfill-the-hard-buyer&utm_content=devto-en-service) built around exactly this exercise.
Top comments (0)