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()
相关推荐
陈苏同学几秒前
4. 将pycharm本地项目同步到(Linux)服务器上——深度学习·科研实践·从0到1
linux·服务器·ide·人工智能·python·深度学习·pycharm
唐家小妹4 分钟前
介绍一款开源的 Modern GUI PySide6 / PyQt6的使用
python·pyqt
羊小猪~~36 分钟前
深度学习项目----用LSTM模型预测股价(包含LSTM网络简介,代码数据均可下载)
pytorch·python·rnn·深度学习·机器学习·数据分析·lstm
Marst Code1 小时前
(Django)初步使用
后端·python·django
985小水博一枚呀1 小时前
【对于Python爬虫的理解】数据挖掘、信息聚合、价格监控、新闻爬取等,附代码。
爬虫·python·深度学习·数据挖掘
立秋67891 小时前
Python的defaultdict详解
服务器·windows·python
萧鼎2 小时前
Python第三方库选择与使用陷阱避免
开发语言·python
白拾2 小时前
使用Conda管理python环境的指南
开发语言·python·conda
是刃小木啦~2 小时前
三维模型点云化工具V1.0使用介绍:将三维模型进行点云化生成
python·软件工程·pyqt·工业软件
总裁余(余登武)2 小时前
算法竞赛(Python)-万变中的不变“随机算法”
开发语言·python·算法