Solve a Maze With Google Blockly

Blockly is a web-based, graphical programming language. To write a program you assemble puzzle pieces, each representing a different component. It’s fun too ;)

One of the demos is a maze. Your job is to assemble the puzzle pieces in such a way as to get peg man to the end.
Block maze

Once your blocks are in place, hit the Run Program button to let’er rip. If you don’t solve it on the first (or tenth) try, you’re in good company.

You can obviously do something simple like this, but it’s not nearly as fun as creating an algorithm that would work for other mazes.
Simple block code

It took me a while to come up with an algorithm I was pleased with. Try it on your own first to get a feel for it, but if you get stuck, here’s one solution.

Comments

 (Post a comment) | Comments RSS feed
  1. http://imgur.com/TxiJ8
    solves it with 11 “blocks” (I think!)

    Comment by Tony on June 12, 2012 @ 8:16 pm
  2. @Tony Cool. Why do you only think it solves it? Didn’t you run it to make sure?

    Comment by Dan on June 13, 2012 @ 1:17 am
  3. Here’s another slightly better solution: http://viralpatel.net/blogs/google-blockly-solved/

    Comment by Viral Patel on June 15, 2012 @ 9:09 am
  4. If not wall to left turn left
    If wall ahead turn right
    If not wall ahead go forward

    Comment by Meh on August 30, 2013 @ 3:55 pm

Comments are closed