Step 2

Analyzing the Map


Before we get started with our code, let’s take a look at the map to see if we can get some ideas on how to best to do this.

We can see that, luckily, all the disks seem to be grouped together. We can use this to our advantage.

We also see that the blue section is probably the easiest since it is the one we start next to, so this might be a good place to start.

Initial Program Structure


With all this in mind, let’s prepare our project by completing the code as shown.

We start off setting our robots speed values, feel free to set these to whatever you’d like.

We then see some comment blocks. These are used here to help us split our code into sections. Doing this will help make our code a lot more readable, which will be very useful since this project might get hard to understand without them (just because of the large amount of code it might need).

With this all set up, try and code your robot to grab a blue disk and bring it back. You will need to use the robot’s magnet to achieve this. Move on to the next page when you are ready to see the solution.