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()
相关推荐
小赖同学啊2 小时前
物联网数据安全区块链服务
开发语言·python·区块链
码荼2 小时前
学习开发之hashmap
java·python·学习·哈希算法·个人开发·小白学开发·不花钱不花时间crud
小陈phd3 小时前
李宏毅机器学习笔记——梯度下降法
人工智能·python·机器学习
kk爱闹3 小时前
【挑战14天学完python和pytorch】- day01
android·pytorch·python
Blossom.1183 小时前
机器学习在智能建筑中的应用:能源管理与环境优化
人工智能·python·深度学习·神经网络·机器学习·机器人·sklearn
亚力山大抵4 小时前
实验六-使用PyMySQL数据存储的Flask登录系统-实验七-集成Flask-SocketIO的实时通信系统
后端·python·flask
showyoui4 小时前
Python 闭包(Closure)实战总结
开发语言·python
amazinging4 小时前
北京-4年功能测试2年空窗-报培训班学测开-第四十一天
python·学习·appium
amazinging5 小时前
北京-4年功能测试2年空窗-报培训班学测开-第三十九天
python·学习·appium
m0_723140235 小时前
Python训练营-Day42
python