-
-
Notifications
You must be signed in to change notification settings - Fork 550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add canonical-data for poker #793
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exercises/poker/canonical-data.json
Outdated
"property": "best_hand", | ||
"input": [ | ||
"2S 8H 2D 8D 3H", | ||
"44S 5H 4C 8S 5D" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
44S
exercises/poker/canonical-data.json
Outdated
"input": [ | ||
"4S 5S 7H 8D JC" | ||
], | ||
"expected": "4S 5S 7H 8D JC" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the value at expected
should be an array, to match all the rest
exercises/poker/canonical-data.json
Outdated
"2S 4C 7S 9H 10H", | ||
"3S 4S 5D 6H JH" | ||
], | ||
"expected": "3S 4S 5D 6H JH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the value at expected
should be an array, to match all the rest
exercises/poker/canonical-data.json
Outdated
] | ||
} | ||
] | ||
}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason for } and ] on same line?
exercises/poker/canonical-data.json
Outdated
] | ||
}, | ||
{ | ||
"description": "aces can be end a straight (10 J Q K A)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think either remove "be" or add "of"
exercises/poker/canonical-data.json
Outdated
] | ||
}, | ||
{ | ||
"description": "aces can be start a straight (A 2 3 4 5)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think either remove "be" or add "of"
exercises/poker/canonical-data.json
Outdated
"cases": [ | ||
{ | ||
"description": "single hand always wins", | ||
"property": "best_hand", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_
isn't an allowed character in https://github.com/exercism/x-common/blob/master/canonical-schema.json#L117, so I would suggest bestHand
. Maybe even bestHands
since there can be more than one.
exercises/poker/canonical-data.json
Outdated
"cases": [ | ||
{ | ||
"description": "it should be able to pick the winning poker hand", | ||
"cases": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced a second level of cases
nesting is necessary. I suggest just a single level, please, unless there is a specific reason to use two, and it doesn't seem that the extra description here adds any benefit. For example, https://github.com/exercism/x-common/blob/master/exercises/hello-world/canonical-data.json uses just one level.
Of the existing implementations, I'm not going to check which of them have which cases, but I will check for the sake of interest:
I don't think any of these need to inform decisions in this PR, but they can if y'all want.
(Go and Swift test various unparsable hands) |
https://github.com/petertseng/x-common/blob/verify-poker/exercises/poker/verify.rb says all cases here are correct except for the 44S. |
I copied the test cases from the elixir exercise. I added an additional level of tests because I thought that was the reason it was failing the travis ci originally. I made all the changes you mentioned. I'm just trying to get this setup so that I can implement it in a standardized way in the ECMAScript exercise track.. Thanks! |
https://github.com/petertseng/x-common/tree/verify-poker/exercises/poker has been updated and it says all cases are correct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
potential case to add: two hands that each have the same pair, to exercise comparison of the other cards
Since for every other kind of hand X, there is a case for "two hands that each have the same X"
exercises/poker/canonical-data.json
Outdated
] | ||
}, | ||
{ | ||
"description":"aces can end a straight (10 J Q K A)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a space after the colon (consistency with other cases)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that case is already taken care of by this test: "both hands have two identically ranked pairs, tie goes to remaining card (kicker)".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
potential case to add: two hands that each have the same pair, to exercise comparison of the other cards
I believe that case is already taken care of by this test: "both hands have two identically ranked pairs, tie goes to remaining card (kicker)".
Interesting. I hadn't thought of it that way, since that was a two-pair hand rather than a one-pair hand, but I can see it working out.
OK, just that extra space
... which you just put in, ok.
] | ||
}, | ||
{ | ||
"description": "with multiple decks, both hands with identical four of a kind, tie determined by kicker" , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not heard the term kicker before, it may be poker jargon which not everyone will understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say the term could be easily understood by the context. Look at the test data, the meaning is ridiculously obvious. Plus the word kicker is actually in the dictionary as a poker term so if they opened a dictionary they would also get the answer. If we start dumbing down the description, where do we draw the line? Should I limit my word choices to a certain reading level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stevejb71 Also the bowling test data contains words like Turkey, Double, etc... Are you saying we should change these to say: 3 strikes in a row, 2 strikes in a row. It seems very silly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the bowling test data contains words like Turkey, Double, etc...
errr? https://github.com/search?q=org%3Aexercism+turkey&type=Code
and just in case that missed something, nothing in https://github.com/exercism/x-common/blob/master/exercises/bowling/canonical-data.json either.
???
confused
Do you know though, in this case the problem is solved: "kicker" is defined earlier #793 (comment)
Therefore, this description is allowed to rely on the earlier definition!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petertseng Even if the word turkey is not being used other bowling jargon like Strike and Spare are both being used. My point is still valid. The actual word being used is irrelevant, the point is that bowling jargon is being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strike and Spare are both being used
Thanks. I see they are defined at https://github.com/exercism/x-common/blob/master/exercises/bowling/description.md .
So in the same way one would ask is it OK to have "straight", "flush", "full house"? (Would anyone have trouble understanding what "pair" means?) The https://github.com/exercism/x-common/blob/master/exercises/poker/description.md incorporates https://en.wikipedia.org/wiki/List_of_poker_hands by reference, can there be any room for doubt there?
I would argue we have done what we need to do - the terms are defined in the README or earlier in the file, right?
If there is any case where we failed to do that, in this exercise or any other, it seems good to correct it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Thanks for clarifying. :)
] | ||
}, | ||
{ | ||
"description": "both hands have two identically ranked pairs, tie goes to remaining card (kicker)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is defined, which solves the problem of "I might not know what a kicker is"
I have fixed all formatting and other issues. Please let me know if there is anything else I need to do. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my point of view, everything is in order. So if nobody else has anything to say by the time the weekend ends let's merge.
Then add further tests at the end that tested that everything worked with unordered hands. But none of these should be blockers, everything else looks fine. |
Looks like it's time to merge, with thanks! I agree that the non-blocking comments are non-blocking; I'll say what I think about them! |
Tough choice, though I admit T has the advantage of taking up the same amount of space... but 10 is what you would see on an actual playing card. No way to please everyone here. Best I can think of is that tracks can convert in their generators as necessary. In the most extreme case, we could represent cards in JSON as
This one's interesting, wondering why it wasn't deemed blocking. For me, I'm not the kind of person who likes to write code that would only compare two hands only to have to replace it later; I would just make it work right from the beginning. So I guess that's why I deemed it non-blocking. Any other reason to take into account? Is it easier to debug if there are only two hands? That would be a reason to want that case.
That one is interesting too! It would help readability of the test cases, though perhaps the description already helps here. I would become slightly less confident that the code under test can handle any order... though I guess I have unknown confidence right now since I don't know if there's any rhyme or reason to the orders right now. I'm slightly worried that the number of tests will increase a lot if we have to make sure that every kind of hand can be recognised in an arbitrary order, but I guess it's hard to know without seeing a concrete proposal. I suppose if someone wants to work on it and propose it that person can say so (sorry, not going to be that person) |
closes #576