understand what algorithms are; how they are implemented as programs on digital devices; and that programs execute by following precise and unambiguous instructions.

create and debug simple programs

1.4b

LO: To write a program that follows a flow chart.

Let's have another look at that flow chart we made:

We have solved the problem by breaking down the instructions required to reach the end of each path (before needing to turn). It may be informative to point out here that this problem could have been broken down in many different ways - there is not one single correct way of doing it.

This is how the code would look when typed into Reeborg - to make it easier to type and read, I have left a blank line between the instructions from the flow chart.

#simplePath
move()
move()
move()
move()
move()

turn_left()

move()
move()
move()
move()

turn_left()

move()
move()

turn_left()

move()
move()

turn_left()

move()
move()
move()
move()
move()
move()
			

Code Examples

Resources