写给自己看(?)的东西
level 1
弱智版本
class Player
def play_turn(warrior)
# cool code goes here
if (warrior.feel:right).wall?
warrior.walk!
else
warrior.walk!:right
end
end
end
按要求版本
class Player
def play_turn(warrior)
@direction=warrior.direction_of_stairs
warrior.walk!@direction
end
end
level 2
没有VPN 不玩
level 3
弱智版本(有两个怪没杀)
class Player
def play_turn(warrior)
@direction=warrior.direction_of_stairs
if warrior.health<20
if (warrior.feel:right).wall?
warrior.rest!
else
warrior.walk!:right
end
elsif (warrior.feel:right).captive?
warrior.rescue!:right
else
if (warrior.feel@direction).enemy?
if (warrior.feel@direction).empty?
warrior.walk!@direction
elsif warrior.feel.enemy?
warrior.bind!
elsif(warrior.feel:backward).enemy?
warrior.bind!:backward
else
warrior.attack!@direction
end
else
warrior.walk!@direction
end
end
end
end