Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

What your model answers

The Ants action is a JSON array with one string per ant in the observation’s mine list. The referee produces it by reading your graph’s policy head, so this page is the contract your output tensor has to meet.

StringMove
NRow −1
EColumn +1
SRow +1
WColumn −1
-Stay

Every move wraps at the map boundary. The contract has no diagonal moves, destinations, ant identifiers or action objects.

One order per ant

For mine: [[12, 30], [13, 30]], the action ["N", "E"] moves the first ant toward [11, 30] and the second toward [13, 31]. The action holds one order per ant in mine, in mine’s order, and zero ants means [].

The two head shapes

Your manifest declares one output, in one of these two shapes. Both carry five channels, in the order N, E, S, W, -, and the referee takes the argmax.

Declared shapeWhat it means
[1, 5, "H", "W"]A per-cell policy. A score for every move at every square of the board. The referee gathers the five channels at each of your ants’ cells, in mine order, and takes the argmax of each. A fully convolutional network produces this shape with no extra work
[N, 5]One row per ant, already in mine order. The referee takes the argmax of each row. N is a named dimension that binds to your ant count, so the same manifest serves every turn

The referee decodes both the same way from there, so pick the one that suits your architecture; the rules treat them alike. The per-cell head costs a gather that the platform pays for. The per-ant head is cheaper on large boards, but your graph has to do the indexing, which limits the axes you can name (why).

Keep training labels, output channels and this table in the same order. With the channel order off by one, your model plays a rotation of what it learned, scores low, and nothing reports an error.

Illegal and missing orders

An ant ordered into water stays where it is. The engine also treats an unrecognised direction string as staying, and ignores surplus positional orders. Your model cannot cause either of those two: the referee produces only the five strings, so those fallbacks guard against a cartridge change.

Admission checks legality. It confirms that each adapter produces a tensor of the dtype and shape the manifest declares, that the graph runs, and that the head decodes to a valid action on every reference observation. It does not judge whether the action is any good. A model that answers ["-", "-", …] every turn is a legal entry that never moves, and an untrained graph does that. Check the distribution of your own actions during testing.

The turn clock

The standard turn deadline is 1,000 ms for your adapters and your inference together, and it is yours alone: each seat is its own call with its own deadline, so a slow opponent cannot spend your clock. A failed or timed-out call adds a strike, and none of the seat’s ants move that turn. At five cumulative strikes the seat forfeits, and successful calls between failures do not reset the count.

A deliberate hold array such as ["-", "-"] is a normal answer, and the referee treats it apart from a call that returns no action. The Ants contract has no resign action; see scoring and forfeits.

A move is an intention

An accepted action does not guarantee that the ant survives or reaches a useful position. Opponents move at the same time, friendly ants can collide, and battle runs before hill razing. Judge your model by the outcomes the turn rules produce, beyond whether its direction strings are valid.

Every order in this match is valid, and the board still does things the orders do not say. Turn 1 sent the ant east onto the food beside its hill: food refuses a move, so the ant stayed on the hill, and it gathered the food from where it stood. Turn 2 moved that ant one square south, and a second ant nobody ordered appeared on the hill it left. Now press the right arrow. Turn 3 gives both ants the same order, east. The ant on the hill walks onto the square the food left empty; the ant below it is refused by water and stays. One order, two outcomes, and the engine received one order per ant, which is what your model has to answer.