Azul Engine Dev log

Against an independent AlphaZero

Every number so far was the engine against itself. So it played an open-source AlphaZero for Azul in that project's own simulator: 81.5% of the points even when the AlphaZero thought longer.

Every result on this site so far compares the engine with itself: the network against the classic evaluation, one generation against the last. That shows progress, not strength. A fair question from anyone reading it: strong compared to what?

The opponent

cestpasphoto/alpha-zero-general is an open-source AlphaZero for several board games, with a pretrained 2-player Azul model that its author describes as much stronger than a 700-rated Board Game Arena player. It is a different approach from this engine: Monte Carlo tree search guided by a deep network that outputs both move probabilities and a value, trained only by playing itself.

A fair setup

The games ran in their simulator, so their rules decided every result. Before writing any code I checked that the rules match: the same wall layout, floor penalties, first-player token, end-of-game bonuses and scores that never go below zero. A short Python script, ml/alphazero_match.py, adds this engine as a player. On each turn it converts their board into this engine's JSON position, asks azul serve for a move over HTTP, and maps the answer back to their action number. Their simulator accepts a seed for the tile draws, so every deal was played twice with the seats swapped, the same paired protocol as every other match here.

The AlphaZero player ran with the settings stored in its own checkpoint. One security detail: their loader unpickles the checkpoint file, which can run code. The checkpoint turned out to load cleanly in PyTorch's weights-only mode, so the script forces that mode.

Results

AlphaZero simulations per moveTime per move (it / us)Result, 200 gamesElo for this engine
100 (its default)22 ms / 19 ms177–23+355 ± 75
800193 ms / 131 ms162–36, 2 shared+258 ± 62

At equal time the engine took 88.5% of the points and won by 18 points a game on average. Giving the AlphaZero eight times the simulations, and more thinking time than this engine, narrowed the gap but did not close it: 81.5% of the points, +15 points a game.

A likely reason, not yet tested: Azul rounds are short and every round ends with a fixed scoring step. An alpha-beta search can solve most of a round exactly, which is what this engine does, and then the network only has to judge the position at the round's end. Monte Carlo tree search samples instead of solving, and in a game decided by a few points, exact tactics within the round count.

Meanwhile, a third self-play run

The fine-tuning loop ran three more generations. Each beat its parent by a margin inside the noise of an 800-game check (+12, +18, +7), but over 3,000 games generation 10 beat generation 7 by +38 ± 12, and it is now the board's brain. Against the classic engine it scored +163 ± 14, level with generation 7's +174 ± 14: the newer networks fix mistakes the classic engine does not punish, so that measure has stopped showing the gains. Another reason an outside opponent matters. (Update: part of this was the machine. On a faster server the classic measure tracks the head-to-head gains again; see the next post.) (The AlphaZero matches used generation 7.)