Closed cristinaocanamanzano closed 6 years ago
Example of output:
Hi Cristina, in the run_game method you're calling the move method 3 times. Once at the start of your while loop, then again on the line
if move == "hit"
and finally on the line
elsif move == "stick"
So I think the program is basically asking for a move multiple times each round. Try setting a variable to equal move and go from there.
@NadiaAiraf thanks!! I did this, and now seems to be working sometimes:
However, it does not work in this scenario:
Context -Imagine that, right now, I have a total score of, let's say, 17 -Imagine that in my next move I get a card with value 10 (which means my total score is now 27)
What should happen? The program should tell me "you busted with 27!" (because the score got higher than 21)
Issue Instead of that, the program tells me "your score is 27" , and then, only in the next move, it tells me that I busted
I think I might need to move the conditional "if score(array_cards) > 20..." somewhere else to avoid this, but I'm a little lost here (does this make sense?)
Anyway, thanks again for your help!
Hi Cristina, you've got this issue in the new code because of where you've put the input = move
. With it at the end of the if statement then when you're holding cards that add up to 20 hit and get a 10, it will ask for another move before breaking.
Without giving too much away a combination of the first code you posted and the code above should get you there.
Thanks a lot Nadia!!
Hello!
I'm stuck in Chapter 9 right now. When I run the file in the console, the program just keeps asking me if I want to hit or move and, when I enter the input, it keeps repeating the same thing.
Does anyone have any idea how could I fix this? Here are some screenshots of my code.
Any help would be highly appreciated!