Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- level 1
- ---------
- |@ >|
- ---------
- =end
- class Player
- def play_turn(warrior)
- warrior.walk!
- end
- end
- =begin
- level 2
- ---------
- |@ s >|
- ---------
- =end
- class Player
- def play_turn(warrior)
- warrior.feel.empty?? warrior.walk! : warrior.attack!
- end
- end
- =begin
- level 3
- ---------
- |@ s ss s>|
- ---------
- =end
- class Player
- def play_turn(warrior)
- warrior.feel.empty? && warrior.health<10? warrior.rest! : warrior.feel.empty?? warrior.walk! : warrior.attack!
- end
- end
- =begin
- level 4
- -------
- |@ Sa S>|
- -------
- =end
- class Player
- def play_turn(warrior)
- @health = warrior.health unless @health
- under_attack=false
- if warrior.health<@health then under_attack=true end
- if (warrior.feel.empty?) && (warrior.health<18) && (not under_attack)
- warrior.rest!
- else
- if warrior.feel.empty?
- warrior.walk!
- else warrior.attack! end end
- @health=warrior.health
- end
- end
Add Comment
Please, Sign In to add comment