ICode国际青少年编程竞赛- Python-2级训练场-坐标与列表遍历

ICode国际青少年编程竞赛- Python-2级训练场-坐标与列表遍历

1、

python 复制代码
for i in range(5):
    Flyer[i].step(Dev.x -Flyer[i].x)
Dev.step(Item.y - Dev.y)

2、

python 复制代码
for i in range(7):
    Flyer[i].step(Dev.y - Flyer[i].y)
Dev.step(Item[2].x - Dev.x)

3、

python 复制代码
for i in range(5):
    Flyer[i].step(Dev.y - Flyer[i].y)
Dev.step(Item[1].x - Dev.x)

4、

python 复制代码
for i in range(4):
    Spaceship.step(2)
    d = Item[i].x -Dev.x
    Dev.step(d)
    Dev.step(-d)

5、

python 复制代码
for i in range(5):
    Spaceship.step(2)
    d = Item[i].x - Dev.x
    Dev.step(d)
    Dev.step(-d)

6、

python 复制代码
for i in range(4):
    Dev.step(i + 1)
    Dev.turnLeft()
    d = Item[i].x - Dev.x
    Dev.step(d)
    Dev.step(-d)
    Dev.turnRight()

7、

python 复制代码
for i in range(5):
    Spaceship.step(3)
    d = Item[i].x - Dev.x
    Dev.step(d)
    Dev.step(-d)

8、

python 复制代码
Dev.turnLeft()
for i in range(3):
    Spaceship.step(2)
    d = Dev.y - Item[i].y
    Dev.step(d)
    Dev.step(-d)

9、

python 复制代码
for i in range(4):
    Spaceship.step(i + 1)
    d = Item[i].x - Dev.x
    Dev.step(d)
    Dev.step(-d)

10、

python 复制代码
for i in range(4):
    # 飞船的移动步数是飞船到item之间y坐标的差值
    Spaceship.step(Spaceship.y-Item[i].y)
    Dev.step(Item[i].x -Spaceship.x)
    # 飞船的x值是不变的,为2,下面的坐标公式可以修改为(Spaceship.x - Item[i].x)或者(2-Item[i].x)
    Dev.step(Spaceship.x - Item[i].x)

11、

python 复制代码
for i in range(5):
    Spaceship.step(Spaceship.y - Item[i].y)
    Dev.step(Item[i].x - Spaceship.x)
    Dev.step(Spaceship.x - Item[i].x)

12、

python 复制代码
for i in range(8):
    Flyer[i].step(Dev.y - Flyer[i].y)
Dev.step(Item[2].x - Dev.x)

13、

python 复制代码
for i in range(4):
    Dev.step(Item[i].x - Dev.x)
    Dev.turnRight()
    Dev.step(Item[i].y - Dev.y)
    Dev.step(1 - Dev.y)
    Dev.turnLeft()

14、

python 复制代码
for i in range(6):
    Flyer[i].step(Dev.y - Flyer[i].y)
Dev.step(Item[4].x - Dev.x)

15、

python 复制代码
for i in range(5):
    Dev.step(Spaceship.y - Item[i].y)
    Dev.step(Item[i].y - Spaceship.y)
    Spaceship.step(2)

16、

python 复制代码
for i in range(5):
    Flyer[i].step(Flyer[i].x - Dev.x)
Dev.step(Dev.y - Item[0].y)

17、

python 复制代码
for i in range(7):
    Spaceship.step(Item[i].x - Spaceship.x)
    Spaceship.turnLeft()
    Spaceship.step(Spaceship.y - Item[i].y)
    Spaceship.turnLeft()
    Spaceship.turnLeft()
    Spaceship.step(9 - Spaceship.y)
    Spaceship.turnLeft()

18、

python 复制代码
Dev.turnLeft()
for i in range(3):
    Spaceship.step(2)
    Dev.step(Spaceship.y - Item[i * 2].y)
    Dev.step(Dev.y - Item[i * 2 + 1].y)
    Dev.step(Dev.y - Spaceship.y)

19、

python 复制代码
for i in range(4):
    Spaceship.step(Item[i].x - Spaceship.x)
    Dev.step(Item[i].y - Spaceship.y)
    Dev.step(Spaceship.y - Dev.y)

20、

python 复制代码
for i in range(3):
    Dev.step(Item[i * 2].y - Dev.y)
    Flyer.step(Item[i * 2].y - Flyer.y)
    Dev.turnLeft()
    
    Dev.step(Item[i * 2].x - Dev.x)
    Dev.step(Item[i * 2 + 1].x - Dev.x)
    Dev.turnRight()
    Dev.step(Item[i * 2 + 1].y - Dev.y)
    Dev.step(Flyer.y - Dev.y)
    Dev.turnRight()
    Dev.step(Dev.x - Flyer.x + 1)
    Dev.turnLeft()
相关推荐
RunsenLIu1 分钟前
基于Django实现的图书分析大屏系统项目
后端·python·django
小小福仔13 分钟前
Python爬虫第四战(使用防盗链下载视频)
爬虫·python·音视频·反爬·防盗链referer
明月看潮生24 分钟前
青少年编程与数学 02-016 Python数据结构与算法 23课题、分布式算法
分布式·python·算法·青少年编程·编程与数学
^_^ 纵歌25 分钟前
用python比较两个mp4是否实质相同
开发语言·python·音频·视频
一直走下去-明26 分钟前
使用python帮助艺术家完成角色动画和服装模型等任务
开发语言·图像处理·pytorch·python·opencv·ai作画
铭阳(●´∇`●)27 分钟前
Python内置函数---anext()
笔记·python·学习
恶霸不委屈1 小时前
突破精度极限!基于DeepSeek的无人机航拍图像智能校准系统技术解析
人工智能·python·无人机·deepseek
u0103731061 小时前
Django REST Framework (DRF)
后端·python·django
雨中夜归人1 小时前
自动化测试工具playwright中文文档-------14.Chrome 插件
python·测试工具·自动化·pytest·playwright
lixy5792 小时前
深度学习之自动微分
人工智能·python·深度学习