TellmarkBot board

Beat the house bot

Tellmark is a trading game with hidden cards. One of the three table bots knows more than you, and at some point the news changes the game. Write a bot that plays it.

95.1

house bot, mean score over 50 hidden deals

How it works

  1. Get an API key below. Play the game by hand first at tellmark.plsintro.com, so you know the rules.
  2. Practice: up to 30 games per UTC day. After each game you see who each bot was and the settings it played with.
  3. Final: 50 hidden deals, one final per 24 hours. Your score is the mean of the 50 games. A game you leave counts as 0. Your best final goes on the board.

The game is the same as the human game, with three changes:

Score: the same 0-100 card as for people. Edge (chips vs. holding your dealt cards), Calibration (your target guess and its confidence), Adaptation (trades in the 60 s after the shock), Discipline (trades against the bots that know or pretend to know).

Get an API key

The top 3 bots of the season get an intro to two hiring teams through plsintro. One key per email.

Protocol

WebSocket: wss://tellmark.plsintro.com/bot?key=KEY&mode=practice&games=N or mode=final. One open connection per key.

Server sendsMeaning
hellomode, number of games, seats (0 = you, 1-3 = Ada, Kai, Rio), suits
gamea new game starts
statestep, phase, round, timeLeft, hand, chips, cards, net, books, trades, shock, perCard, reveal, error. Answer every state with exactly one act.
resultscore of the game (practice: full card + bot kinds + settings)
finalyour final score

You send {"t":"act","step":S,"a":ACTION}, where ACTION is one of:

null                                                  pass
{"t":"quote","suit":"circle","side":"bid","price":7}  bid or offer (side "ask")
{"t":"cancel","suit":"circle","side":"bid"}
{"t":"take","suit":"circle","dir":"buy","limit":9}    lift the offer / hit the bid ("sell")
{"t":"guess","suit":"bar","confidence":0.8}           phase "guess", confidence 0.25-1
{"t":"answer","seat":2,"why":"..."}                   phase "question", seat 0-3

Phases: trading (240 steps per round), guess, reveal (send null), then round 2, then question. A trade clears every quote in the game.

Example bot (Python)

Download tellmark_bot.py. It plays legal but weak moves and scores about 66. A bot that does nothing scores about 50.

# Tellmark bot track: minimal example client.
# pip install websockets   (version 12 or newer)
# python tellmark_bot.py tm_yourkey            -> 1 practice game
# python tellmark_bot.py tm_yourkey final      -> your final (50 hidden deals, 1 per 24 h)
import json, random, sys
from websockets.sync.client import connect

KEY = sys.argv[1]
MODE = sys.argv[2] if len(sys.argv) > 2 else "practice"
URL = f"wss://tellmark.plsintro.com/bot?key={KEY}&mode={MODE}&games=1"
TWIN = {"circle": "square", "square": "circle", "triangle": "bar", "bar": "triangle"}


def decide(s):
    """Return one action for this step, or None to pass."""
    hand = s["hand"]
    # The suit you hold most is often the 12-card suit, so its twin is a fair first guess for the target.
    target = TWIN[max(hand, key=hand.get)]
    if s["phase"] == "guess":
        return {"t": "guess", "suit": target, "confidence": 0.4}
    if s["phase"] == "question":
        return {"t": "answer", "seat": random.choice([0, 1, 2, 3]), "why": "example bot"}
    if s["phase"] != "trading":
        return None
    ask = s["books"][target]["ask"]
    if ask and ask["player"] != 0 and ask["price"] <= 6:
        return {"t": "take", "suit": target, "dir": "buy", "limit": ask["price"]}
    for suit, n in hand.items():
        bid = s["books"][suit]["bid"]
        if suit != target and n > 0 and bid and bid["player"] != 0 and bid["price"] >= 3:
            return {"t": "take", "suit": suit, "dir": "sell", "limit": bid["price"]}
    return None


with connect(URL) as ws:
    for raw in ws:
        m = json.loads(raw)
        if m["t"] == "state":
            if m.get("error"):
                print("rejected:", m["error"])
            ws.send(json.dumps({"t": "act", "step": m["step"], "a": decide(m)}))
        elif m["t"] == "result":
            print("game", m["game"], "score", m["total"])
        elif m["t"] in ("final", "msg", "hello"):
            print(m)