Thuruppu: An Agentic Card GamePart 1 of 4

Build note

Three agents at one card table

Twenty-eight is a small game with a lot of hidden information. Four players use 32 cards, and the bidding team needs to collect enough of the deck’s 28 points to make its contract. The game has only eight tricks, but a decision still depends on the cards already played, what might remain in each hand, and whether the partner or an opponent is winning the current trick.

I wanted the three computer-controlled seats to feel like players with their own roles. I did not want to make a language model responsible for enforcing the rules or counting every possible card. The project gives each seat an agent profile, then shares the game and decision machinery underneath.

A profile gives a seat its identity

The defaults are Raman, the partner, and Krishnan and Kunjappu, the opponents. Each AgentProfile has a name, a persona key, a strategy description, a model provider, a model name and a temperature. The settings page and environment variables can change the model configuration for each seat.

That makes each persona a logical agent in the game. It does not create three separate inference servers. On a turn, the game looks up the profile assigned to the current seat and passes it to the shared decision pipeline. The three agents can use different providers or models, but the defaults can also send all three through the same provider and model.

There is a useful detail in the profile code: the persona key and the strategy text are separate fields. A key such as aggressive_opponent is only a label. The strategy text is what the prompt actually tells the model to do. In the checked-in defaults, some strategy descriptions are more restrained than their persona names suggest. That is a reminder to inspect the prompt, not assume a label guarantees a playing style.

The rules engine keeps the table honest

The game engine owns the deck, legal moves, trick winners, points and match state. The LLM receives a view of the current player’s hand and game state. Its answer is parsed and matched against the legal moves available for that turn. If the answer cannot be used, the pipeline can retry and fall back rather than apply an invented move.

The division of work changes by phase. Bidding, choosing trump and rebidding use the LLM. In the default search play mode, Monte Carlo search chooses which card to play. It samples possible hidden-card distributions and estimates whether the bidder’s team will make its contract. The search also respects observed voids: if a player could not follow a suit, that is evidence they no longer hold that suit.

There are hybrid and llm play modes too. Hybrid gives the model the search’s move evaluations and lets it choose among legal cards. The LLM-only mode asks the model to choose without that simulation. These are different trade-offs, not different game rules.

A persona is more than a temperature

Temperature can make a model’s responses more or less varied, but it does not define an agent on its own. In this project, the profile, the current game view, the strategy instructions and the decision mode all shape what happens. A conservative partner and a risk-taking opponent are meaningful only if those instructions lead to different choices in the same kind of situation.

The design I keep coming back to is simple: let code handle facts that must be correct, let search handle the combinatorial card-play problem, and use the language model where a strategy explanation or a judgment call is useful. The personas give the seats character. The engine and search keep that character inside a game that still follows its rules.

How this was made

  • Written by: Rupesh, from the thuruppu game engine, agent profiles, prompts and decision pipeline, with AI drafting and editing.
  • The agent names, profile fields and default play mode describe the checked-in source. Provider and model settings can be changed per seat.
  • AI-assisted sections: structure, explanations and copy editing.