ICode国际青少年编程竞赛- Python-5级训练场-综合练习5
1、

a = 16
for i in range(6):
    Dev.step(1)
    Dev.turnLeft()
    Dev.step(a)
    Dev.step(-a)
    Dev.turnRight()
    while Dev.energy < 100:
        wait()
    Dev.step(1)
    a = a - 5 + i
2、

for i in range(5):
    Dev.step(11 - i * 2)
    Dev.turnRight()
    while Dev.energy < 100:
        wait()
3、
 
for i in range(4):
    Dev.step(3 + i)
    while Dev.energy < 100:
        wait()
    Dev.step(-1)
    Dev.turnLeft()
    Dev.step(2 + i)
    Dev.turnRight()
4、

for i in range(5):
    Dev.step(1)
    Dev.turnRight()
    Dev.step(Item[i].x - 10)
    if i < 4:
        Dev.step(10 - Item[i].x)
        Dev.turnLeft()
        Dev.step(2)
        Flyer.step(3)
        Dev.turnLeft()
        Dev.step(1)
        while Dev.energy < 100:
            wait()
        Dev.step(-1)
        Dev.turnRight()
5、

for i in range(4):
    Dev.step(3)
    Dev.turnRight()
    Dev.step(1)
    while Dev.energy < 100:
        wait()
    Dev.step(1)
    Dev.turnRight()
    Dev.step(3)
    Dev.turnLeft()
6、
 
for i in range(4):
    Dev.step(4)
    Dev.turnRight()
    Dev.step(2)
    Dev.turnLeft()
    Dev.step(1)
    while Dev.energy < 100:
        wait()
    Dev.step(1)
    Dev.turnLeft()
    Dev.step(2)
    Dev.turnRight()
    Dev.step(4)
    Dev.turnRight()
7、

for i in range(4):
    Dev.step(8)
    Dev.turnLeft()
    Dev.step(2)
    while Dev.energy < 100:
        wait()
    for j in range(2):
        Dev.turnLeft()
        Dev.step(2)
8、
 
for i in range(4):
    Dev.step(4)
    while Flyer[i].disappear():
        wait()
    Dev.step(2)
    Dev.turnLeft()
    Dev.step(i + 1)
    Dev.step(-2 - 2 * i)
    Dev.step(i + 1)
    Dev.turnLeft()
    while Flyer[i].disappear():
        wait()
    Dev.step(6)
    Dev.turnLeft()
9、

for i in range(3):
    Spaceship.step(2 ** i)
    while not Flyer[i * 2].disappear():
        wait()
    Spaceship.step(2)
    Spaceship.turnRight()
    Spaceship.step(2 * i + 1)
    while not Flyer[2 * i + 1].disappear():
        wait()
    Spaceship.step(2)
    Spaceship.turnLeft()
10、
 
for i in range(4):
    while not Flyer[i].disappear():
        wait()
    Spaceship.step(i + 2)
    Spaceship.turnLeft()
    Spaceship.step(i + 2)
    Spaceship.turnRight()
11、

for i in range(5):
    Spaceship.step(2)
    Spaceship.turnLeft()
    Spaceship.step(5 - i)
    while not Flyer[i].disappear():
        wait()
    Spaceship.step(2)
    Spaceship.turnLeft()
    Spaceship.turnLeft()
    while not Flyer[i].disappear():
        wait()
    Spaceship.step(7 - i)
    Spaceship.turnLeft()
    Spaceship.step(1)
12、

for i in range(4):
    Dev.step(2 * i + 1)
    Dev.turnRight()
    while Flyer[i].disappear():
        wait()
    Dev.step(3)
    Dev.turnLeft()
13、
 
for i in range(4):
    Spaceship.step(1)
    while not Flyer[2 * i].disappear():
        wait()
    Spaceship.step(2)
    Dev.turnLeft()
    Dev.step(3)
    Dev.step(-6)
    Dev.step(3)
    while not Flyer[2 * i + 1].disappear():
        wait()
    Spaceship.step(4)
    Spaceship.turnRight()
14、
 
Dev.step(1)
for i in range(4):
    Dev.step(2 * i)
    Dev.turnLeft()
    while Flyer[i].disappear():
        wait()
    Dev.step(2)
    Dev.turnRight()
15、

for i in range(3):
    Dev.step(Flyer[i].x - Dev.x)
    Dev.turnLeft()
    while Flyer[i].disappear():
        wait()
    Dev.step(7)
    Dev.step(i - 3)
    Dev.turnLeft()
    Dev.step(3 - i)
    Dev.step(2 * i - 6)
    Dev.step(3 - i)
    Dev.turnLeft()
    Dev.step(2 + i)
    while Flyer[i].disappear():
        wait()
    Dev.step(2)
    Dev.turnLeft()
16、

for i in range(3):
    Dev.step(9 - 2 * i)
    while Flyer[i * 2].disappear():
        wait()
    Dev.step(2)
    Dev.turnRight()
    Dev.step(10 - 4 * i)
    if i < 2:
        Dev.turnRight()
        while Flyer[i* 2 + 1].disappear():
            wait()
        Dev.step(11 - 2 * i)
        Dev.turnRight()
        Dev.step(8 - 4 * i)
        Dev.turnRight()
17、

for i in range(4):
    for j in range(2):
        while Flyer[2 * i + j].disappear():
            wait()
        Dev.step(3 + 2 * i)
        Dev.turnRight()
18、

for i in range(3):
    while Flyer[6 - 2 * i].disappear():
        wait()
    Dev.step(Dev.y - Flyer[5 - 2 * i].y)
    Dev.turnRight()
    while Flyer[5 - 2 * i].disappear():
        wait()
    Dev.step(Flyer[6 - 2 * i].y - Flyer[5 - 2 * i].y + 1)
    Dev.turnLeft()
19、
 
for i in range(4):
    while Flyer[i].disappear():
        wait()
    Dev.step(4 + i)
    Dev.turnRight()
    while Flyer[i + 4].disappear():
        wait()
    Dev.step(3 + i)
    Dev.step(-i - 1)
    while Flyer[i + 4].disappear():
        wait()
    Dev.step(-2)
    Dev.turnRight()
    Dev.step(2 + i)
    while Flyer[i].disappear():
        wait()
    Dev.step(2)
    Dev.turnLeft()
20、
 
for i in range(4):
    Dev.step(1)
    for j in range(2):
        Dev.turnRight()
        Dev.step(4 - i)
        Dev.turnLeft()
        Dev.step(4 - i)
    while Dev.energy < 100:
        wait()
    Dev.turnLeft()



















