ICode国际青少年编程竞赛- Python-3级训练场-坐标判断1

ICode国际青少年编程竞赛- Python-3级训练场-坐标判断1

1、

在这里插入图片描述

for i in range(4):   
    Spaceship.step(3)
    Spaceship.turnLeft()
    Spaceship.step(3)
    Spaceship.turnRight()
    if Item[i].y < Dev.y:
        Dev.step(3)
        Dev.step(-3)

2、
在这里插入图片描述

for i in range(9):   
    if Flyer[i].y != Dev.y:
        Flyer[i].step(2)
Dev.step(Item.x - Dev.x)

3、
在这里插入图片描述

for i in range(4):
    Dev.step(3)
    Dev.turnLeft()
    if i != 2:
        Dev.step(3)
        Dev.step(-3)
    Dev.step(-3)
    Dev.turnRight()

4、
在这里插入图片描述

for i in range(4):
    Dev.step(2)
    Dev.turnRight()
    Dev.step(i + 1)
    if Item[i].x > Dev.x:
        Dev.step(2)
        Dev.step(-2)
    Dev.turnLeft()

5、
在这里插入图片描述

for i in range(6):
    if Flyer[i].x != Dev.x:
        Flyer[i].step(Dev.x - Flyer[i].x)
for i in range(4):
    Dev.step(4)
    Dev.step(-4)
    Dev.turnRight()

6、
在这里插入图片描述

for i in range(5):
    Dev.step(2)
    Dev.turnLeft()
    Dev.step(-1)
    Dev.step(1)
    if Dev.y > Item[2 * i].y:
        Dev.step(5)
        Dev.step(-5)
    Dev.turnRight()   

7、
在这里插入图片描述

for i in range(8):
    if Flyer[i].x != 3:
        Flyer[i].step(2)
for i in range(3):
    Dev.step(i + 2)
    Dev.turnLeft()
    Dev.step(i + 2)
    Dev.turnRight()
Dev.step(-9)
Dev.turnRight()
Dev.step(6)

8、
在这里插入图片描述

Dev.turnRight()
for i in range(5):
    Dev.step(4)
    if Item[4 - i].x > Dev.x:
        Dev.turnRight()
        Dev.step(1)
        Dev.step(-1)
        Dev.turnLeft()
    Dev.step(-4)
    Spaceship.step(4)

9、

在这里插入图片描述

for i in range(5):
    Dev.turnLeft()
    Dev.step(5)
    if Item[i].y > Dev.y:
        Dev.turnLeft()
        Dev.step(2)
        Dev.step(-2)
        Dev.turnRight()
    Dev.step(-5)
    Dev.turnRight()
    Dev.step(4)

10、
在这里插入图片描述

for i in range(5):
    if Item[i].x != Flyer[i].x:
        Flyer[i].step()
    Dev.step(2)
    Dev.turnRight()
    Dev.step(2)
    Dev.turnLeft()

11、

在这里插入图片描述

for i in range(8):
    if Flyer[i].x != Item[i].x:
        Flyer[i].step(2)
for i in range(4):
    Dev.step(8)
    Dev.turnRight()

12、

在这里插入图片描述

for i in range(8):
    if Flyer[i].x != Dev.x:
        Flyer[i].step(Dev.x - Flyer[i].x)
Dev.step(Dev.y - Item.y)

13、
在这里插入图片描述

for i in range(6):
    Dev.step(1)
    if Dev.y > Item[i].y:
        Dev.turnLeft()
        Dev.step(10 - Item[i].y)
        Dev.step(Dev.y - 10)
        Dev.turnRight()
    
    Dev.step(1)

14、

在这里插入图片描述

for i in range(7):
    Spaceship.step(2)
    if Item[i].y > Spaceship.y:
        Spaceship.turnRight()
        Spaceship.step(Item[i].y - 9)
        Spaceship.turnRight()
        Spaceship.turnRight()
        Spaceship.step(Spaceship.y - 9)
        Spaceship.turnRight()

15、
在这里插入图片描述

for i in range(6):
    if Item[i].y < Spaceship.y:
        Spaceship.turnLeft()
        Spaceship.step(9 -Item[i].y)
        Spaceship.turnRight()
        Spaceship.turnRight()
        Spaceship.step(9 -Spaceship.y)
        Spaceship.turnLeft()
    Spaceship.step(2)

16、

在这里插入图片描述

for i in range(5):
    Spaceship.step(Item[i].x - Spaceship.x)
    if Item[i].y < Spaceship.y:
        Spaceship.turnLeft()
        Spaceship.step(9 -Item[i].y)
        Spaceship.turnRight()
        Spaceship.turnRight()
        Spaceship.step(9 -Spaceship.y)
        Spaceship.turnLeft()

17、
在这里插入图片描述

for i in range(7):
    if Flyer[i].y != Item[i].y:
        Flyer[i].step(Item[i].y - Flyer[i].y)
for i in range(4):
    Dev.step(7-i)
    Dev.turnRight()

18、

在这里插入图片描述

for i in range(5):
    if Flyer[4-i].y >= Item[4-i].y:
        Flyer[4-i].step(Flyer[4-i].y - Item[4-i].y + 1)
    Spaceship.step(2)
    Spaceship.turnRight()
    Spaceship.step(3)
    Spaceship.turnRight()
    Spaceship.turnRight()
    Spaceship.step(3)
    Spaceship.turnRight()

19、

在这里插入图片描述

for i in range(7):
    if Flyer[i].x != Item[i].x:
        Flyer[i].step()
    Dev.step(2)
    Dev.turnRight()
    Dev.step(Item[i].y - 3)
    Dev.step(3 - Dev.y)
    Dev.turnLeft()

20、
在这里插入图片描述

for i in range(6):
    Spaceship.step()
    if Flyer[i].y != Item[i].y:
        Flyer[i].step(Item[i].y - Flyer[i].y)
    Dev.step(Dev.y - Item[i].y)
    Dev.step(Dev.y - Spaceship.y)
    
    Spaceship.step()

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-11 23:54:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-11 23:54:02       100 阅读
  3. 在Django里面运行非项目文件

    2024-05-11 23:54:02       82 阅读
  4. Python语言-面向对象

    2024-05-11 23:54:02       91 阅读

热门阅读

  1. 十大科技回复框上

    2024-05-11 23:54:02       28 阅读
  2. 高斯数据库创建函数的语法

    2024-05-11 23:54:02       33 阅读
  3. 【重学C语言】十三、字符串

    2024-05-11 23:54:02       32 阅读
  4. js原生三种弹框

    2024-05-11 23:54:02       34 阅读
  5. 详解Python 中可视化数据分析工作流程

    2024-05-11 23:54:02       28 阅读
  6. 天童教育:孩子是难以改变的,除非他感觉到爱

    2024-05-11 23:54:02       27 阅读
  7. 【MySQL】表的增删改查(基础)

    2024-05-11 23:54:02       26 阅读