design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts.
LO: To write and edit functions.
Using the Objects world, let children think about other skills might come in handy for Reeborg, write some functions to give Reeborg those abilities.
#Year group or class #name #date #objects maze #functions to try out def turn_right(): turn_left() turn_left() turn_left() def turn_around(): turn_left() turn_left() def get_banana(): move() turn_left() move() move() take() turn_around() move() move() turn_right() move() turn_around()
Lets look in more detail at these functions...
The first one, turn_right() we have already seen, it is included here because we can make use of it inside another function.
turn_around() can be seen as a modified version of turn_right() but will be equally useful - think about collecting objects in a maze.
The third function, get_banana(): is interesting for a number of reasons:
This function makes use of the other two functions by calling them in its instructions.
This function performs a whole task unlike the other two.
The function brings Reeborg back to the starting position and facing the same way - you may like to discuss the posibility of children writing different functions to collect each object, and why it would be important to always return to the starting position (think what would happen if they did not...)