Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
A player only wins with blackjack if the croupier does not also have blackjack. If everyone has blackjack, then the players all lose. The croupier is not considered a player, so you never return them in the list of winners.
You are showing ['A', 'A', '7', '7', 'K'] as the hand for the croupier, but the croupier should always only start than 2 cards. If the croupier is starting with more than 2 cards, then I agree that the test case is incorrect, however if you added the two '7's and the 'K' yourself, then that is a mistake on your part.
Assuming that the croupier starts with ['A', 'A'], this would add up to 22 if both are valued at 11, so in this case, one of the 'A's would have a value of 1, and the other would have a value of 11, for a total of 12. After this, the croupier would draw the first '7', which would bring their score to 19. Since 19 >= 17, the croupier does not draw any additional cards, and their score is higher than player 1's score of 18, so player 1 loses. Player 2 and player 3 both have scores over 21, so neither of them win either.
In the case above, only player1 has black jack. Black Jack means only two cards, one being an ace ('A'), and the other any card that is worth 10 points. In the case above, the croupier starts with an '8' and a '2', adding to 10, so they will draw another card and get an ace ('A'), which makes their total score 21. Even though they have 21, they got there with 3 cards, not 2, so it is not considered Black Jack.
I'm not sure if the rules have been updated since you wrote this, but they are currently in the description. They are as follows:
In all other cases, the game is either a draw, or the dealer wins. For the purposes of this Kata, a loss and a draw are treated the same way, and you are only concerned with wins. To be more specific about losing and drawing conditions:
Hope that helps!
Though I agree that the description could be improved, it is not asking you to write code for the player behavior, just the dealer. In this scenario, the players have already drawn all of their cards, and you simply have to write code for a function that draws cards for the dealer until their total score is 17 or higher, and then returns a list of which players won according to the rules given.
While I enjoy the idea of this Kata the instructions are extremely unclear. There is a lot of considerations that need to be made to determine if a player should hit or not. This Kata does not help us outline the considerations that tell the players to hit or not to hit. Unless they are always supposed to hit until they achieve 21 but that seems kinda silly. The win conditions are also not outlined well and that causes a lot of confusion.
In its current state I would avoid this kata which is a shame cause it does seem like it could be a fun one :/ please update this!
Hey,
this one is not working when tested against random tests. The example result from random test:
Testing for 314 and "mago": expected 'That was close!' to equal 'Fire!'
. However, I cannot find an issue on my own, someone please help? :)The description of this kata is poor. It does not state fully the winning conditions. A player wins if they have BJ and the croupier does not. But what about other cases? There is no information at all what to do with other situations, for instance if noone has BJ, or the croupier has more than 21 and players less than 21. Please update.
['A', '10', '3', '4'] ['6', 'K', '8', 'A', '8', '4', 'A', 'K'] ['10', '9', 'J', '2', 'Q', '7'] ['A', 'A', '7', '7', 'K'] ['J', '7', 'Q', '5', 'Q', 'J', '3', '9', '4', 'K', 'A', '7', '5', 'K', '9', '10', 'J', '8', '6', 'J']
Similarly here. According to the random tests noone is winning. According to me, the first player has either 28 points or 18, so we go for 18 and she/he is winning. We go for 18 points (ace counting for 1) since according to the description we go always for more points. What am I missing?
Test 21: ['J', 'A'] ['K', '10'] ['10', '2', 'Q'] ['8', '2'] ['A', 'J', '10', '2', 'A', '2', 'A', '3', '5']
Why player 1 is considered a winner here? The croupier has a BJ so the players loses. What am I missing?
One does not need both min and max vars, when the arrays are sorted you just need to store the ceiling of the previously calculated interval
looks like it's not happening anymore. Poke at me on discord if you still see the problem
.
no actionnable information, closing.
no actionnable feedback, closing
Loading more items...