The mazes can be found at http://blockly-demo.appspot.com.
The purpose of this program is to learn how programming works. In other words, using sliding elements with actions, such as "Move forward", "turn right", "if there is a path do", "repeat until" etc., the little man in the illustration aims to reach the red flag.
The solution of the above maze is shown in the accompanying diagram. The main idea is to follow always the left path till we reach our destination.
Initially, using the command "repeat until" saves space and time, since there is no need to repeat the same command. Then, the application "if there is a path to the left do ... else" first checks if there is a path left to turn otherwise to execute the instructions in the "else" statement. The second priority is if the little man has the ability to go straight and finally, as last resort we turn right.
0 comments: