Another diversion
I was working through the Koans and got distracted. I'm still learning Ruby, I promise!
Somewhere, I stumbled across Ruby Warrior, and it looked fun. Plus it looked like something I could do without need to concentrate quite so hard, which helps if you're stuck on the couch watching "kid shows", for instance.
This is a turn based game where you can only do one action on your turn. It is a two dimensional board, where you, as the warrior, have only a small set of abilities:
walkfeelattackhealthrestrescue Before you decide what to do, you can also "feel" a square. This tells you what is there. The result can be one of five states: emptystairsenemycaptivewall Currently, I am stuck on level 6, but I'll still give you a taste for the code:
class Player
@last_known_health = nil
RUNAWAY = 20 * 0.40
BANZAI = 20 * 0.75
@found_wall = false
def play_turn(warrior)
@last_known_health = warrior.health unless @last_known_health
took_damage = @last_known_…
Somewhere, I stumbled across Ruby Warrior, and it looked fun. Plus it looked like something I could do without need to concentrate quite so hard, which helps if you're stuck on the couch watching "kid shows", for instance.
This is a turn based game where you can only do one action on your turn. It is a two dimensional board, where you, as the warrior, have only a small set of abilities:
walkfeelattackhealthrestrescue Before you decide what to do, you can also "feel" a square. This tells you what is there. The result can be one of five states: emptystairsenemycaptivewall Currently, I am stuck on level 6, but I'll still give you a taste for the code:
class Player
@last_known_health = nil
RUNAWAY = 20 * 0.40
BANZAI = 20 * 0.75
@found_wall = false
def play_turn(warrior)
@last_known_health = warrior.health unless @last_known_health
took_damage = @last_known_…