Goishi Hiroi

Start on any stone and travel in a straight line, up, down, left or right. You must pick up the first stone you meet — you cannot skip one. On a stone you may turn, but you may never go back the way you came. A stone is gone once collected, so a square you have already emptied is a hole you fly over, and you cannot turn there. Clear the board. Click a stone to start, then click any highlighted stone to travel to it.

the board

An emptied square and a square that never held a stone are the same thing

Everything below rests on one line of the rules: a stone is gone once you pick it up. A traveller looking down a row cannot tell a square that was cleared from a square that was always bare — both are holes to fly over, and neither lets you turn. So how many ways there are to finish depends on the stones that are left, where you stand and which way you arrived, and not at all on which stones used to be there. One table f(remaining, position, arrival) therefore prices every stone layout on a grid at once, and a layout's answer count is just a sum of lookups into it. That is what makes the exhaustive censuses on this page possible: the 1,048,575 non-empty layouts of a 4×5 board are all counted in 827 ms.

gridstone layoutscan be clearedhave exactly one answergenuine puzzles (≥2 stones)sweep
1x66363 (100.0%)600 ms
1x8255255 (100.0%)801 ms
1x101,0231,023 (100.0%)1002 ms
1x124,0954,095 (100.0%)1203 ms
2x36349 (77.8%)600 ms
2x4255183 (71.8%)800 ms
2x51,023691 (67.5%)1001 ms
2x64,0952,641 (64.5%)1203 ms
2x716,38310,197 (62.2%)14013 ms
2x865,53539,691 (60.6%)16039 ms
2x9262,143155,479 (59.3%)180175 ms
2x101,048,575612,069 (58.4%)200761 ms
3x3511352 (68.9%)902 ms
3x44,0952,718 (66.4%)2412 (0.29%)1 ms
3x532,76721,788 (66.5%)275260 (0.79%)10 ms
3x6262,143177,437 (67.7%)3,5823,564 (1.36%)99 ms
4x465,53544,571 (68.0%)416400 (0.61%)25 ms
4x51,048,575751,237 (71.6%)10,31610,296 (0.98%)738 ms

A one-stone board is trivially its own answer, so the last column drops those. It is the interesting column, and on more than half of these grids it reads zero.

A board is a puzzle only if its answer dies when you read it backwards

Take any clearance and run it in reverse. The "never go back the way you came" clause is symmetric in time, so that is not what breaks. What breaks is the holes. Going forward, a move may fly over a stone you collected ten moves ago; going backwards that stone has not been collected yet, and it blocks the way. So a clearance reversed is again a clearance exactly when no move in it ever flew over a square it had already emptied. Call such a clearance clean.

That single sentence decides which boards can be published. If a board's only answer were clean, its reverse would be a second, different answer — so a board with exactly one answer must contain a fly-over. The census checks it rather than taking it on faith: across every layout of the grids below, the number of one-answer boards whose answer is clean is 0.

gridlayouts examinedclearableone answerclearable with a clean answerall answers cleanone answer that is clean
2x42471750175 (100.0%)147 (84.0%)0
2x51,0136810681 (100.0%)545 (80.0%)0
2x64,0832,62902,629 (100.0%)2,033 (77.3%)0
3x35023430339 (98.8%)271 (79.0%)0
3x44,0832,706122,616 (96.7%)1,996 (73.8%)0
4x4 (119,979 sampled)119,97981,43175275,327 (92.5%)58,753 (72.2%)0
4x5 (120,000 sampled)120,00086,1961,16576,618 (88.9%)62,011 (71.9%)0

The shipped boards say the same thing from the other side: every one of them carries at least one fly-over, because it had to. The 8×8 boards average 2.1 of them across 504 moves, which is 10.1% of all moves made.

Which is why small boards hold no puzzles at all

A fly-over needs three stones in a line and a route that collects the middle one early, and on a cramped board there is not enough room to arrange one that also kills every other route. The census walks every layout and finds the floor exactly. No board one row deep holds a puzzle at any width up to 12, and none two rows deep at any width up to 10; 3×3 holds none; 3×4 is the smallest grid that holds any, and it holds exactly 12.

There is a second floor, and it does not move. Across every grid measured, no layout of two to six stones has ever had exactly one answer — the smallest genuine puzzle in this game is seven stones, on every grid where one exists at all. Nor does the sweet spot drift: uniqueness peaks near half the squares.

gridstones in the smallest puzzlestone count with the most puzzlespuzzles thereshare of clearable layouts at that count
3x477 of 12121.83%
3x578 of 151202.52%
3x679 of 181,1283.38%
4x478 of 161922.17%
4x5710 of 203,4642.45%

Clearing a board with a stone on every square

Fill the grid completely and the answer count becomes a clean sequence. A single row has exactly two clearances however long it is — start at one end, walk to the other — and those two are each other reversed, which is the whole reversal argument in miniature. Two rows behave much less simply.

gridways to clear itgridways to clear it
2x281x22
2x3201x32
2x4601x42
2x51721x82
2x65081x162
2x71,5003x364
2x84,4603x4400
2x913,2923x52,004
3x611,936
4x46,984

The 2×n column satisfies a(n) = 4·a(n−1) − a(n−2) − 6·a(n−3) on every term computed, and the tests re-derive each term from the search rather than from the recurrence. None of these sequences is in the OEIS.

The cheapest clause in the rules is not the cheapest to delete

"You may not go back the way you came" is eight words and looks like a tidying-up rule. Delete it and re-run the whole census: more layouts become clearable, and — the surprise — more layouts end up with exactly one answer, because boards that had no answer at all acquire exactly one. The clause is not mainly a filter on answers; it is a filter on which boards are alive.

gridclearable, real rulesclearable, clause deletedone answer, real rulesone answer, clause deletedunique under both
3x42,7183,259 (+19.9%)2423212
3x521,78827,274 (+25.2%)2751,35115
3x6177,437227,637 (+28.3%)3,5826,52218
4x444,57154,427 (+22.1%)4162,928112
4x5751,237917,043 (+22.1%)10,31629,9801,444

The generator cannot sample. It has to climb

There are no clues to place and nothing to minimise here: the board is the stone layout, and moving one stone rewrites every move of the answer. The obvious generator — lay stones down and test — dies fast, and it dies on the stone count rather than on the board size.

gridstoneslayouts testedwith exactly one answerhit rate
6×681,438281.95%
6×6102,044291.42%
6×6122,541160.63%
6×6142,94730.10%
6×6163,23720.06%
6×6182,59400.00%
8×8142,232100.45%
8×8182,21010.05%
8×8221,88200.00%

So the generator builds the answer first. It walks a route stone by stone; any square the walk flies over that has not been decided yet is banned — it must stay empty forever, or a stone placed there later would block a move already committed to. That yields a layout that is at least clearable. Then a hill-climb relocates one stone at a time, keeping any move that does not raise the number of answers, until one is left. On 8×8 with 22 stones, rejection sampling landed a puzzle not once in 1,882 layouts; the climb gets there in a median of 43 answer counts.

shipped boardstonesanswer counts spentrelocations keptrestarts needed
6x614median 17, worst 141median 6median 1
8x822median 43, worst 137median 11median 1
10x1030median 99, worst 177median 38median 1

The ladder, measured both ways

The hint button runs one of five rungs. line is the rules and nothing else. reach notices that every real move joins two stones sharing a row or a column, so the stones still out there must stay connected in that relaxed graph. dead adds the shape of that graph: what remains has to be walked as a path, so it can afford at most two stones of degree one, and a low-degree stone that does not share a line with where you stand can only ever be the last. probe plays each move and lets the cheaper rungs speak. search is the search itself.

Read forwards, a rung is worth the share of the moves along the answer where it leaves exactly one legal move — no guessing needed.

rung6x6: moves it settles8x8: moves it settles10x10: moves it settles6x6: boards it finishes alone8x8: boards it finishes alone10x10: boards it finishes alone
line66.7%59.9%59.1%0 of 240 of 240 of 24
reach72.8%65.7%61.9%0 of 240 of 240 of 24
dead73.7%67.5%63.5%0 of 240 of 240 of 24
probe80.4%71.6%65.7%0 of 240 of 240 of 24
search100.0%100.0%100.0%24 of 2424 of 2424 of 24

Read as pruning, the same rungs are worth the search nodes they delete when proving a shipped board has only one answer.

rung6x6: median nodes8x8: median nodes10x10: median nodes6x6: worst8x8: worst10x10: worst
line2,07864,029.51,400,8554,655103,5053,329,017
reach326.57,44378,181.51,23218,931229,632
dead241.54,75940,897.51,01714,168138,990
probe1693,44529,568.568810,775101,477

The shipped boards

boardboardsstonesmovesturned 90°carried straight onfly-overslongest single movestones that can open it
6x62414312201 (69.8%)87median 1, max 2median 4.5, max 51–1
8x82422504330 (68.8%)150median 2, max 4median 6, max 71–1
10x102430696436 (64.9%)236median 3, max 8median 8, max 91–1

The first move of a board has no predecessor, so the turn columns are counted over moves minus boards. Every shipped board opens on exactly one stone, and every one of them carries a fly-over — not by editorial choice but because a board without one cannot have a single answer. The stone you are standing on is also the only thing that tells you where you may go next, which is why the cheap rungs stall around 64% on the largest boards: two thirds of the moves along the answer are forced, and the rest need the search.