Mats hosted a little competition last weekend. The main goal of the competition was to make a program which found the shortest path from . to X in a labyrinth, and the code size should be as small as possible.

My first approach was a depth-first seach algorithm, but when I ran the code on large labyrinths the algorithm took to long time. Then I tried a breadth-first search algorithm which proved much faster and stable on finding the shortest path.

Even if I did manage to get my code down to 518 bytes, I didn’t even get close to the winner, which got it down to 253 (results can be found here). You can take a look at my code here, it isn’t as advanced as the other examples shown on mats’ page but it works and finds the correct answer quickly.

Leave a Reply