Sha256: 27f9e1d7f95a0659c3535989ef70447a9403796518104ca86c5d1f12bb9d5be1
Contents?: true
Size: 544 Bytes
Versions: 1
Compression:
Stored size: 544 Bytes
Contents
module Tarzan def self.play! puts %{Welcome to the Game Hall} puts %{Let’s play Rock Paper Scissors} puts %{Pick [R]ock, [P]aper, or [S]cissors: } move_p1 = gets.strip move_p2 = ['R', 'P', 'S'].sample puts %{You played #{move_p1} - I played #{move_p2}} case "#{move_p1}#{move_p2}" when 'RS', 'SP', 'PR' then puts %{You win!} when 'RP', 'SR', 'PS' then puts %{You lose!} when 'RR', 'SS', 'PP' then puts %{It’s a tie!} end puts %{Goodbye, and come back to the Game Hall} end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tarzan-0.0.2 | lib/tarzan.rb |