Step 10: Jumping Hurdles (repeat and functions)¶
CS20-CP1 Apply various problem-solving strategies to solve programming problems throughout Computer Science 20.
CS20-CP2 Use common coding techniques to enhance code elegance and troubleshoot errors throughout Computer Science 20.
CS20-FP2 Investigate how control structures affect program flow.
CS20-FP3 Construct and utilize functions to create reusable pieces of code.
Project¶
Open Step 10 on the Reeborg environment.
Reeborg has been running tests on it’s physical abilities lately. One of the things it has been practicing is jumping small hurdles. In this world, Reeborg needs to jump the hurdles, which are always the same height, and always spaced the same distance apart. You need to define a function such as:
def jump_hurdle():
# your code goes here
You should use a repeat
loop to have Reeborg jump the hurdles, and end at the goal (13, 1). The path to follow is shown with the black dashed line with arrows.