Beta
Play Chinese MahJong , Win the Game, Get the Money!
Loading description...
Games
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This kata turns out to be a duplicate of https://www.codewars.com/kata/56fd0d6445040066b4001e04
So there is some misstype stuff in the description and such:
I feel like that should be called "Thirteen orphans" (please look here );
'鸟,4条,2饼,5饼,8饼,3万,6万,9万,东,南,北,中,发,白',# independeBce <-- independeNce?
'东,南,西,北,中,发,白,1万,9万,1饼,9饼,鸟,9条,白',# thirteen_with_seven
Why is it
thirteen_with_seven
, when in description there's athirteen with one
combination?Fixed:D
But the actual testcase only tested one of the possibilities (always within ['1万', '4万', '7万', '8饼', '2饼', '5饼', '9条', '3条', '6条']). Consider shuffling array a / b before zipping them together, do beware that "1条" might be randomly generated and need to be converted to "鸟".
Testcase can and often generate invalid hands: eg: normal [白,5万,9万,4万,9万,6万,3万,9万,9万,白,9万,5万,7万,9万] (six 9万 here), seven pairs [白,白,白,白,白,白,白,白,白,白,白,白,白,白].
Off by 1 error while printing the function name, eg. ("hirteen_with_one", "ormal", "nependence", ...)
Thank you very much!!!:D
Description and tests are inconsistent about if there should be a
1条
tile or not. It's not included in thealll
variable, but it's in thethirteen
variable, but not in thethirteen
test case, but in theindependence
test case...Sorry, fixed. Now all '1条' is replace by '鸟'. : )
There's still one testcase containing "1条" - see the third from last item in the param array in actual testcase
Did I need to consider Kong(杠)?
It will change the amount of tiles to win.
Kong moves tiles outside your hand. It also requires you to draw one tile, so you wouldn't be having the same tiles anymore.
(Also, it is perfectly fine to have a winning hand with 4 of a kind. Typically that's one of the reasons you don't Kong even if you can.)
That is correct, just want to know if the test cases would include the case of having more than 14 tiles due to Kong.
In that case, I have to remove those tiles used in Kong, then check for winning.
Technically Kong is irrelevant to winning hand anyway (just like Chi and Pon has nothing to do with winning hand); when considering a winning hand you only check the tiles you have in your hand.
Random tests are kinda pointless if the expected result always have the same order. They should be mixed together.
Fixed.
? There are only 4 of a same tile in a Mahjong set. How is this even possible?
Similarly,
1万,2万,3万,4万,5万,6万,7饼,8饼,9饼,白,白,白,白,白
is not a valid hand: there cannot be 5 of the same tiles in a Mahjong set.Sorry, my fault. Now I fixed the definition of clearity:)
Does it even make sense?
1万,2万,3万,4万,5万,6万,1万,2万,3万,4万,5万,6万,3万,4万
isn't a winning hand in any Mahjong rules (clearity is a bonus, not a winning criteria).Urr...Sorry, I have deleted clearity