# Gokigen Naname

Gokigen Naname, also known as Slant, is a binary-determination logic puzzle published by Nikoli.

## Rules

Gokigen Naname is played on a rectangular grid in which numbers in circles appear at some of the intersections on the grid.
The object is to draw diagonal lines in each cell of the grid, such that the number in each circle equals the number of lines extending from that circle. Additionally, it is forbidden for the diagonal lines to form an enclosed loop. Unlike many of Nikoli's similar puzzles, such as Hashiwokakero, a single network of lines is not required.

## Solution methods
### Deductions easy to spot

* 4 in the middle of the grid specify its four cells.
* Corners with 0 or 1 specify that cell.
* Borders with 0 or 2 specify those cells.

### Deductions from single numbers

* When numbers 1, 2 or 3 get its connections, one can fill remaining cells The other way around applies: numbers 1, 2 or 3 with that amount unfilled cells and other cells avoiding the number specify the remaining cells points to the number.
* Edge 1 make that cells to have common value (marked "A"), although to be specified.
* Middle 1 or 3 with adjacent common values specify the other 2 opposite cells as both avoiding 1 or pointing to 3. The other way around applies: two adjacent point to 3 or avoiding 1 imply the opposite cells to have common value.
* Middle 2 with adjacent common values ("A" in figure) imply the opposite cells to form another (independent) common value ("B" in the figure). In other words, middle 2 repeat common values (independently), possibly making a chain.
* Middle 2 with adjacent both avoiding or both pointing 2 imply the other opposite cells to repeat the pattern, possibly making a chain.

### Deductions from two numbers

* Adjacent 1 require the intervening two cells to have common value, making the four external cells to form semicircles around 1s.
* Adjacent 3 require the intervening two cells to have common value, making the four external cells to point both 3.
* Adjacent 2 with external lines avoiding both 2 (black in the figure) require other external cells to point 2s and intervening common values.
* Adjacent 2 with external lines pointing both 2 (black in the figure) require other external cells to avoid 2s and intervening common values.
* 2 with an external cell pointing it adjacent to 1 (black in the figure) require the intervening two cells to have common value, making the external cells of 1 to form a semicircle around it.
* 2 with an external cell avoiding it adjacent to 3 (black in the figure) require the intervening two cells to have common value, making the external cells of 3 to point it.
* Two middle 1s in opposite corners of a cell must have a line separating them: otherwise they would form a closed loop.

### Combining techniques

* Adjacent edge 1s repeat common values across the common edge. It may extend around a corner.
* An edge 1 followed by a chain of 2s and 3 force the external cells of 3 to point it: the chain of 2s repeat the border common value (each pair independently) until 3, implying the externals pointing 3.
* A pair 1-3 where either external semicircle around 1 (in blue) or external cells pointing 3 (in red) imply each other: one set implies intervening common values, implying the other.
* Middle 1s straightly connected by a chain of 2s imply the external cells to form semicircles around 1s: if not, the first intervening cells between 1 and 2 would point 2, which repeat that pointing to the next until the other 1 get two pointing lines, a contradiction.
* The same reasoning to middle 3s straightly connected by a chain of 2s: the external cells point to 3s.
* A straight chain of 2 with external line avoiding (respectively. pointing) external 2s imply the other external cells to point (respectively avoid) external 2s.

### Deductions to avoid closed paths

* When a square of cells form an open "box" in 3 cells, the next must not close the box.
* A 3 facing a semicircle implies external cells pointing 3 and intervening common values; otherwise internal pointing lines to 3 would close the path.
* A 2 facing a semicircle with an external avoiding line implies the other external cell to point 2 and intervening common values; otherwise, internal lines pointing 2 would close the path.
* The techniques above carry out the same replacing the semicircle by any longer path missing just a corner to be closed.
* No 1–2–1 lines: if a 2 is connected to an internal 1 (not on an edge), it must avoid other internal 1s. A 2 can't be connected to two internal 1s, otherwise a closed path would be formed. The same for a chain: 1–2...2–1 can't be, it must be broken as 1–2...2 | 1.
* A chain on common values crossing a "hall" closable with parallel walls imply the common value that avoids closing the hall.
* All diagonal lines must be connected to the edges of the grid by other such lines. If not, one would immediately create a closed circuit around this line. Therefore, if a network of lines does not touch the edge of the grid, and only has one place where it can touch the edge, then it must do so.