Guide
Snake Game Reversal and Tail Collision Rules Explained
Learn why Snake blocks 180-degree turns, when moving into the tail is legal, how growth changes collision timing, and how to verify each case.

Snake Game Reversal and Tail Collision Rules Explained
In classic grid Snake, you cannot reverse direction by 180 degrees into the segment directly behind the head. Moving into the square currently occupied by the tail can be legal, but only when the tail will move away on that same tick. If the snake has just eaten and is growing, the tail stays put, so entering that square is a self-collision.
That distinction explains two moments that often look inconsistent: an opposite-direction key appears to do nothing, while a tight turn through the old tail square sometimes succeeds. The game is resolving movement in time, not checking a frozen screenshot.
The two rules at a glance
| Situation | Classic result | Why |
|---|---|---|
| Press the exact opposite direction | Input is ignored | The head would immediately enter the neck |
| Turn left or right | Direction changes | The next cell is not the neck by definition |
| Enter a middle body segment | Collision | That segment remains occupied after the tick |
| Enter the tail's current cell on a normal move | Usually legal | The tail vacates the cell during the same tick |
| Enter the tail's current cell while growing | Collision | Growth keeps the tail in place for that tick |
| Hit a wall in a bounded version | Collision | The new head position is outside the board |
| Cross an edge in a wraparound version | Continues on the opposite edge | That variant replaces wall collision with wrapping |
These are common rules, not a universal specification. Snake has many versions, so check whether a particular game uses walls, wrapping, obstacles, delayed growth, or buffered turns.
Why a direct reversal is blocked
Suppose the snake is moving right. The neck is one cell to the left of the head. If the game accepted a left input immediately, the new head would occupy the neck's cell and the run would end without giving the player a meaningful turn.
Most classic implementations therefore compare the requested direction with the current direction:
| Current direction | Rejected direction | Legal turns |
|---|---|---|
| Up | Down | Left or right |
| Down | Up | Left or right |
| Left | Right | Up or down |
| Right | Left | Up or down |
The rejected key normally does not pause or rotate the snake. It simply leaves the current direction unchanged. This matters when inputs are pressed quickly: if you are moving right and tap down then left before the next movement tick, different games may either preserve both buffered turns or keep only the last valid one.
When can the head enter the tail's square?
The answer depends on whether the tail moves during that tick.
Consider this short snake on a grid:
H → A → B → T
The head is H, the middle body cells are A and B, and T is the tail. On an ordinary move, a new head is added and the old tail is removed. The set of cells occupied after the move therefore excludes the old T square. A route into that square can be safe.
When food has just been eaten, the snake grows by adding the new head without removing the tail. The old T square remains occupied. Entering it is then a collision.
A four-state collision check
This table is an independently verified state matrix for the edge case:
| Next head cell | Growing this tick? | Tail vacates? | Result |
|---|---|---|---|
| Empty cell | No | Yes | Legal move |
| Current tail cell | No | Yes | Legal in the tested classic implementation |
| Current tail cell | Yes | No | Self-collision |
| Any non-tail body cell | Either | Not relevant | Self-collision |
The useful test is not “does the screenshot show a body segment there?” It is “will that segment still be there after this movement step?”
The movement order that produces the rule
A consistent Snake engine can resolve each tick in this order:
- Read the requested direction.
- Reject it if it is the exact opposite of the current direction.
- Compute the next head cell.
- Reject walls, obstacles, or other forbidden cells.
- Determine whether this move grows the snake.
- For a normal move, check the new head against the body without the departing tail. For a growth move, check against the full body.
- Add the new head and remove the tail only when the snake is not growing.
Changing that order creates familiar bugs. Checking collision against the full old body before deciding whether the tail moves produces a false game over. Removing the tail before checking food can make the snake fail to grow. Accepting the opposite direction can send the head directly into its neck.
What we verified in Malaguo's browser Snake
We inspected the active 2.0.2 game build and checked the rule path used by the playable Snake game on Malaguo. The build:
- rejects a requested direction when both direction coordinates are the exact negative of the current direction;
- checks the full body during a growth step;
- excludes the final tail segment from collision checks during a normal step;
- adds the new head first and removes the tail when no growth is pending.
That means the two headline rules are not assumptions: opposite-direction input is ignored, and the current tail cell is safe only when that tail will leave it. You can play Snake in your browser and reproduce both behaviors without downloading anything.
How to verify the rules yourself
Use a slow early round so the result is easy to observe.
- Start the game and note the direction of travel.
- Press the exact opposite key once. The snake should continue in its previous direction rather than turn into its neck.
- Grow long enough to form a compact U-shaped route.
- On a normal tick, steer toward the square occupied by the last tail segment. If the tail moves away on that tick, the move should continue.
- Repeat near food when growth is pending. The tail remains, so the same geometric route should collide.
Do not test the two tail cases on different board shapes and call the difference random. The next head cell, growth state, obstacle state, and input timing must all match.
Buffered turns can change what you see
Fast keyboard input introduces a separate issue. Imagine the snake is moving right. You press down and then left before the next tick. Both commands are individually legal as a sequence, but left is the direct opposite of the currently rendered rightward motion.
A one-input buffer may keep only down. A two-input queue may execute down and then left across two ticks. A game that evaluates every key against the last rendered direction may discard left. These behaviors affect responsiveness, but they do not change the core rule that the head may not reverse directly into the neck.
On touchscreens, use deliberate swipes rather than two nearly simultaneous gestures. On keyboards, leave at least one visible movement step between sharp turns until you know how the version buffers input.
Common mistakes
Treating an ignored key as lag. The opposite input may have been deliberately rejected. Try a perpendicular turn before blaming the connection or keyboard.
Checking collision against the old picture. A tail cell can look occupied and still be safe because the tail moves during the same tick.
Forgetting the growth step. Food normally prevents the tail from advancing for one update. A route that was safe one tick earlier can become fatal.
Assuming every Snake wraps at the edge. Some versions wrap, some use solid walls, and some add internal obstacles. Test the board boundary early.
Sending two turns inside one tick. A quick double input can be queued, reduced to one turn, or partly rejected depending on the implementation.
Practical recommendations for longer runs
- Plan paths using the snake's future occupancy, not just the current body shape.
- Leave one empty lane beside a long body so the head has a route back toward the tail.
- Treat food as a temporary change to collision timing because the tail will not move on that growth tick.
- Avoid unnecessary 180-degree key presses; use two controlled right-angle turns when space permits.
- In tight spaces, follow the tail rather than cutting across the middle of the body.
For another browser puzzle where update order changes the result, see the 2048 corner strategy guide. To browse more short games with immediate controls, visit the free casual games collection.
Frequently asked questions
Can you move backwards in Snake?
Not with a single 180-degree input in most classic versions. You can turn around by making two legal 90-degree turns when there is enough space.
Why does the opposite arrow key do nothing?
The game rejects it to prevent the head from entering the neck. The snake continues in its existing direction.
Is moving into the tail always a collision?
No. It can be legal when the tail vacates that cell on the same tick. It is not legal when growth keeps the tail in place.
Does eating food make tail collision more likely?
For one update, yes. Growth normally adds a head segment without removing the tail, so the old tail cell remains occupied.
Do all Snake games use these rules?
No. The reversal rule is common, but edge wrapping, obstacles, growth timing, input queues, and tail-cell handling vary. Verify the specific version you are playing.