In this technologically connected world it is advantageous to know programming, unfortunately it’s not everyone’s cup of tea. Introducing kids to programming from a young age will definitely help them fit in this modern era. These simple games and puzzles enable the students to learn the basic concepts of programming without getting bored. Every concept is explained through a series of puzzles which becomes more challenging as we advance. Collecting treasure with Laurel helps the child get a better understanding about for loop and its working. Each block has a definite function to move forward, to turn right, left etc.

First Approach

The repeat block enables us to run a specific task the number of times we want thereby making the code more compact. The repeat block is the equivalent of the FOR loop. Our goal in this puzzle is to collect all the treasures. We need to make use of the collect block to get the treasure from each space.

To reach our goal of collecting all the treasures we need to move Laurel forward and collect the treasure at each space. After writing each code we could use the step button to check how far our code will work.

This is one way of doing it. Here Laurel moves forward, collects her treasure, turns and moves again. Here we can see that there are no treasures left on the play space that means our code worked properly.

Second Approach

Instead of making it this long we can always use the repeat blocks.

This is the completed one using repeat blocks and we can see that it worked perfectly. When this code is executed the first repeat block takes Laurel forward and collects the treasures three times. After exiting that loop it enters the next loop and turns left and moves forward, that whole set is executed twice. Then the last loop is executed. This code moves Laurel in a spiral manner and collects the treasures.

Conclusion

A single program can be coded in many different ways as shown above, our goal is to code a simple and less complex one that serves our purpose, in this case collecting all the treasures. When we learn more tools the puzzles might become more challenging but solving them will be easier.