About
NMBR 9 is a tile-laying game: twenty tiles, two of each number from 0 to 9, are drawn one at a time and each must be placed before the next is seen. A tile scores its number times the level it sits on (the ground is level 0), and to go up a level it must lie entirely on tiles below, on at least two of them. This site runs the num9 engine, written in Rust and compiled to WebAssembly, entirely in your browser.
Hints
Ask for a hint and the engine plays the rest of the game out hundreds of times from each candidate placement, with the tiles still to come shuffled each time (Monte Carlo rollouts), then ranks the candidates by their average final score. After a game it plays the same tiles itself, in the same order and knowing no more than you did, and you can step through its game next to your own. It's a strong heuristic, not perfect play: it can be beaten.
Game analysis
After a game the engine goes back over every move, the way a chess engine reviews a game. It plays the rest of the game out from the position before each move, from your move and from the alternatives, and grades yours by the expected final points it gave away next to the engine's own pick: engine's pick, excellent, good, inaccuracy (?!), mistake (?) or blunder (??). That gives an accuracy for the game and for its opening, middle and end; a graph of the expected final score; a reason for each slip in words; the lessons that cost the most; and a way to retry any move to find a better one.
The highest possible score
With the order of the tiles free, the maximum score is an open problem. Lagerkvist's Nmbr9 as a Constraint Programming Challenge (2020) cites 229 as the best known. The engine designs stacks from the top down (choose what goes on the highest level, then cover it as cheaply as possible, level by level) and found 236 and over a thousand distinct plays above 200. A second search then improves good stacks: it lifts off the top six to twelve tiles and puts them back in the best possible way (an exhaustive search), again and again. It turned a 230 into 241, reaching level 6 with a 7 alone on top. They are in Records.
In the other direction, no play can score more than 354. An integer program assigns tiles to levels to maximise the score, subject to facts every legal stack obeys. These include that a level is never larger than the one below it, and that anything above the ground rests on at least two tiles. The rest are shape facts computed by exhaustive search: how much wider the level below one or two tiles must be, and how much area a level of two or three tiles can hold up. So the true maximum is somewhere between 241 and 354.
Small decks, solved
With only a few tiles the whole game can be searched: every reachable position, counting stacks that differ by sliding or turning as the same. That gives the exact value of perfect play, and the most each deck can score with the order chosen freely. A faster search answers just that last question (any finished stack can be built level by level, and stacks that can't beat the best found are cut short), proving the maximum of decks up to seven tiles in seconds: the Challenges ask you to reach those.
| Deck | Tiles | Positions | Perfect play averages | Best with the order free |
|---|---|---|---|---|
| two 0s and two 1s | 4 | 108 | 1.00 | 2 |
| one each of 0 to 3 | 4 | 398 | 2.33 | 3 |
| one each of 0 to 4 | 5 | 102,763 | 4.22 | 7 |
| two each of 0, 1 and 2 | 6 | 3.5 million | 3.44 | 7 |
| one each of 0 to 5 | 6 | 39.7 million | 8.11 | 16 |
Even on these, not knowing the order costs a lot: perfect play averages between half and three quarters of what the best order would score. Each extra tile multiplies the positions by a hundred or more, so the full game (twenty tiles) is far out of reach.