Beta
Blackjack, should I hit?
37 of 122davidhu2000
Loading description...
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
The instructions still seem unclear to me: For example, it says
Testing [8, 'A'] and J; Expecting: ['stay', 19]
. But if I can choose what an Ace is, whether soft (1) or hard (11), I may opt for soft in this case. My hand is 8+1=9. Hitting Jack brings me to 19. There's nothing wrong with that.Moreover, what's supposed to happen if the hand is
[9,'A']
and the next card isA
. Seems obvious to me that I should choose a soft Ace, having 9+1 in my hand, and then hit next card (Ace 11), totalling 21.How do you know if an Ace is 1 or 11. You didn't tell us which situation causes 1 and which situation causes 11.
From the description:
not a kata issue
The idea is: at any point where you are adding up the total value of your current hand of cards, it is up to you to decide whether or not it is more mathematically advantageous to count an
ace
as1
or11
.If score of ["A",1],7 is 19. Then why ["A,1],"T" is 12?
btw what should the function called!
.
Python translation kumited -- please check and approve (author is inactive)
.
Edge cases like
should return [hit,21] for ([5, 5], A)
is not popping up frequently enough in the random tests, code that fails on it will pass after a few resubmits.It should be put in the fixed tests.
Added to JS and Ruby.
.
In the description, it states:
The card values are selected from the array below. ['A', 2, 3, 4, 5, 6, 7, 8, 9, 'T', 'J', 'Q', 'K']
At least one test case has
10
representing the 10 card, instead of'T'
as specified in the description. If this is intentional, the description needs to be revised; otherwise the test case needs to be revised..
And one more suggestion: better keep the type of all possible values consistent. I mean, it feels strange while an argument denoting the rank of a card could be a number or a string.
that's part of the challenge of the kata, to interpret the given keys for the values of a card.
Then why not make numbers strings? That would be more challenging.
I would of thought dealing with two different types would be harder?
That's fake difficulty, and whoever even think that it's a good idea should feel bad.
7+ years have passed without resolution, closing
What about
[8, 9]
? Make better explanation in your description.that's a hard 17 because it has no Ace, this is explained in the description already.
No it is not.
That's all I see about the rules. There is no such sentence like "A hard 17 means those cards whose total point is 17 without an Ace".
i clarified what a hard 17 is. Hopefully that elminate any confusion.
it's inferred by reading the rules:
This comment has been hidden.
i squashed that bug like, well, a bug.
let me know if this works for you.
You should not let the user define the function
cardValue
as then your random tests become invalid.i fixed the issue
i forgot to change the cardValue function in the test to the function for the test. Damn copy and paste.