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

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

1、

在这里插入图片描述

for i in range(6):
    while not Flyer[i].disappear():
        wait()
    Spaceship.step(2 + 2 * i)
    Spaceship.turnRight()

2、
在这里插入图片描述

def get(a, b, c, d):
    for i in (a, b, c, d):
        Dev.step(i)
        if i != 0:
            Dev.turnRight()
get(3, 3, 5, -4)
get(5, 4, 10, -1)
get(3, 4, 5, 4)
get(-4, -4, -8, 9)
get(-4, 2, 0, 0)

3、
在这里插入图片描述

for i in range(6):
    Spaceship.step(2)
    if i % 2 == 0:
        Spaceship.turnLeft()
        
    else:
        Spaceship.turnRight()
    while not Flyer[i].disappear():
        wait()
    Spaceship.step(abs(7 - Item[i].y))
    Spaceship.turnLeft()
    Spaceship.turnLeft()
    Spaceship.step(abs(7 -Spaceship.y) - 2)
    while not Flyer[i].disappear():
        wait()
    Spaceship.step(2)
    if i % 2 == 0:
        Spaceship.turnLeft()
    else:
        Spaceship.turnRight()

4、
在这里插入图片描述

for i in range(5):
    Dev.step(5 - i)
    while Item[i * 2].y != Dev.y or Item[i * 2].x != Dev.x:
        wait()
    Dev.step(1)
    while Item[i * 2 + 1].y != Dev.y or Item[i * 2 + 1].x != Dev.x:
        wait()
    Dev.step(5 - i)
    Dev.wait(10)
    Dev.turnRight()

5、
在这里插入图片描述

def get(a, b, c, d, e):
    Dev.step(a)
    Dev.turnRight()
    Dev.step(b)
    Dev.turnLeft()
    Spaceship.step(c)
    Spaceship.turnLeft()
    Spaceship.step(c)
    Dev.step(d)
    Spaceship.turnRight()
    Spaceship.step(e)

get(4, 3, 3, -1, 4)
get(3, 2, 2, -1, 0)
Spaceship.turnRight()
Spaceship.step(3)
Spaceship.turnRight()
get(-5, -4, 4, 1, 2)
get(-2, -1, 0, 0, 0)

6、

在这里插入图片描述

def get(a, b, c):
    for i in range(a):
        Dev.step(b - i)
        Dev.turnLeft()
    Dev.step(c)

get(5, 6, 5)
for i in range(2):
    Dev.turnRight()
    Dev.step(i + 4)
Dev.turnLeft()
get(5, 6, 12)
Dev.turnLeft()
get(4, 5, 5)

7、

在这里插入图片描述

def get(a, b, c, d):
    Spaceship.step(a)
    Dev.step(b)
    Dev.turnRight()
    Dev.step(c)
    Dev.turnLeft()
    Dev.step(d)
    Dev.step(-d)
    Dev.turnRight()
    Dev.step(-c)
    Dev.turnLeft()
    Dev.step(-b)

get(4, 3, -2, -1)
get(2, 6, 2, -1)
get(4, 3, -2, -1)
get(4, 3, -2, -1)
get(2, 6, 2, -1)

8、
在这里插入图片描述

for i in range(3):
    Dev.step(i + 2)
    while Flyer[2 - i].disappear():
        wait()
    Dev.step(2)
    Dev.wait(10)
    Dev.step(2)
    for j in range(2):
        Dev.turnRight()
        Dev.step(3)
    if i != 2:
        Dev.turnRight()
        Dev.step(2)
        Dev.wait(10)
        while Flyer[2 - i].disappear():
            wait()
        Dev.step(i + 5)
        Dev.turnRight()

9、
在这里插入图片描述

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

10、
在这里插入图片描述

for i in range(4):
    while Flyer[3 - i].disappear():
        wait()
    Dev.step(-2)
    if i != 3:
        Dev.turnLeft()
        for j in range(4):
            Dev.step(6 - i * 2)
            Dev.wait(10)
            Dev.turnLeft()
            Dev.step(6 - i * 2)
        Dev.turnRight()

11、
在这里插入图片描述

def get(a, b):
    for i in range(3):
        while Flyer[a + i].disappear():
            wait()
        Dev.step(2)
        for j in range(4):
            Dev.step(b)
            Dev.turnRight()
        while Flyer[a + i].disappear():
            wait()
        Dev.step(-2)
        Dev.turnRight()

get(0, 1)
Dev.step(1)
Spaceship.turnRight()
Spaceship.step(5)
Spaceship.turnLeft()
Spaceship.step(6)
Dev.turnRight()
Dev.step(-1)
Dev.turnRight()
get(3, 2)

12、
在这里插入图片描述

def get(a, b, c):
    Spaceship.step(a)
    Dev.step(b)
    Dev.wait(10)
    Dev.step(c)
    Dev.step(-c)
    Dev.wait(10)
    Dev.step(-b)

get(5, 5, 1)
Spaceship.turnLeft()
Dev.turnLeft()
get(6, 6, 0)
Spaceship.turnRight()
Dev.turnLeft()
get(2, -3, -3)
Dev.turnLeft()
Spaceship.turnRight()
Spaceship.step(1)
Spaceship.turnRight()
get(6, -2, -4)

13、

在这里插入图片描述

for i in range(3):
    for j in range(2):
        Spaceship.step(5 - j)
        Spaceship.turnLeft()
    Spaceship.step(i + 2)
    while not Flyer[2 - i].disappear():
        wait()
    Spaceship.step(2)
    Dev.step(-1)
    Dev.step(1)
    Dev.turnLeft()
    Dev.step(1)
    for j in range(4):
        Dev.step(2)
        Dev.turnRight()
    Dev.step(-1)
    Dev.turnRight()
    Spaceship.turnRight()
    Spaceship.turnRight()
    while not Flyer[2 - i].disappear():
        wait()
    Spaceship.step(i + 4)

14、

在这里插入图片描述

def get(a, b, c):
    Dev.step(a)
    Dev.turnRight()
    Dev.step(b)
    Dev.turnLeft()
    Spaceship.step(b)
    Dev.step(-a)
    Spaceship.step(c)

get(3, 3, 0)
get(-4, 2, 2)
Spaceship.turnRight()
Dev.turnRight()
get(6, 3, 3)
Spaceship.turnRight()
Dev.turnRight()
Spaceship.step(1)
get(2, 3, 0)

15、
在这里插入图片描述

def get(a, b, c, d):
    Dev.step(a)
    Dev.turnRight()
    Dev.step(b)
    Dev.turnLeft()
    Dev.step(c)
    Spaceship.step(b)
    Dev.step(-c-a)
    Spaceship.step(d)

get(3, 2, 3, 3)
get(4, 3, 1, 0)
for i in range(2):
    Dev.turnRight()
    Spaceship.turnRight()
    Spaceship.step(2)
    get(i + 2, i + 1, 2, 0)

16、
在这里插入图片描述

def get(a, b, c):
    Flyer[c].step(1)
    Spaceship.step(a)
    for i in range(4):
        Dev.step(b)
        Dev.turnRight()

get(2, 2, 2)
Spaceship.turnRight()
get(4, -5, 3)
Spaceship.turnLeft()
Dev.turnLeft()
get(4, -3, 1)
Spaceship.turnLeft()
Dev.turnRight()
get(4, 6, 0)

17、
在这里插入图片描述

def get(a, b, c, d, e):
    Spaceship.step(a)
    for i in range(3):
        Flyer[b + i].step(c)
    Dev.step(d)
    Dev.turnRight()
    Dev.step(e)
    Dev.turnLeft()
    Spaceship.step(e)
    Dev.step(-d)

Spaceship.step(3)
Spaceship.turnLeft()
get(3, 3, 2, 3, 1)
Spaceship.step(2)
Spaceship.turnRight()
Dev.turnRight()
get(0, 0, 1, 4, 2)
Spaceship.step(3)
Spaceship.turnRight()
Dev.turnRight()
get(2, 6, 4, 3, 5)

18、

在这里插入图片描述

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

19、
在这里插入图片描述

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

20、
在这里插入图片描述

for i in range(4):
    while Flyer[i].disappear():
        wait()
    Dev.step(i + 4)
    while Item[i].x != Dev.x or Item[i].y != Dev.y:
        wait()
    for j in range(3):
        Dev.turnRight()
        Dev.step(i + 2)
    Dev.turnRight()
    while Flyer[i].disappear():
        wait()
    Dev.step(-2)
    Dev.turnRight()
    Spaceship.step(3)
    Spaceship.turnRight()
  • 7
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

青岛少儿编程-王老师

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值