On this page

The idea

A learned evaluator has to attach a number to something. The obvious something is the pair of a situation and an action: from this board, dropping in column 3 is worth so much. But there is a moment between your decision and the next piece of luck that is a better thing to value. Make the move, let everything that clears clear and everything that falls fall, and stop just before the game deals the next disc. That board is the afterstate.

Value afterstates instead of pairs and two things follow. The evaluator never needs to be told which action was taken, because the action's whole effect is already in the picture. And the value of a move never has to be split by what the game does next: whatever the next disc turns out to be, it arrives after the afterstate, so the afterstate's value is one number, an average over the luck still to come.

A small example

Tic-tac-toe against an opponent who plays at random.

  1. A state is the board when it is your turn. An action is a square. An afterstate is the board after your mark is placed, before the opponent's random reply.
  2. Value states directly and you also have to learn, for every state, which of up to nine actions is best. Value afterstates and there is one number per resulting board. To choose, place each candidate mark, look at the value of each afterstate, take the best.
  3. Different pairs of state and action lead to the same afterstate, and they share one value. There is less to learn.
  4. The opponent's reply sits after the afterstate, so an afterstate's value is an average over that reply, learned from experience.
1 · the position2 · the afterstate3 · luck's turn72341your move: the 1 goes in column 637one valueafter every clear and fall has finished37before the next disc is dealtdropdealthe evaluator is shown the ringed board and nothing else about the move
One position from the concept pages' scenario file, generated by web/scripts/generate-concept-scenarios.ts with the TypeScript engine, with a 1 to drop. Left: the board before the move, the 1 held above column 6. Middle: the board after the 1 has landed and every clear and fall has finished, which is the afterstate; the ring marks it and the badge stands for the one number an evaluator gives it. Right: the same board a moment later, with the next disc still unknown. The disc hovers, falls, and the ring flashes as the board resolves; under reduced motion the disc rests above column 6.
  1. To train fairly, label every candidate afterstate at a position, and label them under the same random replies (common random numbers), so the ranking measures the moves and the luck cancels.
  2. The catch. The label is itself an average over imagined futures. With too few futures the "best" afterstate is mostly noise, and you have to check the label's stability before you trust a model trained on it.

How it works

At a position, form every legal afterstate: for each candidate action, apply it and resolve everything that follows without luck. Hand each afterstate to one evaluator, which sees the board and whatever else is public but never the action, and get one number back. Play the action whose afterstate scored highest.

the position7234next disc17234column 17234column 27234column 3724column 41734column 537column 6724column 7one evaluatornever told the columnan ordering, best on the left76.1columns 1, 2, 370.6column 567.6column 655.3columns 4, 7
The same position, with a 1 to drop, and the board each of its 7 legal columns leaves behind, read from the concept pages' scenario file. Columns that leave the same board are one afterstate and share one slot in the ordering, so 7 moves make 4 afterstates here. One evaluator is shown every afterstate without being told which column produced it and returns one number each; the number here is the scenario file's one-move fair look-ahead value (the average, over the seven possible next discs, of the best reply's points), standing in for a learned value. The highlight steps across the boards in turn.

Training the evaluator needs a label for each afterstate: how the game went from there. Since the future depends on luck, the label is an average over imagined futures, played out by some continuation policy. Two decisions matter. Label every sibling afterstate at each position, so that the training data contains the comparisons the evaluator will be asked to make at play time; a corpus built that way is successor-closed. And run the siblings through the same imagined futures, so that a difference between two labels is a difference between two boards. Then, before training anything, check that the labels hold still: split the futures into two halves, rank the siblings under each half, and see whether the two rankings agree.

eight futures per afterstateline length: how long the imagined game lastedafterstate Aafterstate Bafterstate Cfirst half ranks B, A, Csecond half ranks A, C, Bthe halves disagree: the label is noisemany futures per afterstatethe same three afterstates, played out many more timesafterstate Aafterstate Bafterstate Cfirst half ranks A, B, Csecond half ranks A, B, Cthe halves agree: the label holds stillfirst half of the futuressecond half
Toy futures for three afterstates at one position, drawn as thin lines whose length is how long the imagined game lasted. On the left each afterstate was played out eight times; the first four futures are in one colour and the last four in the other, and the two halves rank the three afterstates differently, so the label cannot be trusted. On the right each afterstate was played out many more times, and the two halves agree. The lines redraw and the two halves take turns standing out; under reduced motion everything is shown at once.

In Drop7

A Drop7 afterstate is the board after the visible disc has landed and every wave of clearing, falling and revealing has finished, together with the next visible disc and the moves until the next rise. Everything in it is on the screen. At a position there are up to seven of them, one per legal column, and often fewer distinct ones, because two columns can leave the same board.

Almost every learned evaluator on this site chooses a column this way, by simulating each drop and scoring the board it leaves; the n-tuple family page describes that step. What the afterstate-learning pages add is the training side: labelling every sibling under pinned futures, and testing the labels before trusting them. The concept page on ranking siblings explains the failure this is meant to prevent: a model that has only ever seen the moves that were played, asked to rank the ones that were not.

Pages that use afterstates:

What it cannot do

The one full test of the idea on this site never played a game. Its results are offline ranking comparisons at pilot tier, and they turn on the stability check in step 6.

With eight pinned futures per column the labels were noise. Agreement between the two half-rankings was 0.2457 against a floor of 0.50 fixed in advance, on 2,470 held-out positions, and the spread of outcomes within one column, 20,922 points, was about three times the typical gap between columns, 7,096 points (Distributional afterstate ranker). With 256 futures per column the labels held still, and the verdict was a clean negative: on 2,523 held-out positions the model ranked columns better than the one-move policy that had generated its labels and worse than the fair depth-4 search, with top-1 agreement of 0.4245 against 0.4986, in both halves of the data. Letting the model override the search only on near-ties, and only when its advantage survived a resampling test, improved on the search in both halves and failed its frozen gate in one of them: 0.0075 where 0.01 was required, on 1,030 eligible positions out of 2,689.

The record states its own limitation. The labels are 40-move outcomes under a weak, fixed continuation policy, and the search is scored against that same target, so an offline ranking cannot say what either would do over a whole game. The afterstate takes the action out of the evaluator's input and makes every sibling measurable. It does not make the measurement cheap: the noise in an averaged future is paid for in futures, 256 per column here, before a label is worth training on.