-
Notifications
You must be signed in to change notification settings - Fork 250
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
Leigh Rose rock paper scissors version 1 #234
base: main
Are you sure you want to change the base?
Conversation
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.
Hi Leigh, here are some thoughts I had while reading your code. Looks great!
@@ -1,8 +1,33 @@ | |||
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.
This seems a good, slim controller—logic is extracted to the lib files
@@ -0,0 +1,24 @@ | |||
class Game |
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.
Good use of single-responsibility principle in structuring of classes—each has a clear, single purpose
def initialize(player) | ||
end | ||
|
||
def determine_winner(player_choice) |
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.
This seems quite a long method—perhaps there is a shorter solution?
end | ||
|
||
post '/names' do | ||
$player_1 = Player.new(params[:player_1_name]) |
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.
Perhaps there is another solution to avoid using global variables?
@@ -0,0 +1,8 @@ | |||
class Player |
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.
Nice short, simple class!
No description provided.