The goal of this level is to adjust your algorithm to navigate around extra blocks.
This puzzle is similar to the previous one, but it has additional blocks around the walls.
1. Use pseudocode to plan a workable algorithm.
2. Before tweaking the code below, walk through the pseudocode in your mind to be sure your algorithm will work.
3. Write code to implement the algorithm.

Hint: Take the existing code form the previous exercise, and see if you can make it work to solve this slightly different puzzle. Notice that the walls now twist and turn a little more, so you'll need to account for that change in your algorithm.
The complete solution is shown below.
Super Impressive! You've tweaked an existing algorithm to make it work in different circumstances. This is the power of code, creating programs that solve a problem in many different situations. for example, search engine algorithms can filter over a billion websites to give you the results that you'll be most interested in, no matter what you search for.
The next lesson we will be looking at is Conquering a Maze.
This puzzle is similar to the previous one, but it has additional blocks around the walls.
1. Use pseudocode to plan a workable algorithm.
2. Before tweaking the code below, walk through the pseudocode in your mind to be sure your algorithm will work.
3. Write code to implement the algorithm.
Hint: Take the existing code form the previous exercise, and see if you can make it work to solve this slightly different puzzle. Notice that the walls now twist and turn a little more, so you'll need to account for that change in your algorithm.
The complete solution is shown below.
Code:
func navigateAroundWall() { if isBlocked && isBlockedRight{ turnLeft() } else if isBlockedRight { moveForward() } else { turn Right() moveForward() } } while !isOnOpenSwitch { while !isOnGem && !isOnClosedSwitch } navigateAroundWall() } if isOnGem { collectGem() } else { toggleSwitch() } turnLeft() turnLeft() }
The next lesson we will be looking at is Conquering a Maze.