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