-
-
Notifications
You must be signed in to change notification settings - Fork 13
Add practice exercise: poker #203
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
Conversation
|
||
INSERT INTO tests (uuid, description, hands, expected) | ||
VALUES | ||
('161f485e-39c2-4012-84cf-bec0c755b66c', 'single hand always wins', '["4S 5S 7H 8D JC"]', '["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.
If we're using structured data, would a nested array make sense here?
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.
🤔 Would it be better to concatenate the hands using line breaks? For example, instead of
["4D 5S 6S 8D 3C", "2S 4C 7S 9H 10H", "3S 4S 5D 6H JH", "3H 4H 5C 6C JD"]
we should use:
4D 5S 6S 8D 3C
2S 4C 7S 9H 10H
3S 4S 5D 6H JH
3H 4H 5C 6C JD
?
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 generally prefer providing the data in the easiest-to-use format to make the exercise about the actual exercise and not string parsing, as much as possible.
Whichever you think is the easiest to use?
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.
🤔 In json format, the data is already parsed (or nearly so). When we provide multiples elements/rows in a text format separated by newlines (or other separator) it's needed first to pre-parse the data in a suitable way.
Anyway , this exercise is hard and we could provide data separated by newlines and not "suggest" people to use json, this could be a more free way to solve the exercise.
JSON is something "new" to databases and I think many people are not familiarized with it. For these people, json can be harder than a simple text format. In this exercise, my code will grow a bit to parse the strings but nothing really laborous.
😁 I'd rather let you decide.
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.
JSON is something "new" to databases and I think many people are not familiarized with it. For these people, json can be harder than a simple text format.
Let's assume anyone solving Poker in SQLite has already solved the various other JSON-based exercises and figured out how to use the JSON functions, ie that JSON functions are not hard for people solving this exercise.
In this exercise, my code will grow a bit to parse the strings but nothing really laborous.
I want the input that shrinks the code :)
Anyway , this exercise is hard and we could provide data separated by newlines and not "suggest" people to use json, this could be a more free way to solve the exercise.
The Poker part is hard. I won't want to make the text part any harder than it needs to be. I want to make the parsing as easy as possible.
I think a preformatted list-of-lists would better here.
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.
To use in the actual architecture of one column for input and one for output, I think json is better, but for a more sql approach relationships would be a improved approach, primary keys and foreign keys, even I don't know for sure a good way to show and/or explain this to people that will do the exercises 🤭
[Off Topic]: I have "created" a way to solve the reverse string and other byte-to-byte string manipulations without use recursive cte and the exercise of the reverse string would be medium. When I search in google about, all answers where the same: "use recursive cte", so I didn't try another approach... my bad.
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.
To use in the actual architecture of one column for input and one for output, I think json is better, but for a more sql approach relationships would be a improved approach, primary keys and foreign keys, even I don't know for sure a good way to show and/or explain this to people that will do the exercises 🤭
Alright. We can leave it as is.
[Off Topic]: I have "created" a way to solve the reverse string and other byte-to-byte string manipulations without use recursive cte and the exercise of the reverse string would be medium. When I search in google about, all answers where the same: "use recursive cte", so I didn't try another approach... my bad.
The difficulty doesn't have to reflect the simplest approach. It's a very subjective measure that roughly aligns the student's expectation. Some students struggle with concepts that others find easy and find easy concepts that others find challenging. No difficulty will ever apply universally. It's a very rough estimate that sets rough expectations.
.input.hands
and.expected
mapped toTEXT -- json array
.instructions.append.md
.