RPS Challenge - #2132
Open
abacus2020 wants to merge 2 commits into
Open
Conversation
|
|
||
| post '/name' do | ||
| session[:namegiven] = params[:username] | ||
| redirect '/play' |
There was a problem hiding this comment.
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.
@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.
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.
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.
Very nice to show both choices: user and computer. Good user experience, also good for testing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.