多语言展示
当前在线:347今日阅读:168今日分享:49

极客战记-春雷

如果你卡在这里了,那么看看这个攻略吧
准备工作
1

选择英雄和编程语言

2

选择装备

3

写中文注释

python
1

写代码# Certain coins and gems attract lightning.# 这个英雄应只收集银币和蓝宝石while True:    item = hero.findNearestItem()    # A silver coin has a value of 2.    # Collect if item.type is equal to 'coin'    # AND item.value 相等于2    if item.type == 'coin' and item.value == 2:        hero.moveXY(item.pos.x, item.pos.y)    # 一个蓝宝石价值10    # Collect if item.type is equal to 'gem'    # AND item.value is equal to 10.    if item.type == 'gem' and item.value == 10:        hero.moveXY(item.pos.x, item.pos.y)

2

运行

javascript
1

写代码// 某些硬币和宝石吸引闪电。// 这个英雄应只收集银币和蓝宝石while (true) {    var item = hero.findNearestItem();    // 一枚银币的价值为2。    // 如果item.type等于“coin”,则收集    // AND item.value 相等于2    if (item.type == 'coin' && item.value == 2) {        hero.moveXY(item.pos.x, item.pos.y);    }    // 一个蓝宝石价值10    // 如果item.type等于“gem”,则收集    // AND item.value等于10。    if (item.type == 'gem' && item.value == 10) {        hero.moveXY(item.pos.x, item.pos.y);    }}

2

运行

coffeescript
1

写代码# Certain coins and gems attract lightning.# 这个英雄应只收集银币和蓝宝石while true            item = hero.findNearestItem()    # A silver coin has a value of 2.    # Collect if item.type is equal to 'coin'    # AND item.value 相等于2    if item.type == 'coin' and item.value == 2        hero.moveXY(item.pos.x, item.pos.y)    # 一个蓝宝石价值10    # Collect if item.type is equal to 'gem'    # AND item.value is equal to 10.    if item.type == 'gem' and item.value == 10        hero.moveXY(item.pos.x, item.pos.y)

2

运行

lua
1

写代码-- 某些硬币和宝石吸引闪电。-- 这个英雄应只收集银币和蓝宝石while true do    local item = hero:findNearestItem()    -- 一枚银币的价值为2。    -- 如果item.type等于“coin”,则收集    -- AND item.value 相等于2    if (item.type == 'coin' and item.value == 2)  then        hero:moveXY(item.pos.x, item.pos.y)    end    -- 一个蓝宝石价值10    -- 如果item.type等于“gem”,则收集    -- AND item.value等于10。    if (item.type == 'gem' and item.value == 10)  then        hero:moveXY(item.pos.x, item.pos.y)    endend

2

运行

推荐信息