Skip to content

Leigh Rose rock paper scissors version 1 - #234

Open
Leigh-Rose wants to merge 2 commits into
makersacademy:mainfrom
Leigh-Rose:main
Open

Leigh Rose rock paper scissors version 1#234
Leigh-Rose wants to merge 2 commits into
makersacademy:mainfrom
Leigh-Rose:main

Conversation

@Leigh-Rose

Copy link
Copy Markdown

No description provided.

@wjmarshall wjmarshall left a comment

Copy link
Copy Markdown

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!

Comment thread app.rb
@@ -1,8 +1,33 @@
require 'sinatra/base'

Copy link
Copy Markdown

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

Comment thread lib/game.rb
@@ -0,0 +1,24 @@
class Game

Copy link
Copy Markdown

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

Comment thread lib/game.rb
def initialize(player)
end

def determine_winner(player_choice)

Copy link
Copy Markdown

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?

Comment thread app.rb
end

post '/names' do
$player_1 = Player.new(params[:player_1_name])

Copy link
Copy Markdown

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?

Comment thread lib/player.rb
@@ -0,0 +1,8 @@
class Player

Copy link
Copy Markdown

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.

2 participants