๐Ÿ Snake Game

Score: 0Best: 0

A classic arcade game where you control a snake using the arrow keys (or WASD, or on-screen direction buttons), growing longer each time it eats food. The game ends if the snake hits a wall or itself.

How to use

  1. Click "Start" to begin the game.
  2. Steer the snake with the arrow keys, WASD, or the direction buttons below the board.
  3. Eating food (the red square) grows the snake and increases your score โ€” avoid hitting the walls or your own body.

How the calculation works

Steer a snake around a 16ร—16 grid and eat food to grow. Each piece of food makes the snake one square longer and adds to your score. Hitting a wall or your own body ends the game. The snake moves one square about every 0.13 seconds. Turn with the arrow keys or the on-screen arrow buttons. You cannot reverse straight back the way you are going. Food appears at random on an empty square not covered by the snake.

Worked example

The snake moves about 7.7 squares per second. The board has 16 ร— 16 = 256 squares, so a snake that starts 3 long fills it after eating 253 times in theory. As the snake grows, sweeping back and forth in rows along the edges makes it harder to run into yourself.

Things to be aware of

  • Quick successive turns are queued and applied one per square, in order (up to three). A turn straight back against the direction of travel is never accepted, so fast inputs cannot turn the snake into its own neck.
  • On phones, use the arrow buttons below the board.
  • The speed is constant; it does not speed up as you grow.

FAQ

Can the snake do a 180-degree turn?

No. Pressing the direction directly opposite to the current one is ignored, since it would immediately run the snake into itself.

Can I play this on a smartphone?

Yes, you can tap the on-screen direction buttons below the board.

Does the speed increase over time?

No, the current version runs at a constant speed.