# Hebi-Ichigo

Hebi-Ichigo Example

Hebi-Ichigo is a puzzle genre made by nikoli.

Cell types

There are two cell types, a white cell and a black cell. Some white cells are going to be numbered to satisfy some conditions. (Some white cells may, and often will, stay blank.)

Interaction

A black cell without a number is simply a black cell. A black cell with an arrow can “look” up in that direction until reaching the edge of the grid or another black cell.

A black cell with a number other than zero means that the black cell, looking in the direction of the arrow in the black cell, encounters that number first. A black cell with a zero means that the black cell, looking in the direction of the arrow in the black cell, doesn’t encounter any number (all cells in that direction are blank).

Now, what about the white cells?

The white cells are occupied by some snakes, indicated by the numbers. Each snake is exactly five squares long. Each snake’s head is number 1, and each snake’s tail is number 5. The snake’s body is composed of numbers 2, 3, 4, in order from closest to head to closest to tail. So, this means, all numbers are grouped into groups of five where all groups contain the numbers from 1 until 5.

Snakes cannot touch each other orthogonally, though they may touch each other diagonally.

The snake’s eyes are located on a side of the head (cell with number 1), opposite from the side its body (cell with number 2) is connected to. So, for example, the snake’s head on R1C2 looks to the right, since the body (2) is to the left of the head.

Snakes don’t see each other. A snake’s vision is the same as a black cell; it looks in the direction of its eyes until a black cell or the edge of the grid is reached.

Objective

Fill some cells with integers between 1 and 5 inclusive to satisfy the above conditions.

Walkthrough of the example

Let’s begin with the most obvious ones, R1C2 and R3C4, which must be 1 and 3 respectively. (Otherwise the black cells on R2C2 and R3C3 don’t point to any part of the snake.)

Now, if there is only one snake, there’s no way the 1 and the 3 are connected with one number. So there must be at least two snakes. In fact, there are exactly two snakes, since three snakes are too many (there are only 13 white cells; if there are three snakes, there would be 15 numbered cells). Obviously the 1 and the 3 belong to two different snakes.

Assume the snake that passes R1C2 is to the right of the 1. Then all cells in the upper-right quadrant are filled, but this means the snake that passes R3C4 touches the snake that passes the 1, contradiction. So the snake that passes R1C2 goes to the left of the 1. We can easily fill it. Obviously R1C3 and R1C4 are now blank, since otherwise, it is looked by R1C2, contradiction. There are precisely 4 unknown cells left, so they must all belong to the same snake that passes R3C4. But which one is the 1; R2C3 or R4C3?

If the 1 is on R4C3, then the 2 is on R4C4 and the snake looks to the left, seeing the 5 of the left snake, contradiction. So the 1 must be on R2C3, and the rest is easy.