Skip to content

Conversation

abacus2020
Copy link

No description provided.


post '/name' do
session[:namegiven] = params[:username]
redirect '/play'

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>

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" %>

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'

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>

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants