Skip to content

Feature: Completed all examples #39

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

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

Conversation

ThePomodoro
Copy link

Hi Jesse. I've completed the Panda, Tiger, Eagle examples. Please let me know how I did.

A couple of things:

  1. I'm a bit unsure how to cope with the .idea file issue you mentioned. I'm guessing I'm pushing lots of supporting files used by my IDE to the repository, which must be annoying - could you help me with that by telling me how to get git to ignore them?

  2. To complete the Eagle example I had to tell the Game.status method when someone had stood. So I called Game.status with a passed symbol, which was normally :unstood to indicate that no one had stood (forcing it to hide the cards). If Game.status was invoked from Game.stand, it was passed the :stood symbol, which told it that the game had been stood. Then it knew to reveal the dealer cards. However, all this meant that I had to change every method call to Game.stood, which seems inefficient and clunky.

What is a better way?

  1. I tried to write an rspec test to ensure that the game stood for the player when the player bust. I thought that would involve setting the player_hand value to 21, and then hitting, and then checking that the game received 'stand' as a method call. Can't get it to work though. Can you tell me what I'm doing wrong?

Onward and upward! Thanks.

@jwo
Copy link
Member

jwo commented Feb 11, 2014

  1. I'm a bit unsure how to cope with the .idea file issue you mentioned. I'm guessing I'm pushing lots of supporting files used by my IDE to the repository, which must be annoying - could you help me with that by telling me how to get git to ignore them?

Open your ~/.gitignore and add ".idea/" to it

  1. To complete the Eagle example I had to tell the Game.status method when someone had stood. So I called Game.status with a passed symbol, which was normally :unstood to indicate that no one had stood (forcing it to hide the cards). If Game.status was invoked from Game.stand, it was passed the :stood symbol, which told it that the game had been stood. Then it knew to reveal the dealer cards. However, all this meant that I had to change every method call to Game.stood, which seems inefficient and clunky.

I generally prefer that a player can hit! or stand! -- at which point the game knows the current player who has control. So it would rotate through the players, then the dealers hand, at which point it would see who won.

  1. I tried to write an rspec test to ensure that the game stood for the player when the player bust. I thought that would involve setting the player_hand value to 21, and then hitting, and then checking that the game received 'stand' as a method call. Can't get it to work though. Can you tell me what I'm doing wrong?

What about stacking the deck to an order of your choosing (such as 10, 2, 10) and having the player hit? should bust, right?

if @player_hand.value > 21
stand
else
status(:unstood)
Copy link
Member

Choose a reason for hiding this comment

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

I think you could not have the else block here.

Or, more in the language of the game:

if @player_hand.value > 21
  bust!
end

@ThePomodoro
Copy link
Author

Just repushed. How's this? The only thing that doesn't work is that rspec
test, "player should bust after 21"

Best wishes,

Danny Bradbury
Freelance writer and editor
Web: www.wordherder.net
Twitter: @dannybradbury
Skype: dannybradbury
Tel: +1 604 757 4566

On 10 February 2014 18:42, Jesse Wolgamott [email protected] wrote:

  1. I'm a bit unsure how to cope with the .idea file issue you mentioned.
    I'm guessing I'm pushing lots of supporting files used by my IDE to the
    repository, which must be annoying - could you help me with that by telling
    me how to get git to ignore them?

Open your ~/.gitignore and add ".idea/" to it

  1. To complete the Eagle example I had to tell the Game.status method when
    someone had stood. So I called Game.status with a passed symbol, which was
    normally :unstood to indicate that no one had stood (forcing it to hide the
    cards). If Game.status was invoked from Game.stand, it was passed the
    :stood symbol, which told it that the game had been stood. Then it knew to
    reveal the dealer cards. However, all this meant that I had to change every
    method call to Game.stood, which seems inefficient and clunky.

I generally prefer that a player can hit! or stand! -- at which point the
game knows the current player who has control. So it would rotate through
the players, then the dealers hand, at which point it would see who won.

  1. I tried to write an rspec test to ensure that the game stood for the
    player when the player bust. I thought that would involve setting the
    player_hand value to 21, and then hitting, and then checking that the game
    received 'stand' as a method call. Can't get it to work though. Can you
    tell me what I'm doing wrong?

What about stacking the deck to an order of your choosing (such as 10, 2,
10) and having the player hit? should bust, right?

Reply to this email directly or view it on GitHubhttps://github.com//pull/39#issuecomment-34721582
.

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

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

man, these .idea files are the worst.

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