A solver for a certain "connect the pipes" type of game