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

Two-bucket exercise - problem in instructions, possible additional "bonus" test case #2205

Open
norbs57 opened this issue Apr 26, 2022 · 0 comments

Comments

@norbs57
Copy link
Contributor

norbs57 commented Apr 26, 2022

In the two-bucket exercise, the Go-specific part of the instructions includes the following statement:

A solution cannot be found when input test case bucket sizes are not ones which allow the three operations to succeed in creating the goal amount, which occurs when the two bucket sizes are not relatively prime to one another.

This characterisation of unsolvable puzzles is incorrect - for example if sizeBucketOne == sizeBucketTwo == goalAmount == 3, there is the trivial one-(or two) step solution. The following characterisation is more precise (c.f Wikipedia: Water pouring puzzle):

A solution cannot be found when input test case bucket sizes are not ones which allow the three operations to succeed in creating the goal amount, which occurs when the goal amount is not a multiple of the greatest common divisor of the two bucket sizes.

We may also want to add a "bonus test case" that checks the more precise characterisation of solvable puzzles, for example:

{ "Solution bonus case 3", 6, 10, 2, "one", "one", 4, 10, false, },
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

No branches or pull requests

1 participant