This simple tool is used to help generate "Pipes Puzzles," which is a type of puzzle involving four tiles, each with a grid of connected pipes.
The solution of the puzzle is to rearrange and rotate the tiles until a complete path is created from the starting point to the end, so water can "flow through" to the end.
This code only works with four-tile pipes.