Simple Maze Challenge

Maze World

You are ready for the Maze Test!

Test 1: Get to the Red Square!

Abstracting With Simple Functions

You'll have to start by making the robot go 1 grid distance forward.

Then Turn Right.

Then go 1 grid distance forward again... and so on!

You can write out your program in words first like I just started. And then translate that to code blocks.

Only use the Move Tank block under Motion as before.

Hint: Once you figure out the perfect # of rotations or degrees or seconds to move 1 grid distance, you can reuse that block over and over by copying it, or by turning it into a function, like this:

This really allows you to Abstract away details!

You can add functions for:

Then your maze code will be more readable: move fwd, turn right, move fwd, turn left, move fwd, turn right, move fwd...



Remember to test your program all the time. Don't try adding 10 blocks and test it all once at the end. Test after each code change, unless you're extremely sure about your code.

If something doesn't work as expected, figure out which block is probably causing it. Then look over that code carefully. Make small changes that you think would tell you if what you're looking at is probably the faulty area.

Test and repeat... Eventually your robot will glide all the way to the finish area - blue grid.

Test 2: Get to the Pink Square!

You can reuse the 3X3 Red code you created. You need to get a little further!

Test 3: A Bigger Maze!