Skip to content

Instantly share code, notes, and snippets.

@panSarin
Created June 8, 2020 19:35
Show Gist options
  • Save panSarin/356850d595037a140e800baab02d0b67 to your computer and use it in GitHub Desktop.
Save panSarin/356850d595037a140e800baab02d0b67 to your computer and use it in GitHub Desktop.
class Kijek
def roll_a_die
rand(100)
end
def win
puts 'Kijek: Jedź bezpieczeni Sarin!'
end
def loose
puts 'Kijek: kuuuuurwaaaa'
end
end
class Sarin
def roll_a_die
rand(99)
end
def win
puts 'Sarin: Żryj gruz cyganie, jedz ostrożnie i daj mnie piwko'
end
def loose
puts 'Sarin: Proszę zapiąc pasy i otworzyć piwko. '
end
end
class Game
def self.play_a_game
sarin = Sarin.new
kijek = Kijek.new
sarin_result = sarin.roll_a_die
puts "Wynik sarina: #{sarin_result}"
kijek_result = kijek.roll_a_die
puts "Wynik kijka: #{kijek_result}"
if sarin_result > kijek_result
sarin.win
kijek.loose
elsif sarin_result < kijek_result
sarin.loose
kijek.win
else
Game.play_a_game
end
end
end
Game.play_a_game
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment