ICode国际青少年编程竞赛- Python-5级训练场-多参数函数

ICode国际青少年编程竞赛- Python-5级训练场-多参数函数

1、

在这里插入图片描述

def go(a, b):
    Spaceship.step(2)
    Dev.step(a)
    Spaceship.step(b)
    Dev.turnRight()
    Dev.step(b)
    Dev.turnLeft()
    Dev.step(-a)
Dev.turnLeft()
Dev.step(3)
Dev.step(-3)
go(3, 2)
go(6, 1)
go(5, 2)
go(4, 3)

2、
在这里插入图片描述

def go(a, b, c):
    Flyer[a].step(b)
    Dev.step(4)
    Dev.step(-4)
    Spaceship.step(c)
go(3, 2, 3)
go(4, 1, 2)
go(1, 4, 4)
go(0, 5, 3)
Flyer[2].step(2)
Dev.step(4)

3、
在这里插入图片描述

def go(a, b, c, d):
    Spaceship.step(a)
    Flyer[b].step(c)
    Dev.step(d)
    Dev.step(-d)
go(1,3,2,4)
go(2,4,1,5)
go(2,6,2,3)
Spaceship.turnRight()
Spaceship.step()
Spaceship.turnLeft()
go(2,1,3,5)
go(3,0,2,8)
go(2,5,3,4)
go(3,7,2,3)
go(1,2,3,5)

4、

在这里插入图片描述

def move(a, b, c):
    Dev.turnLeft()
    while Flyer[a].disappear(): 
        wait()
    Dev.step(b)
    for i in range(4):
        Dev.step(2)
        Dev.turnRight()
    while Flyer[a].disappear(): 
        wait()
    Dev.step(-b)
    Dev.turnRight()
    Dev.step(c)
move(2, 2, 6)
move(0, 4, 4)
move(1, 3, 4)
move(3, 5, 0)

5、

在这里插入图片描述

def move(a, b, c):
    Dev.step(a)
    while Flyer[b].disappear(): 
        wait()
    Dev.step(6-a)
    Dev.step(a-4)
    while Flyer[b].disappear(): 
        wait()
    Dev.step(-a-2)
    Spaceship.step(c)

move(3, 2, 4)
move(1, 0, 2)
move(4, 4, 3)
move(3, 3, 4)
move(2, 1, 0)

6、

在这里插入图片描述

def move(a, b):
    Flyer[a].step(Dev.y - Flyer[a].y - 1)
    Dev.step(1)
    for i in range(2):
        Dev.step(b)
        Dev.turnRight()
        Dev.step(2)
        Dev.turnRight()
    Dev.step(-1)
    
Spaceship.step(2)
Spaceship.turnRight()
move(1, 3)
Spaceship.step(4)
Spaceship.turnLeft()
Spaceship.step(1)
Spaceship.turnRight()
move(2, 2)
Spaceship.step(4)
move(0, 6)
Spaceship.turnRight()
Spaceship.step(2)
Spaceship.turnLeft()
Spaceship.step(4)
move(3, 4)

7、

在这里插入图片描述

def move(d1, d2, s1, s2):
    for i in range(2):
        Dev.step(d1-i*d2)
        Dev.turnLeft()
    Spaceship.step(s1)
    Dev.step(d1)
    Spaceship.step(s2)
move(4,2,2,2)
move(-2,-1,1,2)
Spaceship.step(5)
Spaceship.turnRight()
Spaceship.step(2)
Dev.turnRight()
move(5,2,3,2)
move(-3,-2,0,0)

8、
在这里插入图片描述

def move(a, b, c, d):
    Dev.step(a)
    Dev.turnRight()
    Flyer[c].step(d)
    Dev.step(b)
    Dev.turnLeft()
move(2,4,0,1)
move(2,3,1,2)
move(4,2,2,1)
move(2,5,3,2)
Dev.step()

9、

在这里插入图片描述

def move(a, b, c):
    for i in range(b, b+c):
        Flyer[i].step(a)
    Dev.step(c+2)
    Dev.step(-c-2)
move(1, 0, 3)
Spaceship.step(3)
Spaceship.turnLeft()
Spaceship.step(2)
move(3, 3, 2)
Spaceship.turnRight()
Spaceship.step()
Spaceship.turnLeft()
Spaceship.step(4)
Dev.turnRight()
move(1, 5, 3)
Spaceship.step(3)
Spaceship.turnRight()
Spaceship.step(1)
Spaceship.turnLeft()
move(2, 8, 4)
Spaceship.step(4)
move(3, 12, 1)

10、

在这里插入图片描述

def move(a, b, c):
    Flyer[a].step(b)
    for i in range(3):
        Dev.step(c)
        Dev.turnRight()
    Dev.step(c)

move(7, 2, -3)
move(2, 5, -6)
move(4, 2, -4)
move(0, 3, -7)

11、

在这里插入图片描述

def move(a, b):
    Spaceship.step(a)
    for i in range(3): 
        Flyer[i].step(a)
    for j in range(4):
        Dev.step(b)
        Dev.turnLeft()
        Dev.step(b)

move(2, 7)
move(2, 5)
move(1, 4)
move(3, 1)

12、
在这里插入图片描述

def move(a):
    for i in range(a):
        Dev.step(a-i)
        Dev.turnRight()
    for i in range(a):
        Dev.turnLeft()
        Dev.step(-1-i)
        
move(4)
Spaceship.turnRight()
Spaceship.step(1)
Spaceship.turnLeft()
Spaceship.step(5)
move(3)
Spaceship.step(4)
Spaceship.turnLeft()
Spaceship.step(1)
move(5)
Spaceship.turnLeft()
for i in (1, 6):
    Spaceship.turnLeft()
    Spaceship.step(i)
move(2)

13、

在这里插入图片描述

def move(a, b, c, ok):
    Dev.step(a)
    if ok:
        Dev.turnRight()
        Dev.step(b)
        Dev.step(-b)
        Dev.turnLeft()
    Dev.step(-a)
    Spaceship.step(c)
move(4, 2, 4, 1)
move(3, 1, 3, 0)
move(5, -1, 2, 1)
move(4, 3, 1, 1)
Dev.turnRight()
move(3, 3, 0, 0)

14、
在这里插入图片描述

def move(a, b, c):
    Dev.step(a)
    Dev.step(-a)
    Dev.turnLeft()
    Dev.step(b)
    Dev.step(-b)
    Spaceship.step(c)
Spaceship.turnRight()
move(3, 2, 6)
Spaceship.turnLeft()
Spaceship.step(3)
Spaceship.turnRight()
Spaceship.turnRight()
move(2, -1, 6)
Spaceship.turnRight()
move(3, 5, 3)

Spaceship.turnLeft()
Spaceship.step(3)
Spaceship.turnRight()
move(1, -4, 3)
move(-3, 4, 0)

15、
在这里插入图片描述

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

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

16、

在这里插入图片描述

def move(a, b, c, d, e):
    Spaceship.step(2)
    Flyer[a].step(b)
    Dev.step(c)
    Dev.turnLeft()
    Dev.step(d)
    Dev.turnLeft()
    Spaceship.step(d)
    Dev.step(c)
    Spaceship.step(e)
    Spaceship.turnRight()
    Dev.turnLeft()
move(1, 4, 4, 3, 8)
move(3, 3, 6, 5, 6)
move(2, 2, 3, 6, 5)
move(0, 2, 1, 9, 1)

17、

在这里插入图片描述

def move(a, b, c, d, ob):
    for i in range(a):
        while Flyer[b + i].disappear() == d: 
            wait()
        ob.step(c)
    for i in range(2):
        ob.turnRight()
        ob.step(c)
    ob.turnLeft()
    ob.step(c)

move(3, 0, 2, True, Dev)
move(2, 3, 4, False, Spaceship)
Dev.turnLeft()
move(3, 5, 3, True, Dev)

18、
在这里插入图片描述

def move_F(a, b, c, d, e):
    for i in range(a):
        Flyer[i * c + b].step(i * d + e)
def move(a, b):
    Dev.step(a)
    Dev.turnRight()
    Dev.step(b)
    Dev.turnLeft()
move_F(3, 0, 1, 1, 1)
move_F(5, 3, 2, 1, 2)
move(5, 3)
move_F(3, 12, 1, 2, 1)
move(9, 7)
move_F(3, 10, -2, 0, 7)
move_F(2, 3, -2, 3, 3)
move(-6, -4)
Dev.step(-7)

19、

在这里插入图片描述

def move_D(a, b):
    Dev.step(b)
    for i in (a, -a, a, a, a):
        Dev.turnRight()
        Dev.step(i)
def move_S(a, b, c):
    Spaceship.step(a)
    Dev.step(b)
    Spaceship.step(c)
move_D(3, 1)
Dev.step(-3)
Dev.turnLeft()
move_S(0, -7, 5)
move_D(2, 1)
for i in range(3):
    Dev.step(-2)
    Dev.turnLeft()
move_S(2, 3, 2)
move_D(-4, -1)
Dev.turnLeft()
move_S(4, 9, 2)
move_D(-3, -1)
Dev.turnLeft()
Dev.step(3)
Dev.turnRight()
Dev.step(3)
Dev.turnLeft()
Dev.step(3)

20、
在这里插入图片描述

def move(a, b, c, d, o):
    Dev.step(a)
    Dev.turnLeft()
    if o: 
        for i in range(d): 
            Flyer[i+c].step(i+1)
    if o != 1: 
        for i in range(d): 
            Flyer[c-i].step(i+1)
    for i in range(4):
        Dev.step(b)
        Dev.turnRight()
        Dev.step(b)
    Dev.turnRight()
    Dev.step(-a)
    Dev.turnRight()
move(7, 2, 9, 2, 1)
move(4, 3, 8, 4, 0)
move(5, 1, 0, 2, 1)
move(3, 2, 4, 3, 0)
  • 8
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

青岛少儿编程-王老师

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

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

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

打赏作者

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

抵扣说明:

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

余额充值