ICode国际青少年编程竞赛- Python-1级训练场-多变量应用
1、
a = 1
b = 2
for i in range(4):
Spaceship.step(a)
Dev.step(b)
Dev.step(-b)
a = a + 1
b = b + 1
2、
a = 2
b = 5
for i in range(3):
Spaceship.turnLeft()
Spaceship.step(a)
Spaceship.turnRight()
Spaceship.step(b)
a = a + 1
b = b - 2
3、
a = 4
b = 2
for i in range(3):
Dev.step(a)
Dev.turnRight()
Dev.step(b)
Dev.turnLeft()
a = a - 1
b = b + 1
4、
y = 3
x = 2
for i in range(3):
Dev.step(y)
Dev.turnRight()
Dev.step(x)
Dev.turnLeft()
y = y - 1
x = x + 2
5、
space = 1
dev = 7
for i in range(4):
Spaceship.step(space)
Dev.step(dev)
Dev.step(-dev)
space += 1
dev -= 2
6、
space = 1
dev = 5
for i in range(4):
Spaceship.step(space)
Dev.step(dev)
Dev.step(-dev)
Dev.turnRight()
Spaceship.turnRight()
space += 2
dev -= 1
7、
space = 2
dev = 4
for i in range(4):
Dev.step(-dev)
Dev.step(dev)
Spaceship.step(space)
Dev.turnRight()
Spaceship.turnRight()
dev -= 1
space += 1
8、
y = 1
x = 2
for i in range(3):
Dev.turnRight()
Dev.step(y)
Dev.turnLeft()
Dev.step(-x)
y += 1
x += 2
9、
space = 1
dev = 1
for i in range(4):
Spaceship.step(space)
Dev.step(dev)
Dev.step(-dev)
space += 1
dev *= 2
10、
y = 4
x = 1
Spaceship.step()
for i in range(4):
Spaceship.step(y)
Spaceship.turnRight()
Spaceship.step(x)
Spaceship.turnLeft()
y -= 1
x += 1
11、
dev = 7
space = 4
for i in range(4):
Dev.step(dev)
Dev.step(-dev)
Spaceship.turnLeft()
Spaceship.step(space)
Dev.turnLeft()
dev -= 2
space -= 1
12、
a =1
b =1
for i in range(5):
Dev.step(b)
Dev.turnRight()
Dev.step(-a)
Dev.step(a)
a = a + 1
b = b + 2
13、
dev = 1
space = 5
for i in range(4):
Spaceship.step(space)
Dev.step(dev)
Dev.step(-dev)
Spaceship.turnRight()
Spaceship.turnRight()
Spaceship.step(space)
Spaceship.turnLeft()
Dev.turnRight()
dev += 1
space -= 1
14、
space = 1
dev = 7
for i in range(4):
Spaceship.step(space)
Dev.step(dev)
Dev.step(-dev)
Spaceship.turnRight()
Spaceship.turnRight()
Spaceship.step(space)
Spaceship.turnLeft()
Dev.turnRight()
space += 1
dev -= 2
15、
space = 1
dev = 7
for i in range(4):
Spaceship.step(space)
Dev.turnLeft()
Dev.step(-dev)
Dev.step(dev)
Spaceship.turnLeft()
space *= 2
dev -= 2
16、
y = 1
x = 5
for i in range(4):
Dev.step(y)
Dev.turnRight()
Dev.step(x)
Dev.step(-2 * x)
Dev.step(x)
Dev.turnLeft()
y += 1
x -= 1
17、
y = 4
x = 1
for i in range(4):
Dev.turnLeft()
Dev.step(x)
Dev.step(-2 * x)
Dev.step(x)
Dev.turnRight()
Dev.step(y)
x += 2
y -= 1
18、
y = 1
x = 7
for i in range(4):
Dev.step(y)
Dev.turnRight()
Dev.step(x)
Dev.step(-2 * x)
Dev.step(x)
Dev.turnLeft()
y += 1
x -= 2
19、
x = 5
y = 8
for i in range(4):
Dev.step(x)
Dev.turnRight()
Dev.step(y)
Dev.step(-y)
Dev.turnLeft()
Dev.step(-x)
Dev.turnRight()
x -= 1
y -= 2
20、
y = 1
x = 1
for i in range(3):
Dev.step(y)
Dev.turnLeft()
Dev.step(x)
Dev.step(-2 * x)
Dev.step(x)
Dev.turnRight()
x *= 2
y += 2