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 分钟前
【摧毁比特币】椭圆曲线象限细分求k-陈墨仙
python·算法
有梦想的攻城狮44 分钟前
Java 11中的Collections类详解
java·windows·python·java11·collections
前端小趴菜051 小时前
python - input()函数
python
程序员三藏1 小时前
Selenium+python自动化测试:解决无法启动IE浏览器及报错问题
自动化测试·软件测试·python·selenium·测试工具·职场和发展·测试用例
瓦尔登湖5081 小时前
DAY 40 训练和测试的规范写法
python
站大爷IP2 小时前
Python中None与NoneType的真相:从单例对象到类型系统的深度解析
python
秋难降2 小时前
LRU缓存算法(最近最少使用算法)——工业界缓存淘汰策略的 “默认选择”
数据结构·python·算法
站大爷IP2 小时前
Python新手踩坑实录:这些错误你可能正在犯
python
我星期八休息2 小时前
大模型 + 垂直场景:搜索/推荐/营销/客服领域开发新范式与技术实践
大数据·人工智能·python
深盾安全2 小时前
uv,下一代Python包管理工具
python