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.
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!
Megamind has to shoot 3 times doing 4 hp damage each time. Read the example in the description.
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?
I do not get this:
test.assert_equals(mega_mind(12, 4, 3, 2), 3)
why it supposed to be 3? I mean at the start, after the first round the HP of the bad guy is 0, so there is no possiblity of him to use regen powers, so the answer supposed to be 1. What am I missing?
Thanks
Very nice solution