极客战记-跃火林中
1、选择英雄和编程语言

2、选择装备

3、写中文注释

1、写代码
# 在这关,别碰恶魔石!往其他方向移动避开它们!
while True:
evilstone = hero.findNearestItem()
if evilstone:
pos = evilstone.pos
if pos.x == 34:
# 如果恶魔石在左边,走到右边。
hero.moveXY(46, 22)
pass
else:
# 如果恶魔石在右边,走到左边。
hero.moveXY(34, 22)
pass
else:
# 如果没有恶魔石,那就去到中间。
hero.moveXY(40, 22)
pass

2、运行

1、写代码
// 在这关,别碰恶魔石!往其他方向移动避开它们!
while(true) {
var evilstone = hero.findNearestItem();
if (evilstone) {
var pos = evilstone.pos;
if (pos.x == 34) {
// 如果恶魔石在左边,走到右边。
hero.moveXY(46, 22);
}
else{
// 如果恶魔石在右边,走到左边。
hero.moveXY(34, 22);
}}
else{
// 如果没有恶魔石,那就去到中间。
hero.moveXY(40, 22);
}
}

2、运行

1、写代码
# 在这关,别碰恶魔石!往其他方向移动避开它们!
while true
evilstone = hero.findNearestItem()
if evilstone
pos = evilstone.pos
if pos.x == 34
# 如果恶魔石在左边,走到右边。
hero.moveXY(46, 22)
else
# 如果恶魔石在右边,走到左边。
hero.moveXY(34, 22)
else
# 如果没有恶魔石,那就去到中间。
hero.moveXY(40, 22)

2、运行

1、写代码
-- 在这关,别碰恶魔石!往其他方向移动避开它们!
while true do
local evilstone = hero:findNearestItem()
if evilstone then
local pos = evilstone.pos
if pos.x == 34 then
-- 如果恶魔石在左边,走到右边。
hero:moveXY(46, 22)
else
-- 如果恶魔石在右边,走到左边。
hero:moveXY(34, 22)
end
else
-- 如果没有恶魔石,那就去到中间。
hero:moveXY(40, 22)
end
end

2、运行
