Created
December 25, 2014 05:24
-
-
Save mikedao/f63ab12e3d1ba318121c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Centaur | |
attr_reader :name, | |
:breed | |
def initialize(name, breed) | |
@name = name | |
@breed = breed | |
@actions = 0 | |
@standing = true | |
end | |
def shoot | |
if cranky? || laying? | |
"NO!" | |
else | |
@actions += 1 | |
"Twang!!!" | |
end | |
end | |
def run | |
if cranky? || laying? | |
"NO!" | |
else | |
@actions += 1 | |
"Clop clop clop clop!!!" | |
end | |
end | |
def cranky? | |
@actions > 2 ? true : false | |
end | |
def standing? | |
@standing | |
end | |
def sleep | |
standing? ? "NO!" : @actions = 0 | |
end | |
def lay_down | |
@standing = false | |
end | |
def laying? | |
!standing? | |
end | |
def stand_up | |
@standing = true | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Medusa | |
attr_reader :name, | |
:statues | |
def initialize(name) | |
@name = name | |
@statues = [] | |
end | |
def stare(victim) | |
@statues << victim | |
victim.stone | |
end | |
end | |
class Person | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
@stoned = false | |
end | |
def stone | |
@stoned = true | |
end | |
def stoned? | |
@stoned | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Werewolf | |
attr_reader :name, | |
:location, | |
:human | |
def initialize(name, location="London") | |
@name = name | |
@location = location | |
@human = true | |
end | |
def human? | |
@human | |
end | |
def change! | |
@human = !@human | |
end | |
def werewolf? | |
!human | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment