Bonus challenge: robot ecosystem
Put it all together to put several robots in the maze.
We'll cover the following...
Now you know how to make a robot move around in the maze, and that’s the main goal of the hour of code.
If you still have time, here’s a grand final challenge to work through: creating an ecosystem of robots that live in a maze.
You have already seen that there are different types of objects: A Maze object, for example, and Robot and Wall objects.
In more advanced Java programming, you will learn to create your own types of objects, with their own behavior. As a taste of how useful this can be, we’ve created a new object type, or class called a Wanderer. It’s just a robot that has a special instruction wander that causes the robot to set its direction randomly.
Your final challenge is to add several wanderers to the maze and have them wander around. Don’t forget to create a new variable for each Wanderer, create new Wanderer objects with the new command
You can then use a loop to make the wanderers wander; execute one maze turn each time through the loop.
We’ve also added a gold coin to the maze; a realy advanced challenge would be to have the robots look for the gold coin and see who could find it first; you could have a team of red robots, and a team of blue robots.