Skip to content

Instantly share code, notes, and snippets.

@bramdemoor
Last active December 27, 2015 04:09
Show Gist options
  • Save bramdemoor/7264589 to your computer and use it in GitHub Desktop.
Save bramdemoor/7264589 to your computer and use it in GitHub Desktop.
Ruby Russian Roulette
require 'colorize'
class Revolver
def initialize(chamberCount)
@chambers = Array.new(chamberCount, false)
@chambers[0] = true
end
def spin
return @chambers.sample
end
end
system('clear')
print "Russian Roulette\nKeep pressing enter to play!"
gun = Revolver.new(6)
alive = true
begin
gets
puts "Spinning..."
alive = !gun.spin
puts "You're winning! Keep playing!" if alive
end while alive
puts "BOOM HEADSHOT".red
puts "Game over!"
@ABaker86
Copy link

ABaker86 commented Nov 1, 2013

A good way to "Kill" time and still look like you're doing something. 😏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment