Zigzag#
This time, there are five long distances to cover! We’re not going to copy the same loop five times, are we?
from laby.global_fr import *
Laby(niveau = "2c")
Complete the following function (a new command) to make the ant move as far as possible in a straight line:
def avance_tant_que_tu_peux():
### BEGIN SOLUTION
while regarde() == Vide:
avance()
### END SOLUTION
Now try the following program, then complete it to get the ant out:
debut()
avance_tant_que_tu_peux()
gauche()
### BEGIN SOLUTION
avance_tant_que_tu_peux()
gauche()
avance_tant_que_tu_peux()
droite()
avance_tant_que_tu_peux()
droite()
avance_tant_que_tu_peux()
### END SOLUTION
ouvre()
assert est_gagnant()