Permalink
Browse files

Eliminando

  • Loading branch information...
1 parent b2cb558 commit 60980ec8f8814494f2bdc35152e6f57573a20afe @marcoskata marcoskata committed Oct 13, 2012
Showing with 0 additions and 40 deletions.
  1. +0 −40 HAML-ERB/rpsCAS.rb
View
@@ -1,40 +0,0 @@
-require 'sinatra'
-require 'erb'
-
-before do
- @defeat = { rock: :scissors, paper: :rock, scissors: :paper}
- @throws = @defeat.keys
-end
-
-get '/throw/:type' do
- # the params hash stores querystring and form data
- @player_throw = params[:type].to_sym
-
- halt(403, "You must throw one of the following: '#{@throws.join(', ')}'") unless @throws.include? @player_throw
-
- @computer_throw = @throws.sample
-
- if @player_throw == @computer_throw
- @answer = "There is a tie"
- erb :index
- elsif @player_throw == @defeat[@computer_throw]
- @answer = "Computer wins; #{@computer_throw} defeats #{@player_throw}"
- erb :index
- else
- @answer = "Well done. #{@player_throw} beats #{@computer_throw}"
- erb :index
- end
-end
-__END__
-
-@@index
-<html>
-<head>
-<title>Rock Paper Scissors</title>
-</head>
-<body>
-<h2> Computer chooses: <%= @computer_throw %> </h2>
-<h2> You choose: <%= @player_throw %> </h2>
-<h1> <%= @answer %> </h1>
-</body>
-</html>

0 comments on commit 60980ec

Please sign in to comment.