Four ways to solve the same game. Only one of them learns.
The neural net gets 14 numbers each move: whether something deadly is one step ahead, right or left; which way it's facing; which way the nearest apple is; and how much open room lies each way. That's all — it never sees the board. It starts by moving at random and every crash and every apple nudges it a little. Give it about 300 games before judging it. Its progress is saved in this browser.
Why it never fills the board. Filling all 100 squares takes about 2,400 moves without a single fatal mistake, and it can't see its own body's shape — sealing yourself into a pocket is a mistake you make twenty moves before you die. Nothing in those 14 numbers contains that. More training doesn't teach a fact the input doesn't carry.
Search doesn't learn at all. Every move it finds the shortest route to an apple, imagines eating it, and asks "could I still reach my own tail from there?" If not, that route is a trap and it's thrown away. With no safe route it stalls by following its tail. The mint line is the route it committed to; amber means it's stalling.
Net + search is the two together, and it's how real game-playing systems are built: the network judges, the search verifies. Same trained brain, measured over 25 games — 36 apples alone, 85 with the veto. Mint is what the net wanted, amber is what it was allowed to do.
Walls change the board and, with it, which player still works. Search re-plans every move so it copes for free (93 apples without walls, 73 with). The net keeps its 14 senses and just needs retraining. The perfect cycle stops existing entirely — you cannot build a loop through every square when squares are missing — so that option switches itself off. Each combination of settings keeps its own saved brain, so training on walls doesn't overwrite the one you trained without them.
Whole board vision swaps the 14 hand-picked senses for all 100 squares as three layers — blocked, apples, head — 304 numbers instead of 14. In principle this is the fix for its blindness: the information about self-trapping is finally in the input. In practice it is dramatically worse, and that result is the interesting part. Measured: 14 senses reach 28 apples by game 300 and 39 by game 1,500. Whole board reaches 1.4 by game 1,000 and 4.7 by game 5,000. A higher learning rate didn't help. It is learning — just roughly ten times slower.
Why is worth sitting with. The 14 senses are already relative to the snake: "danger to your right" means the same thing anywhere on the board. The 304 board numbers are absolute positions, so the net has to learn what a wall means at square 14, and then learn it all over again at square 15, and again at square 16. Nothing tells it those are the same lesson. That property — the same pattern meaning the same thing wherever it appears — is exactly what convolutional networks are built to provide, and it is why anything that reads a grid or an image uses them instead of a plain network like this one. Leave it on TURBO for a long while and it does climb.
Two snakes puts a rival on the board that heads for the nearest apple it can safely reach. It counts as a wall that moves, so the danger and room senses pick it up with no changes at all. This is where learning earns its keep: the rival is a rule change that search handles, the cycle cannot survive, and the net can simply retrain against.
The perfect cycle follows one fixed loop through every square, so it cannot hit itself and always wins. It also ignores the apples completely and takes ~2,500 moves. Put obstacles on the board and it stops existing entirely — you can't build a loop through every square when squares are missing.