-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPS Challenge #2132
base: main
Are you sure you want to change the base?
RPS Challenge #2132
Conversation
|
||
post '/name' do | ||
session[:namegiven] = params[:username] | ||
redirect '/play' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reasonable to see the separation of retrieving user input from displaying a new page.
I think it's a good thing.
@@ -0,0 +1,10 @@ | |||
<h1>Welcome <%= @name %> to Rock, Paper, Scissors <%= @name_1 %></h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@name_1 probably needs to be deleted
<h1>The computer played <%= @comp_selected %></h1> | ||
<%if @tool_selected == @comp_selected %> | ||
<h1>It is a draw</h1> | ||
<%elsif @tool_selected == "paper" && @comp_selected == "rock" || @tool_selected == "rock" && @comp_selected == "scissors" || @tool_selected == "scissors" && @comp_selected == "paper" %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use a hash in winning conditions, because it's easier to edit later
@@ -0,0 +1,37 @@ | |||
require 'sinatra/base' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding test cases would be easier for testing multiple times.
@@ -0,0 +1,9 @@ | |||
<h1>You played <%=@tool_selected%></h1> | |||
<h1>The computer played <%= @comp_selected %></h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice to show both choices: user and computer. Good user experience, also good for testing.
No description provided.