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.
I'm glad you liked it. thanks for the praise! cheers. DM
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.
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!
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.
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".
I see what you did there. Maybe not a true solution, but still clever, and it did make me laugh.
Properly suffered going through the OP's description. @zdreagin thanks for putting together the steps and proper description.
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.
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.
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:
Loading more items...