Ad
  • Default User Avatar

    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.

  • Default User Avatar

    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.

  • Default User Avatar

    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:

    1. If a player has blackjack (meaning only two cards, one an "A" and the other a card worth 10 points) and the dealer does not, then the player wins.
    2. If the player's score is less than or equal to 21, but greater than the dealer's score, then the player wins.
    3. If the player's score is less than or equal to 21, and the dealer's score is greater than 21, then the player wins.

    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:

    1. If a player's score is greater than 21, they lose, regardless of the dealer's score.
    2. If both the dealer and the player have blackjack, it is a draw.
    3. If the dealer's score is greater than or equal to the player's score, and both scores are less than or equal to 21, but neither the player nor the dealer have black jack, then it is either a draw if the scores are the same, or the dealer wins if the dealer's score is greater.

    Hope that helps!

  • Custom User Avatar

    Megamind has to shoot 3 times doing 4 hp damage each time. Read the example in the description.

  • Default User Avatar

    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.

  • Default User Avatar

    ['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?

  • Default User Avatar

    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?

  • Default User Avatar

    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?

  • Default User Avatar
  • Default User Avatar

    Very nice solution