Eat, grow, and do not bite your own tail.
The arcade classic. Steer with the arrow keys or a swipe, eat to grow longer, and keep clear of the walls and yourself. Three speeds, walls optional.
Snake is one of the oldest video games there is, and one of the most played: it came built into millions of mobile phones in the late nineties. You steer a snake around a board, eating food to grow longer, and the game ends the moment the snake runs into a wall or into itself.
Every piece of food is a point. The snake never stops moving, and every point makes it a little longer — so the board slowly fills with snake, and the space you have to turn in keeps shrinking.
Switching to another tab or app pauses the game, so a message never costs you a run.
Classic is the original: hit the edge of the board and the game is over. No walls lets the snake leave one side and come back on the opposite one, so only your own tail can end the game. It is a different game — the edges become shortcuts rather than hazards.
There are three speeds, from relaxed to fast. Your best score is kept separately for every combination of walls and speed, so a high score on relaxed does not hide a lower one on fast.
It is possible to win: fill every square of the board with snake and there is nowhere left to put the food. On a board this size that is well over two hundred points, and very few games get there — but it can be done.
The rules live in a small set of functions that take the game as it is and return it one step later. The board is drawn on a canvas at whole-pixel squares so the edges stay sharp at any size, and it is sized from your window, so it fills a phone held upright and still fits one held on its side.
Food is always placed on a square the snake is not on, chosen at random from all of them. When the snake's tail is about to move, the square it leaves counts as free — that is why following your own tail is safe.