icode国际青少年编程竞赛-爱代码爱编程
ICode国际青少年编程竞赛- Python-5级训练场-综合练习6
1、
for i in range(3):
Dev.step(2 * (i + 1))
Dev.turnLeft()
while Flyer[2 - i].disappear():
wait()
Dev.step(2 * (i + 1))
Dev.turnRight()
while Dev.x != Item[i].x:
wait()
2、
for i in range(3):
Dev.step(2 * i + 1)
while Item[2 * i].y != Dev.y:
wait()
for j in range(2):
Dev.step(2)
Dev.turnRight()
Dev.step(2 * (i + 1))
Dev.turnLeft()
while Flyer[i].disappear():
wait()
Dev.step(2)
Dev.turnLeft()
while Item[2 * i + 1].x != Dev.x or Item[2 * i + 1].y != Dev.y:
wait()
3、
for i in range(7):
Dev.step(1)
Dev.turnLeft()
Dev.step(8 - Item[i].x)
Dev.step(Item[i].x - 9)
while Dev.energy < 100:
wait()
Dev.step(1)
Dev.turnRight()
Dev.step(1)
4、
for i in range(4):
while Flyer[i].disappear():
wait()
Dev.step(4 + i)
while Item[2 * i].y != Dev.y:
wait()
if i < 3:
Dev.step(-2 - i)
while Flyer[i].disappear():
wait()
Dev.step(-2)
Dev.turnRight()
Dev.step(2 * i + 2)
Dev.turnLeft()
5、
for i in range(5):
Dev.step(3 + i)
while Dev.energy < 100:
wait()
Dev.step(i + 1)
Dev.turnLeft()
6、
for i in range(4):
while Flyer[i].disappear():
wait()
Dev.step(4)
while Flyer[4 + i].disappear():
wait()
Dev.step(1)
Dev.turnLeft()
Dev.step(2)
Dev.step(-1)
while Flyer[4 + i].disappear():
wait()
Dev.step(-1)
Dev.turnLeft()
Dev.step(3)
Dev.turnRight()
Dev.step(2)
Dev.step(-2)
Dev.turnLeft()
while Flyer[i].disappear():
wait()
Dev.step(2)
Dev.turnLeft()
7、
for i in range(4):
Dev.step(-2)
while Flyer[i].disappear():
wait()
Dev.step(-4 - i)
while Item[i].x != Dev.x or Item[i].y != Dev.y:
wait()
Dev.step(i + 2)
while Flyer[i].disappear():
wait()
Dev.step(4)
Dev.turnLeft()
8、
for i in range(4):
Spaceship.step(1)
while not Flyer[i].disappear():
wait()
Spaceship.step(2)
Dev.turnRight()
Dev.step(3)
Dev.step(-4)
for j in range(4):
Dev.step(-2)
Dev.turnRight()
Dev.step(1)
Spaceship.step(4)
Spaceship.turnRight()
9、
for i in range(5):
Dev.step(Dev.y - Flyer[4 - i].y)
Dev.turnRight()
while Flyer[4 - i].disappear():
wait()
Dev.step(4)
if i != 2 and i != 4:
for j in range(4):
Dev.step(2)
Dev.turnLeft()
Dev.step(-2)
while Flyer[4 - i].disappear():
wait()
Dev.step(-2)
Dev.turnLeft()
10、
for i in range(4):
Dev.step(8 - 2 * i)
Dev.turnRight()
Dev.step(3)
for j in range(3):
Dev.turnLeft()
Dev.step(-2 - i)
Dev.turnRight()
while Dev.energy < 100:
wait()
Dev.step(5 + i)
11、
for i in range(4):
Dev.step(2 * (i + 1))
Dev.turnLeft()
while Flyer[i].disappear():
wait()
Dev.step(5 - i)
while Item[i].x != Dev.x or Item[i].y != Dev.y:
wait()
Dev.step(i - 3)
while Flyer[i].disappear():
wait()
Dev.step(-2)
Dev.turnRight()
Dev.step(1)
Dev.turnRight()
12、
for i in range(4):
Spaceship.step(6)
while not Flyer[3 - i].disappear():
wait()
for j in range(3):
Spaceship.step(3)
Spaceship.turnRight()
Spaceship.step(3)
Spaceship.turnLeft()
Spaceship.step(1)
Spaceship.turnRight()
13、
for i in range(3):
Dev.step(2)
for j in range(3):
Dev.turnLeft()
Dev.step(-2 - i)
for j in (-2, 2):
while Flyer[2 * i + 1].disappear():
wait()
Dev.step(j)
while Dev.energy < 100:
wait()
Dev.turnLeft()
14、
for i in range(3):
Dev.step(Dev.y - Flyer[2 * i].y - 1)
while Flyer[i * 2].disappear():
wait()
for j in range(2):
Dev.step(2 + i)
Dev.turnRight()
Dev.step(4 + i)
Dev.turnLeft()
Dev.step(2)
Dev.turnLeft()
Dev.step(1)
Dev.step(-8)
15、
for i in range(3):
Spaceship.step(i + 1)
while not Flyer[i * 2].disappear():
wait()
Spaceship.step(i + 4)
for j in range(3):
Spaceship.turnRight()
Spaceship.step(i + 2)
while not Flyer[i * 2 + 1].disappear():
wait()
Spaceship.step(i + 3)
Spaceship.turnRight()
16、
for i in range(4):
while Flyer[i].disappear():
wait()
for j in range(2):
Dev.step(5 - i)
Dev.turnRight()
Dev.step(1)
while Dev.energy < 100:
wait()
Dev.step(4 - i)
Dev.turnLeft()
17、
for i in range(3):
Dev.step(7 - i)
Dev.turnRight()
while Dev.energy < 100:
wait()
Dev.step(2 - i)
while Flyer[i].disappear():
wait()
Dev.step(5)
for j in range(3):
Dev.turnRight()
Dev.step(3)
while Dev.energy < 100:
wait()
18、
for i in range(3):
Spaceship.step(i + 2)
Spaceship.turnRight()
Spaceship.step(i + 2)
for j in range(4):
Dev.step(j - 4)
Dev.turnLeft()
while j == 1 and (Item[i].x != Dev.x or Item[i].y != Dev.y):
wait()
Spaceship.step(2)
Spaceship.turnLeft()
while Flyer[i].disappear():
wait()
Dev.step(2)
Spaceship.step(3)
19、
for i in range(3):
Spaceship.step(3)
while Flyer[i].disappear():
wait()
Dev.step(2)
Spaceship.step(2)
for j in range(4):
Dev.turnLeft()
Dev.step(-j - 1)
while j == 2 and (Item[2 + 4 * i].x != Dev.x):
wait()
20、
for i in range(3):
Dev.step(5 - i)
while Flyer[i].disappear():
wait()
Dev.step(5)
for j in range(2):
Dev.turnLeft()
Dev.step(3)
Dev.turnRight()
Dev.step(i - 2)