Hi everyone! Now that you’ve learned some of the Blockly basics, we’re going to talk about how to solve coding problems. Whether the challenge is making KINI go through an obstacle course, trying to get KINI to escape a maze, or even getting KINI to do a wheelie, these tips can help you solve the problem! After you learn the methods to solve coding problems, I’ll give you a problem to solve on your own!
Before we begin:
- Make sure that you have your KINI robot, and that it is connected to the internet.
- Open the app, and go to the Blockly tab by clicking the Blockly button in the bottom right corner. We will be using the two Repeat blocks to create our code.
- Understand the basics of Blockly - if you don’t, make sure to visit the “Introduction to Blockly” activity before this one.
- Before you try any of the Problem Solving methods, make sure that you have the Blockly code that you want to test. These methods can be your first try making sure that your code does what you want it to do.
- In this example, we will test out the code: “Move Forwards 10cm,” then “Rotate Left,” then finally “Move Forwards 5cm”
The first method is called “Draw it Out”
- All you need to do for this method is get a piece of paper, a pencil and maybe a ruler
- Draw something on the paper that will be KINI (maybe a rectangle, or circle, or triangle, etc.)
- Then, draw out KINI’s path by using what you have in your code in Blockly
- For the example from before, draw out each block one at a time. We’d first draw the “Move Forwards 10cm,” then “Turn Left,” and lastly draw “Move Forwards 5cm.”
- Make sure to draw each step from KINI’s point of view, which means you might have to mark where the front of KINI is, or turn the paper to pretend to be KINI
The second method is called “Act it Out”
- For this method all you need, is you! You are going to pretend to be KINI, and move around the room by doing the actions from your code.
- We’ll use the same example as we did before - say our code is “Move Forwards 10cm” then “Rotate Left” then “Move Forwards 5cm”
- To act out this code, try replacing cm with steps! Stand up with lots of room around you - take 10 steps forwards, then turn to your left, and finally take 5 steps forwards. Make sure your steps are the same each time.
- You can even use tape or an object to mark where you start and stop. That way you can see where the code moved you
The last method is called “Trial and Error”
- For this method you need to have your code in Blockly and your KINI Robot. All you need to do is press the orange play button, and watch closely.
- Pay attention to when the code goes wrong, and try to find the block in your code that you need to change.
- Again you can mark KINI’s start and ending position to see what the error is
- Trial and Error means that you won’t get everything right the first time - and that’s okay!
To code, you need patience! Try out different ways to do the same thing, and see which works best. Don’t worry if you don’t get something right the first time, because with a little work you can solve the problem in no time!
It doesn’t matter which of these methods that you use to help solve coding problems, but you should try out each of them at least one time! That way you can find out which one you like the best.
I have a challenge for you to try out, and you can use the methods you just learned to help you solve the problem. The challenge is to set up an obstacle course for KINI in your house! With your parents permission use things that you can find in your house to set one up! You could use chairs, toys, cups, recycles (like boxes or cans) and anything else you can think of! Try making KINI weave through the objects, get KINI to push a ball, or even get KINI to go up a ramp! It’s up to you!
Be sure to take pictures and videos of your obstacle courses and share them with Colmakers on Instagram, Facebook, and Twitter or Email us! Good luck with your obstacle course, and have fun coding!