A pretty original, even though not a new idea. Here's a few improvements I'd suggest:
- The player should lose if not reached the end in one execution of the program. Otherwise you can write a single line at a time to move.
- Replace the wait() function with a function that makes the player check if there's an obstacle in front of him, as there is no way to predict in which second the path will be free.
- Add any sounds, I guess.