Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Leigh-Rose
Copy link

No description provided.

Copy link

@wjmarshall wjmarshall left a 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'

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

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)

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])

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice short, simple class!

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.

None yet

2 participants