Write code to guide your Champion. Plan it, test it, fix it!
Every world starts with short Learn stations, then 16 coding levels. Progress saves on this device.
Tip: tap something again to remove it, or use the π§½ Eraser.
Python reads your code from top to bottom. Lines inside a loop, if, or def must be indented 4 spaces. Lines that start with for, while, if, elif, else, or def end with a colon :
move_forward() | Move one square the way you face. move_forward(3) moves 3. | β¬οΈ Move forward |
turn_left()turn_right() | Turn to face a new way. You stay on the same square. | βΊ β» Turn |
move_right() and friends | Move right, left, up, or down no matter which way you face. Used in Show Python for arrow blocks. | β‘οΈ β¬ οΈ β¬οΈ β¬οΈ |
for i in range(4):
move_forward() | Repeats the indented lines 4 times. | π Repeat 4 times |
while not at_flag():
move_forward() | Keeps repeating until the Champion reaches the flag. | π Repeat until π© |
if path_ahead():
move_forward()
elif path_left():
turn_left()
else:
turn_right() | Checks the path. Runs the first part that is True. else runs when nothing above was True. | β If / Else |
path_ahead() path_left() path_right() at_flag() | Checks that answer True or False. Use them with if or while. |
steps = 1 steps = steps + 1 steps += 1 steps -= 1 | A variable is a named box for a number. += adds to it, -= takes away. | π¦ steps |
move_forward(steps) | Moves forward as many squares as the variable holds. | |
print("Hi!") print(steps) | Shows a message or a value in the output box. |
def hop():
turn_left()
move_forward()
hop() | def makes a function. Its lines run only when you call it with hop(). Put the def above the code that uses it. | π§© Function |
When your Champion walks all the way around a shape and ends up facing the way it started, it has turned one full circle: 360Β°. So for a shape with corners that are all the same:
The Champion turns at the outside of each corner. A triangleβs inside corner is 60Β°, but the Champion turns 120Β°, because 180 β 60 = 120. Turn angle = 180 β inside angle.
Tip: press π Protractor to see angle marks around your Champion. Blue numbers are right turns, orange numbers are left turns.
You used a big hint, so this level can earn up to 2 stars this time.
Type the maze code your friend gave you.