-
-
Notifications
You must be signed in to change notification settings - Fork 656
Update the two-bucket proof and tests. #1646
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
The moves() function now returns an object with keys: moves, goalBucket, otherBucket. This removes the meed for goalBucket and otherBucket properties. I also fixed the "bug" where moves() can return after the 2nd move if the second bucket is the same size as the goal.
Dear glennjThank you for contributing to the JavaScript track on Exercism! 💙
Dear Reviewer/Maintainer
Automated comment created by PR Commenter 🤖. |
junedev
left a comment
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.
Thanks for picking up the issue!
I didn't look at the code in detail yet but noticed two things:
- You mentioned before that the tests in problem spec for this exercise were updated so I was expecting this PR would include a change to the tests.toml file due to the new sync via configlet. 🤔
- I saw you changed the output format for the exercise. I think it is definitely better then before.
- I was wondering whether the stub really needs to contain a class definition with the new changes you made. Would it make sense that the stub is just a function (e.g.
solve) that returns the result object you defined? Then the student would be free too choose what classes they think they need in the implementation. (You don't have to change anything if you don't want to but I would like to hear your thoughts.) - Whatever we decide for, the format of the input and expected output should be described in the instructions.append.md file so the student does not have to guess the format from the tests. You can also create an issue for this and it can be addressed later.
- I was wondering whether the stub really needs to contain a class definition with the new changes you made. Would it make sense that the stub is just a function (e.g.
There was no changes necessary to tests.toml. This PR is actually reflecting the actual problem-spec: https://github.com/exercism/problem-specifications/blob/87cd20ff0b2f078d5eb2da716dc7d74fb71ea258/exercises/two-bucket/canonical-data.json#L85
Based on @joshgoebel's suggestion. It certainly simplifies things.
I don't have strong opinions about it. I think this problem naturally points to an OO solution, so I'm fine with what's there. I didn't want to make overly large changes to what was there already.
I see something similar for the satellite exercise. I'll add it to this PR. |
@glennj Thanks for your feedback. Then let's keep it as is. One small thing though, what do you think about renaming the |
junedev
left a comment
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 this is a great improvement for the exercise, not only the bug regarding the tests but also the proper, document output format. Thanks a lot!
The moves() function now returns an object with keys: moves, goalBucket, otherBucket.
This removes the need for goalBucket and otherBucket properties.
I also fixed the "bug" where moves() can return after the 2nd move if the second bucket is the same size as the goal (fixes #1551).