Temperature

The endgame, accounted for

Add up what each region is worth, then add the biggest thing at stake, subtract the next, and so on down. On a board of simple fights the result is exact — and the moment one region has a fight inside it, the account is out by a point.

An endgame is a sum. The board has broken into regions that no longer interact, each region is worth something on average and has something at stake, and the game is the process of taking them one at a time in some order.

If the order were forced, the arithmetic would be trivial. It is not forced — each player chooses — and the choice turns out to be almost forced anyway, which is what makes an account possible.

The endgame, accounted forSeveral independent regions, each a fight with a settled value and a size. The account plays them hottest first: add up what each is worth on average, then add the largest amount at stake, subtract the next, and so on down. The exact value of the whole position is computed beside it, and the figure prints both.3 independent regions, in order of what is at stakeregionsettles atat stakein the account{4 | 0}22+ 2{3 | 1}21− 1{2 | 0}11+ 1means 5, alternating 2 — the account predicts 7the recursion says Left moving first gets 7the account is exact here — every region is a simple fight between two numbers
Fig. 1 Three independent regions, each a fight between two settled numbers. The account adds what each is worth on average, then adds the biggest amount at stake, subtracts the next, and adds the third. The exact value of the whole position is computed alongside it and the two are printed together.

The account

Order the regions by what is at stake — hottest first. Write down the sum of their mean values, which is what the position is worth once everything has settled. Then correct for who gets what.

Left, moving first, takes the hottest region and gains its temperature over the settled value. Right then takes the next and gains theirs, which counts against Left. Left takes the third, and so on down, alternating.

Left’s score  =  imi  +  t1t2+t3t4+\text{Left's score} \;=\; \sum_i m_i \;+\; t_1 - t_2 + t_3 - t_4 + \ldots

with the temperatures in decreasing order. That is the orthodox account, and it is the working formula of endgame analysis.

For the three regions in the figure — {40}\{4\mid0\}, {31}\{3\mid1\}, {20}\{2\mid0\} — the means are 22, 22 and 11, summing to 55; the temperatures are 22, 11 and 11, alternating to 22. The account predicts 77.

The recursion, asked what Left really gets moving first in the sum of those three games, returns 77.

Why it works

The argument has two halves and both are short.

Hottest first is right. If a player takes a smaller region while a larger one is available, the opponent takes the larger, and the difference between the two temperatures is lost. That is the practical content of temperature, and against simple switches it is exact rather than approximate.

The alternation is forced. Once a region has been taken it is settled and contributes only its (now determined) value; the next player faces the same problem with one fewer region. So the sequence of moves is: hottest, next, next, down to nothing, with the players alternating throughout.

Put the two together and the score is the settled total plus an alternating sum of what each player gained by moving when they did. Nothing else is available to either of them.

Move where it is hottestFour independent components of one position, ordered by temperature. The temperature is how much a player loses by moving somewhere else instead, so the hottest component is the one to take — and a component that is already a number has no temperature at all, because nobody gains by moving in it.{6 | 0}t = 3a big fight{2 | 0}t = 1a smaller one{1 | 0}t = 1/2small change{0 | 1}no temperaturesettled — a numbercomponenthow much is at stakethe whole position is worth {{{19/2 | 17/2} | {15/2 | 13/2}} | {{7/2 | 5/2} | {3/2 | 1/2}}}and the first move goes in the hottest part, which is a theorem up to a small error rather than a rule of thumb
Fig. 2 The ordering the account depends on. Four components ranked by what is at stake, with the settled one — a number, whose temperature is negative by convention — last. The account is this ranking, taken in turns, with the signs alternating.

Where it fails

The account is exact for sums of simple switches and it is not exact in general. The failure is specific enough to construct, and constructing it is more use than describing it.

The endgame, accounted forSeveral independent regions, each a fight with a settled value and a size. The account plays them hottest first: add up what each is worth on average, then add the largest amount at stake, subtract the next, and so on down. The exact value of the whole position is computed beside it, and the figure prints both.4 independent regions, in order of what is at stakeregionsettles atat stakein the account{4 | 0}22+ 2{5 | {3 | 1}}7/23/2− 3/2{3 | 1}21+ 1{2 | 0}11− 1means 17/2, alternating 1/2 — the account predicts 9the recursion says Left moving first gets 10the account is out by 1 — a region with a fight inside it is not a simple one
Fig. 3 The same three regions with a fourth added — one whose Right option is itself a fight rather than a settled number. The account predicts nine; the recursion says ten. The difference is one point, and it is not a rounding error.

The added region is {5{31}}\{5 \mid \{3 \mid 1\}\}. Left may take it and get 55. Right may move in it, and what Right’s move produces is not a number — it is another fight, worth {31}\{3\mid1\}, which somebody still has to resolve.

That is the structure the account cannot see. Its whole model is “each region is taken once and then it is settled”, and this region is not settled after one move. A player who takes it has not finished with it; there is a second move in there, and the second move happens at a different temperature from the first.

Formally: the region’s thermograph has a bend. Its temperature — the height at which the walls finally meet — is one number, and the height at which its inner fight cools out is another, and the account records only the first.

What a deeper position does to the shapeTwo thermographs. The first is a simple switch and its walls are straight; the second has an option that is itself a fight, and the wall bends where that inner fight cools out. Every bend in a thermograph is a decision changing hands.24012345{4 | 0}temperature 2 · mean 224012345{4 | {2|0}}temperature 3/2 · mean 5/2
Fig. 4 The two shapes, side by side. A simple switch has straight walls and one temperature. A position with a fight inside it has a wall that bends where the inner fight cools out, and the two heights are two different things a player has to know about.

Following the line of play

The account is a formula, and a formula is easier to trust after the play it summarises has been walked through once.

Start from the three simple regions. Left moves first.

Left takes {40}\{4\mid0\}, the hottest, and it becomes 44. The board is now 4+{31}+{20}4 + \{3\mid1\} + \{2\mid0\}.

Right takes {31}\{3\mid1\}, the hottest remaining, and holds it to 11. The board is 4+1+{20}4 + 1 + \{2\mid0\}.

Left takes {20}\{2\mid0\} and it becomes 22. The board is 4+1+2=74 + 1 + 2 = 7.

Seven, which is what both the account and the recursion said. And the arithmetic of the account is visible in the walk: the settled total 2+2+1=52+2+1 = 5 is what the regions would have come to if every fight had been split down the middle, and the corrections +2+2, 1-1, +1+1 are what each player gained by being the one to resolve their region.

The order matters and can be checked by departing from it. If Left opens by taking {20}\{2\mid0\} instead, Right takes {40}\{4\mid0\} and holds it to 00, Left takes {31}\{3\mid1\} and gets 33, and the total is 2+0+3=52 + 0 + 3 = 5. Two points worse, which is exactly the difference between the temperatures of the region Left should have taken and the one Left did.

Which part to move inA sum, and every move one player has in it. Each row is a component, the option taken in it, and what the whole position becomes. The values of the parts say who wins; they do not say where to play, and the winning move here is in the component worth the least.{4 | 0} + {3 | 1} + {2 | 0}worth 7 | 3, outcome LLeft to movemove inleavingthe whole position becomesverdict{4 | 0}47wins{3 | 1}3{{9 | 7} | {5 | 3}}wins{2 | 0}2{{9 | 7} | {5 | 3}}wins3 of the 3 moves wineach verdict is the outcome of the whole position after the move, computed rather than judged
Fig. 5 Every move Left has in the same three regions, with the outcome of the whole position after each. The account says which one to take; this listing says which ones win, and on a position of simple fights the two agree — which is the claim the account is making and is not entitled to assume.

What the solver computed, and how

Both numbers in every account figure come from the same machinery, by different routes, and the figure prints them together precisely so that they can disagree in public.

The predicted number is arithmetic on thermograph outputs. Each region’s thermograph is computed; its mean and temperature are read off; the regions are sorted by temperature; the alternating sum is formed.

The actual number is not arithmetic at all. The regions are added with add into a single game, that game’s thermograph is computed from scratch, and Left’s wall is evaluated at zero tax — which is precisely “what Left gets moving first”, by the definition of the wall.

The two computations share the thermograph recursion and nothing else. One of them never forms the sum; the other never looks at an individual region.

The site’s gate requires the first arrangement to agree exactly and the second to disagree. A check that only demanded agreement would pass just as well if the alternating sum were replaced by something that happened to be right on one example, and a check that only demanded disagreement would pass on a broken thermograph. Requiring both, on the same machinery, is what makes either worth anything.

The same discipline governs where the account’s inputs come from. A temperature quoted here is not half the gap between two options — that formula is only right for a simple switch, and the whole point of the second figure is a region where it is not right. Every temperature is the height at which the two walls of a computed thermograph meet, found by solving for the crossing on the interval where the sign of their difference changes. For a simple switch the two agree, and the agreement is a consequence rather than an assumption.

Where the model stops

Sente and gote. The largest omission in the account as stated is the distinction between a move that demands an answer and one that does not. A sente move is one whose threat is so large that the opponent must reply locally, so the mover keeps the initiative and effectively moves twice. The alternating sum assumes strict alternation and does not model that at all, and every serious treatment of Go endgames spends most of its length on it.

Regions with several bends. The failure above is the smallest case. A region whose thermograph bends twice needs the account applied twice at different heights, and the general version of that is considerably more involved than an alternating sum.

Ties in temperature. When two regions have equal temperature the ordering is not determined, and the account gives the same answer either way — but the play may differ, and which one is taken first can matter through an infinitesimal that the temperatures cannot see.

The decomposition has to be real. Every region must be genuinely independent. In a real board the regions are separated by walls that are themselves part of the position, and deciding whether two regions interact is not something the account can do — in some games the separation only arrives partway through the play.

Normal play, and no chance. As everywhere here.

A switch, its mean and its temperaturePositions of the form {a | b} with a above b: both players want to move there, so neither is settled. The bar spans the two options, the marked point is the mean the position is worth once the fighting is over, and the temperature is half the gap — which is exactly what moving first is worth.05{4 | 0}mean 2t = 2{3 | 1}mean 2t = 1{2 | 0}mean 1t = 1{5 | 1}mean 3t = 2valuethe mean is the midpoint of the two options, and the temperature is half the distance between thema switch is worth nothing on average and everything to whoever moves in it
Fig. 6 The regions the account is comfortable with. Each is a fight between two settled numbers: one bar, one mean, one temperature, one move and then it is over. The account is exact on any collection of these and on nothing more complicated.

How large the error can be

The failure above cost one point. The useful question is whether it can cost more, and the answer is the reason the account is used at all despite being wrong.

The error is bounded by the largest temperature in the position. Whatever the internal structure of the regions, a player following hottest-first finishes within t1t_1 of optimal, and usually far closer. On an endgame with one large fight and a dozen small ones, that bound is a small fraction of the total; on an endgame that has come down to two regions of equal size, the bound is the whole of what is left.

So the account is a good approximation exactly when the temperatures are spread out and a poor one when they are bunched — which is a statement a player can act on, and is the same shape as the observation that knowing the values does not settle where to move. A position with one clearly biggest move is easy and the theory says so; a position with three moves of equal size is hard and the theory says that too.

The endgame, accounted forSeveral independent regions, each a fight with a settled value and a size. The account plays them hottest first: add up what each is worth on average, then add the largest amount at stake, subtract the next, and so on down. The exact value of the whole position is computed beside it, and the figure prints both.3 independent regions, in order of what is at stakeregionsettles atat stakein the account{8 | 0}44+ 4{3 | 1}21− 1{1 | 0}1/21/2+ 1/2means 13/2, alternating 7/2 — the account predicts 10the recursion says Left moving first gets 10the account is exact here — every region is a simple fight between two numbers
Fig. 7 An endgame with the temperatures well separated: one large fight and two small ones. The account is exact here, and would remain a good estimate even if a region had structure the account could not see, because the error a single bend can introduce is small relative to the leading term.

What the account is not saying

Three misreadings are easy and all three change the claim substantially.

It is not saying the score is the sum of the means. That is the first term only, and the alternating correction is not a small adjustment to it — in the worked example it is two points out of seven. A player who counts territory and stops has computed the settled total and omitted the entire question of who moves.

It is not saying that the biggest move is the most valuable. Temperature is what is at stake in a region relative to its own settled value. A region with temperature 11 and mean 2020 contributes twenty points to the total and one point to the fight, and the fight is what the ordering is about. Confusing the two produces the common error of playing where the points are rather than where the decision is.

It is not a claim about a specific board. The account takes a decomposition as given. Everything in this essay is arithmetic on regions that have already been identified, evaluated and confirmed independent, and none of those three steps is what the account does.

A position is the sum of its partsFour separate Hackenbush sprigs. A move is a move in one of them, so the position is their disjunctive sum, and its value is the sum of their values. Which part to play in is the entire decision, and the values are what makes it decidable.3/2+−3/2+1/2+−1/2=0outcome Peach sprig is a separate game; a move is a move in one of themthe total was computed by adding the games, not the labels
Fig. 8 The step that comes before the account and is not part of it. Several components, each evaluated on its own, with the total computed by adding the games rather than the labels. Producing this picture from a real board is the work; the account is what happens afterwards.

The third misreading is the expensive one in practice, because identifying the regions of a real position is where a strong player’s judgement goes and the theory has nothing to offer there. What the theory offers is a guarantee about what happens after the identification, and the guarantee is exact on simple fights and bounded otherwise.

The generalisation

The correct general object is not a number but a thermograph, and the correct general operation is not an alternating sum but thermographic addition.

The thermograph of a sum can be computed from the thermographs of the parts, in a way that respects the bends — this is the content of the sum theorem for thermographs, and it holds under a condition on the components. Where the condition holds, the whole apparatus becomes exact and the alternating sum is what it degenerates to when every component is a simple switch.

Berlekamp’s endgame theory is largely the work of making that exactness available on real Go positions, and it needed two further ideas: a way to handle sente, and a way to handle the infinitesimals that decide the last few moves. Neither is visible in the account this essay describes, and both are necessary.

The pattern is by now familiar. The simple version is exact on the simple case, the general version is exact and heavy, and the space between them is where a stated error bound lives.

Who found it, and when

The account is folklore among strong Go players in a qualitative form — count the big points, take the biggest, alternate — and has been for centuries. Japanese endgame manuals from the Edo period contain move-value tables that are recognisably the same arithmetic.

The formalisation is Conway and Berlekamp’s, from around 1970, and the thing it added was the bound: not merely that hottest-first is a good idea but that it is within a stated amount of optimal, and that the amount is the largest temperature.

Berlekamp’s later work with students turned the theory into a practical system, and its most-cited result is a series of constructed Go endgames in which the method reliably beat professional players who were using judgement. The professionals were not making mistakes in the ordinary sense; they were using an accounting that could not see the last point, and the method could.

The ladder from here

This anchor began with reading a thermograph — one position, two walls, two numbers. This rung spends those numbers on a whole board and finds the exact conditions under which the spending is legitimate.

Later rungs: sente and gote, and what a move that demands an answer does to the alternation. The sum theorem for thermographs and the condition it needs. Multiple bends, and the account applied at several heights. The infinitesimal endgame, where every temperature is zero and the ups decide. And the practical question of recognising a decomposition on a real board, which the theory does not address and a player cannot avoid.

The thing to carry is the discipline of printing both numbers. An estimate that is never compared with the exact answer is not an estimate; it is a claim, and the two figures on this page differ by one point precisely because both were computed.