Out in the world

Start at four

Every order a program could compute had made the Sylver Coinage search that finishes dearer than trying the smallest move first, and the free oracle that puts a winning move first costs under a third of it. Two orders a game program would actually use do better: a history table of numbers that have won before wins back 27 per cent of that gap, and a fixed order learned on small positions the same on larger ones. Both are learning one thing. Trying the smallest move first, but from four, wins back 31 per cent and beats smallest first on 1,695 of 1,766 positions — because naming 2 leaves a two-generator semigroup, which is symmetric and never lost for the opponent, unless 3 is already reachable.

Assumes: The seven were the order · A parity with a first exception

Sylver Coinage is played by naming positive integers in turn; a number that is a sum of numbers already named may not be named, and whoever has only 1 left to name loses. A position is described by its gaps, the numbers still nameable, and every move closes the largest gap proved that a position whose gaps pair off around the largest — a symmetric one — is never lost for the player to move. The search this essay is about uses that fact at every step: a move that would leave the opponent a symmetric position is struck by a one-pass test and not searched, and among the moves that survive, the search stops at the first that wins.

The order the survivors are tried in decides what that search costs. The seven were the order ran it under five orders over all 1,766 irreducible positions with up to twenty gaps — every one a win for the player to move — and counted closures, one for every move examined. An oracle that puts a winning move first, for free, cut the cost to 29 per cent of trying the smallest move first. Every order a program could compute — largest first, or sorting moves by the largest gap they leave — did worse than smallest first, and the essay closed: the distance between what is available and what is possible is a factor of more than three, and nothing measured closes any of it.

Two moves fewer at every node. Total closures of the Sylver Coinage finishing search over 1766 irreducible positions under eight move orders: a winning move first, for free 444,803, smallest first, from four 1,198,585, a fixed order learned on smaller positions 1,235,721, most often winning first 1,236,529, odd gaps first, the sorting free 1,330,926, most often winning, then odd gaps left 1,418,022, smallest first 1,536,301, a fixed random order 2,529,255, leaving an odd number of gaps first 2,559,245.
Fig. 1 The search that finishes, over all 1,766 irreducible positions to twenty gaps, under eight move orders: total closures, one per move examined. Three orders a program can compute beat smallest first. The cheapest is smallest first starting at four, which gets 31 per cent of the way to the oracle; reading the parity of the gaps a move leaves is a good guess and, paid for, the dearest order of all.

Some of it closes, and the part that closes turns out to be a fact about the rules rather than a trick of search.

The orders a game program uses

Two kinds of order had not been tried, and both are standard in game-playing programs.

A history table keeps a count, for each number, of how often it has been the winning move anywhere in the search so far, and tries the most successful numbers first. It knows nothing about the position; it only remembers. It costs no closure to consult, so it is lazy in the sense that matters here: the search still examines one move at a time and stops at the first winner. The table here is reset for each position searched, so each search learns only from itself.

A fixed learned order is the same idea done once, in advance, by the program’s author. Count which numbers win in the searches of small positions, sort them, and ship the sorted list. Here it is taught on the positions with at most fourteen gaps and tested on the 1,448 with fifteen to twenty, so that what it learned is not the answer it is scored on. And as a control there is the order that knows nothing at all: each position’s moves in a fixed random order, as cheap to follow as smallest first.

And there is a reading the census already offers. A parity with a first exception found that a position with an odd number of gaps is lost for the player to move far more often than one with an even number, so a move that leaves an odd number of gaps is the better first guess. That order has to compute every move’s result before it can sort them, and it is eager: at every position it expands it pays for the whole move list.

Every order, position by position. Seven move orders for the Sylver Coinage finishing search against smallest first over 1766 positions: median closures, positions made cheaper and dearer, and the share of the gap to the oracle won back, over all positions and over those with more than 14 gaps.
Fig. 2 Each order against smallest first: whether it is lazy, its median cost, the positions it makes cheaper and dearer, and the share of the gap to the oracle it wins back — over all positions, and over the positions with more than fourteen gaps on which the learned order was not taught.

The random control loses badly, for a reason that turns out to be the key to the rest, and it is taken up below. The history table wins back 27.5 per cent of the gap between smallest first and the oracle. It is the first order a program could compute that beats smallest first at all, and it beats it on 1,489 of the 1,766 positions. The learned order does the same on the positions it never saw — 27.3 per cent — so what the table learns in a search is not specific to that search. And the table and the learned order agree about what to try first.

The table learns to skip two and three

The table learns to skip two and three. The numbers most often found winning by the history table over all 1766 searches — 4, 9, 6, 5, 8, 7 and on — with their place in the fixed order learned on smaller positions, which begins 4, 6, 5, 7, 8, 9.
Fig. 3 The numbers most often found to be the winning move by the history table, over all 1,766 searches, with their place in the order learned on the smaller positions. Both put 4 to 9 at the top. Two and three, which smallest first tries before anything else, are far down both lists.

The most frequent winning moves are 4, 9, 6, 5, 8 and 7. The learned order begins 4, 6, 5, 7, 8, 9. What both have discovered is not a ranking among the middle numbers, which they disagree about, but that 2 and 3 almost never win — and smallest first tries them first, at every position of every search.

That suggests an order that needs no learning at all: smallest first, but starting at four, with 2 and 3 tried last. It is as lazy as smallest first — it reads nothing but the numbers — and it is the cheapest order in the census. It wins back 31 per cent of the gap, beats smallest first on 1,695 of 1,766 positions and loses on 67, and does slightly better than either kind of learning. Everything a program learns about the order, on this census, is one fact about two numbers.

Why two and three almost never win

The fact has a count and, for 2, a proof.

Two and three almost never win. At 1099 won Sylver Coinage positions, the legal moves 2, 3 and 4 or more, by whether they are struck, lose otherwise or win: 2 is struck on 1053 of 1086 and wins on 33, 3 wins on 13 of 1066, and moves from 4 up win on 1751 of 8684.
Fig. 4 Every won position reached in the searches of the positions to fourteen gaps, and each legal move from it: whether it is struck, loses some other way, or wins. Naming 2 is struck at 97 per cent of the positions where it is legal and wins only where 3 is already reachable; naming 3 wins at about one position in eighty; a move from 4 up wins about one time in five.

Over the 1,099 won positions reached in those searches, naming 2 is legal at 1,086. It is struck at 1,053 of them — it would leave the opponent a symmetric position — and it wins at the other 33. It never loses in any other way. Naming 3 is legal at 1,066 and wins at 13. Every move from 4 upward, taken together, wins about one time in five. A search that tries 2 and 3 first is paying two closures at nearly every node for moves that win about once in eighty.

The 2 has a reason, and it is short.

Why 2 is a losing move. Five Sylver Coinage positions, the smallest odd number reachable in each, and the position naming 2 leaves: always the two-generator semigroup generated by 2 and that odd number, which is symmetric and so lost for the player who named 2 — except when the odd number is 3 and only the gap 1 remains.
Fig. 5 Five positions, the smallest odd number reachable in each, and what naming 2 leaves: always the semigroup generated by 2 and that odd number. It is symmetric, so the player who named 2 has handed the opponent a win — except when the odd number is 3 and only the gap 1 remains.

Name 2 and every even number becomes reachable. Every odd number the position could already reach is the smallest reachable odd number, call it o, plus some even number, so it is reachable from 2 and o too. So naming 2 leaves exactly the semigroup generated by 2 and o. A semigroup with two generators is always symmetric — its gaps are the odd numbers below o, and they pair off around the largest — and a symmetric position is never lost for the player to move. The opponent moves next. Naming 2 therefore loses, unless the opponent has nothing to move to: that is the case o = 3, where the only gap left is 1 and the opponent is forced to name it. Those are the 33 wins in the census, every one.

The argument is the middle-game version of a fact about openings. The game that is a number system lists 2 among the losing first moves, and the reason is the same two lines run from nothing: after 2 the opponent names 3, the only gap left is 1, and the player who opened must name it. Once the game is under way the opponent cannot always name 3 — it may already be reachable, or the position may make it a mistake — but the opponent does not need to. Whatever odd number the position already reaches, naming 2 hands over a symmetric position, and the pairing removes moves it cannot name is where that fact became the one-pass test the search uses to strike such moves — the test that, applied to 2, strikes it at almost every node.

For 3 there is no such proof, and the count says why the order does not need one. Naming 3 is struck about half the time and loses the other half, and the positions where it wins are rare enough that trying it last costs almost nothing.

So the order that works is not a heuristic in the sense of a guess about positions. It is the consequence of a theorem about one move, which smallest first — by trying the smallest number first — reliably runs into at every node.

A good guess that costs more than it saves

The parity reading shows the other side of the same lesson.

The price of reading the position. The parity order for the Sylver Coinage finishing search with its sorting free (1,330,926 closures) and charged (2,559,245), and after a history table (1,418,022), against smallest first at 1,536,301.
Fig. 6 The parity order — moves leaving an odd number of gaps first — with its sorting free and with its sorting charged, and placed after the history table. Free, it wins back nearly a fifth of the gap; charged a closure for every move it sorts, it costs almost twice smallest first.

As a guess, the parity is good. With its sorting done for free — every move’s result computed without charge, only the moves the search then examines counted — it wins back 18.8 per cent of the gap, which is most of what the history table wins. Charged for its sorting, it is the dearest order in the census: 2.56 million closures against smallest first’s 1.54 million, 94 per cent of the gap the wrong way. Put after the history table, sorting only the moves the table has not promoted, it gives back most of what the table won.

That is the finding of the seven were the order again, with a sharper instrument. There the best predictor among the eager orders was dearer than smallest first; here the free version of an eager order separates the two things an order does. It guesses, and it pays to guess. On Sylver Coinage the guessing is worth about a fifth of the gap and the paying is worth more than the whole of it, so no eager order can win. Every order that wins anything back is lazy.

The order the moves are tried in found the opposite on Domineering, where trying first the move that leaves the opponent fewest replies cut a who-wins search twenty-seven-fold against the worst order. The difference is the price of the reading. A Domineering reply count is a scan of a small board; a Sylver Coinage reading is a closure, which is the unit the search is charged in. When reading a position costs as much as searching it, the only affordable orders are the ones that read nothing.

Why smallest first was hard to beat

Starting at four is a small change to smallest first, and it is fair to ask why nothing larger works — why every order that reads the position loses, and why a program cannot simply do better by looking harder.

Two places earlier at the root. The place of the first winning move among the moves tried at the root of each of 1766 Sylver Coinage positions, under smallest first and smallest first from four: mean 8.65 against 6.93.
Fig. 7 At the root of each of the 1,766 searches, the place of the first winning move among the moves tried, struck ones included, under smallest first and from four. Starting at four moves the first winner about two places earlier — the two moves it skips — and still leaves it nearly seven moves in on average, among sixteen moves with fewer than two winners.

At the root, starting at four moves the first winner from an average of 8.65 moves in to 6.93: the two places are the two moves it skips. That is still no better than chance. A position has sixteen moves on average and fewer than two winning ones, and 906 of the 1,766 have exactly one; a winner drawn at random from sixteen would sit about as deep. So at the level of which move to try first, neither order knows much.

A fixed random order — each position’s moves shuffled by a hash of the position, as lazy as smallest first and costing nothing to compute — makes the point from the other side. It is the dearest lazy order in the census: 2.53 million closures, 91 per cent of the gap the wrong way, dearer on 1,227 positions than smallest first. If where the winner sits at the root were what mattered, a random order would cost about what smallest first does. It costs two thirds as much again.

What smallest first has, and a random order lacks, is a property of the moves it examines before it finds the winner. Naming a small number makes many other numbers reachable — every multiple of it, and every sum with what is already there — so the position it leaves has few gaps, and refuting it, or striking it, is cheap. A search that tries small numbers first spends its failures on small subtrees. A random order spends them on large ones. The winner’s place at the root is almost irrelevant beside that, and it is the reason a closure-counting search is so hard to improve with an order that reads positions: the cheapest failures are the ones smallest first already makes, and the only improvement available is to stop making the two that are not cheap but certain — 2, which a theorem strikes, and 3, which almost never wins.

A fixed saving against a growing gap

A fixed saving against a growing gap. The finishing search's cost under smallest first from four, the history table and the oracle, as a share of smallest first's, for positions with eight to twenty gaps: the cheap orders settle near four fifths while the oracle falls to about a quarter.
Fig. 8 Each order’s cost as a share of smallest first’s, by the number of gaps: smallest first from four and the history table settle near four fifths, while the oracle’s share keeps falling, to about a quarter at twenty gaps.

The saving is not the same at every size, and the shape of it says what kind of saving it is. From about ten gaps upward, starting at four costs about 78 per cent of smallest first, and the history table about 80, at every size. The oracle’s share falls steadily, from 57 per cent at eight gaps to 27 at twenty. So the cheap orders save a fixed fraction of each search — roughly the two closures at every node that 2 and 3 used to cost — while the value of knowing the winning move grows with the position. The share of the gap won back is 31 per cent over the whole census, and it would shrink on larger positions.

That is the honest size of the result. The factor of more than three between smallest first and the oracle is not closing; a constant is being taken off it. A constant is still worth having in a search whose cost grows as fast as this one’s does — at twenty gaps a fifth of the work is a fifth of a large number — but it is a different kind of result from an order that knew where the winners were, and it should not be mistaken for one.

The convention, and what the census counts

The positions are the 1,766 irreducible numerical semigroups with at most twenty gaps and Frobenius number above 1, each a win for the player to move. Each is searched from nothing, with a memo that lasts for that search only. A closure is one move examined — the semigroup generated by the position and the named number — and is charged whenever a move is examined, whether or not the search then descends into it. Struck moves are examined and charged, and then skipped. These are the conventions a different question at every depth set for pricing Sylver Coinage searches, kept unchanged so that every total here can be set beside the totals there. The history table is reset for each position; the learned order is built from the winning moves at every won position reached in the searches of the positions with at most fourteen gaps, uncharged.

What the census cannot show

The positions are one family. Irreducible positions to twenty gaps are the positions earlier essays chose because every one is a win; a search from an arbitrary position, or from a real opening, would meet 2 and 3 in different proportions.

The orders are the ones tried. A history table that persisted across positions, or one keyed on the position’s shape as well as the number, might do better; a learned order sensitive to the largest gap might too. And each cheap order falls back on smallest first, so part of every figure is smallest first’s own luck.

Only 2 is proved. The 3 is a count, and so is the one time in five that later moves win.

Still open: what the oracle knows

Starting at four removes a cost that a theorem says was wasted, and what remains between it and the oracle — about two thirds of the gap, and a share that grows with the position — is not wasted in any way a count of closures can see. The oracle’s winning moves are spread over the middle numbers, and the history table’s failure to separate 4 from 9 in any stable way suggests there is no fixed order among them to find. The next measurement is the one that would settle it: for each position, the rank of the first winning move under smallest from four, and whether that rank is predicted by anything the one-pass pairing test already computes — the struck moves come free with the search, and a move whose neighbours are struck might be telling the order something. If nothing predicts it, the Sylver Coinage search has reached the point a move whose every reply is struck and a shortlist with nothing at the top kept arriving at from the other side: the winning move is where it is for reasons only the search can see.

Part 9 of 9

One argument about Sylver. The parts either side of it:

The objects named here

The third axis, after the field and the series: the games, values and theorems themselves, and every essay that touches each one.

Exhaustive searchFrobenius numberGenusHeuristicProofStrategySylver CoinageSymmetry