Skip to content

Instantly share code, notes, and snippets.

@wofockham
Created March 19, 2014 04:55
Show Gist options
  • Select an option

  • Save wofockham/1b0bf009800b0bcd4ec9 to your computer and use it in GitHub Desktop.

Select an option

Save wofockham/1b0bf009800b0bcd4ec9 to your computer and use it in GitHub Desktop.

#Title: Games on Rails

Summary

Games on Rails is a web application with three games

  • Magic 8 Ball
  • Secret Number
  • Rock Paper Scissors

Magic 8 Ball

  • Magic 8 ball takes user's questions from the the URL as params and returns a positive or negative answer.

Secret Number

  • Users click a number between 1 and 10. The controller validates the guess and renders the win or lose view.

Rock Paper Scissors

  • Add the game Rock Paper Scissors to the "Games on Rails App".
  • Create a route that goes from /games/rock_paper_scissors/:throw to games#rock_paper_scissors_play
  • Use params[:throw] as a user's choice
  • Compare the 2! If users throw matches the apps throw, the user wins.
  • i.e. If a user throws rock http://localhost:3000/games/rock_paper_scissors/rock and the server picks rock player wins! (Yes, I know that is not how RPS works) Bonus: Set the win or lose condition based on the real rules of Rock Paper Scissors. Bonus: Rock Paper Scissors Lizard Spock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment