Meh, it messed up when I post the message. You got the idea I guess. Then the user will solve it by moving the 'x' with arrow keys.
The moving part is easy but I just couldn't figure out how to code the labyrinth generator. There should be one opening on each side and connected with only one way..