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

I've finished panda level! #30

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

I've finished panda level! #30

wants to merge 4 commits into from

Conversation

ardder
Copy link

@ardder ardder commented Jun 27, 2013

No description provided.

@@ -75,6 +81,7 @@ def initialize

def hit
@player_hand.hit!(@deck)
stand if @player_hand.value > 21
Copy link
Member

Choose a reason for hiding this comment

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

Just a detail of blackjack, but you'll also want to stand if you're exactly 21 as well.

@jwo
Copy link
Member

jwo commented Jun 27, 2013

Looks great -- let me know if my thoughts on the game.stand make sense or not.

@ardder ardder closed this Jun 30, 2013
@ardder ardder reopened this Jun 30, 2013
end

def value
@cards.inject(0) {|sum, card| sum += card.value }
Copy link
Member

Choose a reason for hiding this comment

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

Good job with inject here.

@jwo
Copy link
Member

jwo commented Jul 4, 2013

In order to hide the card, I remove the attr_reader :cards and implement the new method Hand#cards.

This is a great progression in your programming --- I think it worked really well, and is one of the reasons to use attr_readers in your class. In you're using an attr_reader, you can easily promote it to a "real" method with custom logic.

Nice job on this!

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