Ad
  • Default User Avatar

    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.

  • 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!

  • Default User Avatar

    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.

  • Default User Avatar

    Hope you don't mind me marking these comments as spoilers, but I personally felt that the way this edge case is handled in the description was one of the most satisfying features of this Kata. I felt that figuring out that this edge case exists adds an extra challenge to this Kata, but that the description is pretty clear about how it should be handled when you discover it, as long as you read carefully.

  • Default User Avatar

    Of all the Kata I have done on this site, I have to say that this has been one of the best. The description is well written and clear, with a nice story to make it interesting, yet it is succint enough to make reading it not feel like a chore. Additionally, there is one particular edge case that, although it is alluded to in the description, is not made overly explicit. The result is that those trying to solve this Kata will have to reason it out on their own, but when they do, will find that the instructions for handling it were actually there in the description all along. That's a tough balance to achieve, as most descriptions either give away all of the secrets, and so end up being less challenging than they otherwise would be, or don't properly explain how to handle the edge cases, so figuring them out ends up devolving into trial and error. Excellent job with this one!

  • Default User Avatar

    According to the rules laid out in the description, 3 riders would be required. The first rider starts at station 1 and rides the 6 miles to station 2. This rider then attempts to ride the 43 miles to station 3, but never makes it, since that is station x. The second rider would then travel the 43 miles from station 3 to station 2, rescuing the first rider along the way. After arriving at station 2, the second rider rides the 43 miles back to station 3, for a total of 86 miles. There are still 38 miles to the final station, which would exceed the 100 mile limit for the second rider, so then a third rider would carry the mail bag to the final station.

  • Default User Avatar

    There is a typo in the Ruby test cases. Currently the test cases which should return 'A' are categorized under "should return a B for averages above 90".

  • Default User Avatar

    I see what you did there. Maybe not a true solution, but still clever, and it did make me laugh.

  • Default User Avatar

    Apparently what "puzzle" actually means is "Kata that has a much lower difficulty rating that it deserves". It's more a matter of knowing specific JavaScript/TypeScript syntax really well, rather than actually solving any kind of puzzle.

  • Default User Avatar

    The description says "The method only needs to be able to convert positiv[e] numbers", however one of the test cases in the Java version tests for 0, which is not a positive number. The description should be updated to say that the method does not need to be able to convert negative numbers.

  • Default User Avatar

    Having solved this Kata, here are the rules that are not stated in the description, but are necessary to know in order to complete this Kata:

    1. You are moving from left to right along the route.
    2. A "Super Smash" occurs when a door is open on both sides of the street at the same position. The doors do not need to be open in the same position.
    3. It doesn't matter if the starting position is past the "Super Smash" location. Even though it doesn't make any logical sense, if there is a "Super Smash" at any point along the street, then this is your return value.
    4. Just like with a "Super Smash", it doesn't matter if your starting point is past a Lambourghini. Apparently you're looking behind you while you're riding to try to spot Lambourghinis you can steal (no wonder you crash so much). However, the positions of a Lambourghini and a "Super Smash" relative to each other do not matter. A "Super Smash" always takes priority over everything else.
    5. You search the entire length of the left side of the road for Lambourghinis before glancing at the right side. If there is a Lambourghini as far away from you as possible on the left side, that is the one you will steal, even if the right side of the street is hypothetically bumper to bumper with Lambourghinis with "take me" signs on them.
    6. Crashes due to "an open door of a car facing the same way you are going" take priority over crashes due to "an open door of a car facing you", regardless of which crash you would encounter first. These collisions are also the ONLY time that your starting position is taken into consideration, because you only need to check the spaces outlined in the description (starting position and the two trailing positions for "\" and starting position and one trailing position for "/").
  • Default User Avatar

    As others have mentioned, this description needs to be updated to explain what is actually expected from solutions. For one thing, the Kata never explains what a "Super Smash" is, and it's only by reading other user comments that I was able to determine that this occurs when there are open doors on both sides of the street at the same position. Also, since it is never specified in the description, I assumed that you are supposed to be riding from left to right, and so you are only concered with cars that are at or after the given starting position, x, but many of the test cases seem to expect you to also check the status of cars before your starting position. If you assume that you are instead riding from right to left, then even more test cases fail. In addition, if there is "an open door of a car facing the same way you are going" that comes after "an open door of a car facing you", should the return value for the former collision be given? The description doesn't specify, so I would assume that you're concerned with the first collision, but this doesn't seem to be consistent with all of the test cases. Either the test cases need to be fixed, or the description needs to be corrected, because right now the two are inconsistent with each other.

  • Default User Avatar

    I agree that the description is not very clear. It took me a little while to make sense of it, but the task is:

    You will receive an array of strings. Each string will contain either the word "automatik" or the word "mechanik", though not both. Each string may also contain "robots" represented by the default string "d[(0)(0)]b". The robots may have different appearances, however. The first and last part of the robot (the "legs"), which are "d" and "b" in the default robot, can be also be any other letter of the alphabet, both lowercase or uppercase. The other parts of the "body" of the robot, which are represented by square brackets ("[" and "]") and parentheses ("(" and ")") can be also be represented by any of the following symbols: |};&#[]/><()* . The "eyes", however, are always represented by zeros. You have to count the number of robots that appear in each string with the word "automatik" and the number of robots that appear in strings with the word "mechanik" and return the counts as an array of the form ["n robots functioning automatik", "m robots dancing mechanik"], where n and m represent the respective robot counts.

    I hope that clears this up!

  • Loading more items...