O'Reilly logo

Wicked Cool Ruby Scripts by Steve Pugh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Rock, Paper, Scissors

Rock, Paper, Scissors

rps.rb

I still use Rock, Paper, Scissors whenever there is a big decision involving another person that needs an unbiased opinion. I guess I could flip a quarter, but Rock, Paper, Scissors is a lot more suspenseful. Seriously though, this game is big in some circles. If you didn't know, there are clubs and tournaments to support the game. This script will be your practice partner until you make it to the big leagues.

The Code

 puts "\n\nWelcome to Rock, Paper, Scissors!" puts "This is a game of chance; the computer randomly picks one of three choices." puts "\nRock beats Scissors, but is beaten by Paper." ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required