A tiny transformer that plays the Pauper Selesnya Bogles deck (green-white auras) in a real Magic: The Gathering rules engine (Argentum). Its only job is to kill a goldfish, an opponent with 60 Islands that never does anything, in as few turns as possible: put one creature on the battlefield, stack every aura on it, attack. The hero is always on the play.
On the 1000 test games (seeds 10000–10999, run once) it wins on turn 5.646 on average,
10.8% of games by turn 4, 52.7% by turn 5, win rate 99.7%. It makes 3.08
real decisions per turn. Its companion mulligan scorer (mulligan.py) takes the keeps and
London bottoms.
Watch it and the other decks' models play: the goldfish player.
| folder | budget | kill turn | by turn 4 | by turn 5 | win rate | difficulty |
|---|---|---|---|---|---|---|
/ |
standard | 5.646 | 10.8% | 52.7% | 99.7% | 3.08 |
The model was trained with the fixed budget every deck gets, from scratch: clone the rules oracle (4000 games), label a mulligan scorer, two cycles of expert iteration (3 rounds × 480 games each, the mulligan scorer relabelled in between), checkpoint chosen on 1000 validation games. Games not won by turn 12 count as 13.
Bogles is decided in the opening hand: the mulligan scorer alone gained 0.42 turns over the hand-written keep rule, and expert iteration about 0.04 more.
Every decision the rules engine asks for becomes one sequence of tokens: a global token (turn, life, lands, cards drawn and spells cast this turn, decision kind, phase, the library), one token per card you can see with its zone, and one token per legal option. A 3-layer transformer (width 64, 4 heads) scores the option tokens; the softmax runs over legal options only.
Bogles adds three things to the shared inputs:
target (which creature gets an aura), search (library picks) and
color (Utopia Sprawl, Benevolent Blessing);A separate MLP (mulligan.py, weights in mulligan/) predicts the mean kill turn of keeping a
hand with a given set of cards on the bottom, trained on simulated games played by this model's
predecessor. A mulligan is worth turn 6.59 to six, 7.08 to five and
7.87 to four (mulligan/constants.json). Keep when the best keep beats it.
import sys
from huggingface_hub import snapshot_download
from safetensors.torch import load_file
path = snapshot_download("vedalken/gw_bogles")
sys.path.insert(0, path)
from model import Policy, collate, featurize
policy = Policy()
policy.load_state_dict(load_file(f"{path}/model.safetensors"))
policy.eval()
# msg = {"kind": "main", "options": [...], "state": {...}} (an Argentum bridge request)
# logits, value = policy(collate([featurize(msg)]))
deck.dck, main deck only) and 12 turns maximum.model.safetensors, config.json, results.json: weights, network size and source, test
summary.model.py: featurizer and network with this deck's vocabulary; deck.dck: the deck.mulligan.py, mulligan/: the mulligan scorer.model.safetensors 500.2 kBmulligan/scorer.safetensors 28.9 kB