Skip to content
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 yacht practice exercise #1627

Merged
merged 5 commits into from
Jan 27, 2024
Merged

Conversation

ccadden
Copy link
Contributor

@ccadden ccadden commented Jan 26, 2024

No description provided.

Copy link
Contributor

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions github-actions bot closed this Jan 26, 2024
@iHiD iHiD reopened this Jan 26, 2024
@iHiD iHiD requested a review from kotp January 26, 2024 18:41
@@ -0,0 +1,77 @@
class Yacht
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be .meta/example.rb and the path in config.json should be updated too. I'll fix the issue that's causing this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I've fixed the generating code here for future exercises: #1628

"yacht_test.rb"
],
"example": [
".meta/solutions/yacht.rb"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the other place it needs fixing.

@iHiD
Copy link
Member

iHiD commented Jan 26, 2024

I left a few structural comments. I'll leave @kotp to review the exercise properly. Thanks!

@ccadden ccadden force-pushed the add-yacht-practice-exercise branch from 53b1ef8 to 6f90e2c Compare January 26, 2024 21:13
Copy link
Member

@kotp kotp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some wording changes with some code changes in the example solution file. The example solution does not need to have "exemplar" status, so any style changes there you are definitely free to ignore. It only provides a "proof of solvability" for the exercise at this point.

Good work so far!

private

def count_occurances(num)
return dice.tally({})[num] || 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return dice.tally({})[num] || 0
dice.tally({})[num] || 0

Also, prefer number rather than num for reasons of abbreviations.

end

def yacht
is_yacht? ? 50 : 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubyists usually leave the is_ part of a method to be communicated by the ending ?. yacht? probably should be the preferred name for the query method.

dice.sum
end

def is_yacht?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned prior to this yacht? is probably the preferred name, the question mark repeats the is_ part of the name.

dice.uniq.length == 1
end

def is_full_house?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

full_house? is more typical of a method communicating this with the question mark.

dice.eql?([1, 2, 3, 4, 5])
end

def is_big_straight?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "big straight" or "large straight" more typical for the game?

Comment on lines +19 to +20
| Little Straight | 30 points | 1-2-3-4-5 | 1 2 3 4 5 scores 30 |
| Big Straight | 30 points | 2-3-4-5-6 | 2 3 4 5 6 scores 30 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if little and big are commonly used or "small" and "large" is more commonly used. (Personal experience playing for decades with a small sample of people, rather than a globally applied knowledge.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kotp I'm also more familiar with the "small" and "large" terms from personal experience, but I was just going off what was defined in the canonical data file: https://github.com/exercism/problem-specifications/blob/main/exercises/yacht/canonical-data.json#L9

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is fine. Noticed it so brought it up here. We can choose to change it for this track specifically or leave it as a potential update from Problem Specifications at some point in the future.

You are doing the work, so I leave it to you.

If you agree with the change, though, feel free to talk about it and maybe someone will tackle the change.

Comment on lines +20 to +21
when 'little straight' then little_straight
when 'big straight' then big_straight
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small straight and large straight maybe the changes here.

@ccadden ccadden force-pushed the add-yacht-practice-exercise branch from 6f90e2c to bac25f6 Compare January 27, 2024 02:05
@ccadden
Copy link
Contributor Author

ccadden commented Jan 27, 2024

@kotp thanks for the feedback! I incorporated your suggestions and pushed the updates.

@kotp kotp merged commit 790ab74 into exercism:main Jan 27, 2024
4 checks passed
@kotp
Copy link
Member

kotp commented Jan 27, 2024

Thank you for the work done. I brought it in regardless of the big/large name. We can always change it later.

@iHiD
Copy link
Member

iHiD commented Jan 27, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants