- Go 1.7 or later
Assume a variation of the 8-puzzle called 11d-puzzle. The 11d-puzzle is identical to the 8-puzzle, except for 2 differences:
- the board is a 3x4
- diagonal moves into the empty tile are legal (assume it can be done on a physical board). So we have at most 8 possible moves: UP , UP – RIGHT , RIGHT , DOWN – RIGHT , DOWN , DOWN – LEFT , LEFT , UP – LEFT . The goal configuration of the 11d-puzzle is:
+---+---+---+---+
| 1 | 2 | 3 | 4 |
+---+---+---+---+
| 5 | 6 | 7 | 8 |
+---+---+---+---+
| 9 | 10| 11| 0 |
+---+---+---+---+
$ go get -u github.com/pbgnz/puzzle
$ puzzle 1 0 3 7 5 2 6 4 9 10 11 8