ICode国际青少年编程竞赛- Python-4级训练场-复杂嵌套for循环
1、
for i in range(4):
Dev.step(i+6)
for j in range(3):
Dev.turnLeft()
Dev.step(2)
2、
for i in range(4):
Dev.step(i+3)
for j in range(4):
Dev.step(2)
Dev.turnRight()
Dev.step(-i-3)
Dev.turnRight()
3、
for i in range(3):
Spaceship.step(3+i)
Dev.step(2)
for j in range(4):
Dev.step(2)
Dev.turnRight()
Dev.step(-2)
Spaceship.turnRight()
Spaceship.step(3+i)
Spaceship.turnLeft()
4、
for i in range(4):
for j in range(2):
Spaceship.step(2)
Dev.step(2)
Dev.step(-2)
Spaceship.step(i+1)
Spaceship.turnRight()
Dev.turnRight()
5、
for i in range(4):
Spaceship.step(3+i)
Dev.step()
for j in range(4):
Dev.step(2)
Dev.turnRight()
Dev.step(-1)
Spaceship.turnRight()
Dev.turnRight()
6、
for i in range(4):
for j in range(3):
Dev.step(i+2)
Dev.turnLeft()
Dev.step(7+i)
7、
for i in range(3):
Dev.step(i+7)
for j in range(3):
Dev.turnLeft()
Dev.step(i+2)
Dev.step(3)
Dev.turnLeft()
8、
for i in range(3):
Spaceship.step(4)
Dev.step(2)
for j in range(4):
Dev.step(2+i)
Dev.turnRight()
Dev.step(-2)
Spaceship.turnRight()
Spaceship.step(5)
Spaceship.turnLeft()
9、
for i in range(3):
Spaceship.step(2)
for j in range(4):
Dev.step(6-i*2)
Dev.turnRight()
Dev.step(6-i*2)
10、
for i in range(6):
for j in range(4):
Dev.step(i*2+2)
Dev.turnRight()
11、
for i in range(4):
Dev.step(6+i*2)
for j in range(3):
Dev.turnLeft()
Dev.step(i+2)
12、
for i in range(3):
Dev.step(5)
for j in range(3):
Dev.step(i+2)
Dev.turnRight()
Dev.step(-3+i)
Dev.turnRight()
13、
for i in range(4):
for j in range(3):
Spaceship.step(j+1)
Spaceship.turnLeft()
Spaceship.step(j+1)
Spaceship.turnRight()
Spaceship.step(2)
Spaceship.turnRight()
14、
for i in range(3):
Dev.step(7-i*2)
Dev.turnLeft()
for j in range(4):
Dev.step(i+1)
Dev.turnRight()
Dev.step(i+1)
Dev.turnRight()
Dev.step(i*2-7)
Dev.turnRight()
15、
for i in range(3):
for j in range(3):
Dev.step(1+j)
Dev.step(-1-j)
Spaceship.step(2)
Spaceship.turnRight()
Dev.turnRight()
16、
for i in range(4):
Spaceship.step(2)
Spaceship.turnRight()
for j in range(3):
Spaceship.step(2)
Dev.step(1+j)
Dev.step(-1-j)
for j in range(2):
Spaceship.turnRight()
Spaceship.step(6)
Spaceship.turnRight()
Spaceship.step(3)
Spaceship.turnLeft()
Dev.turnLeft()
17、
for i in range(4):
Spaceship.turnLeft()
Spaceship.step(8-i*2)
Dev.step(3)
for j in range(4):
Dev.step(2+i)
Dev.turnRight()
Dev.step(-3)
Dev.turnLeft()
18、
for i in range(3):
Spaceship.step(1+i)
for j in range(4):
Dev.step(5-i*2)
Dev.turnLeft()
Dev.step(5-i*2)
19、
for i in range(3):
for j in range(3):
Spaceship.step(2+i)
Dev.step(j+1)
Dev.step(-1-j)
Spaceship.turnLeft()
Dev.turnLeft()
20、
for i in range(4):
for k in range(3):
Dev.step(2)
Dev.turnRight()
Dev.step(3-k)
Dev.step(-(3-k))
Dev.turnLeft()
Dev.step(3)
for j in range(2):
Dev.turnLeft()
Dev.step(2)
Dev.turnRight()