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 more detailed description of method setRange(min, max) in README.md #31

Open
sg4014 opened this issue Jun 13, 2022 · 2 comments
Open

Comments

@sg4014
Copy link

sg4014 commented Jun 13, 2022

Add changes to README.md

Change this:

setRange(min, max)
this method accepts min and max value of range of number to guess

To this:

setRange(min, max)
this method accepts min (not included) and max (included) value of range of number to guess,
in mathematics that would be (min, max]

Why do so

The proposed changes leave less room for ambiguity.
The solution that passes all tests does not find the min value of method setRange,
no matter how many times method lower is called.
It implies that min is not included in the searching range.
Possibly because of that a common binary search algorithm that can actually find min won't pass most of the tests.

The solution that passed 100% of the tests won't find the min value 0 of setRange(0, 4)

const game = new GuessingGame;

game.setRange(0, 4);

console.log(game.guess()); // 2
game.lower();

console.log(game.guess()); // 1
game.lower();

console.log(game.guess()); // 1
game.lower();
console.log(game.guess()); // 1
@ghost
Copy link

ghost commented Jul 20, 2022

No, we have to change tests, because right solution does not pass tests

@sultanbayev
Copy link

As already mentioned above solution that passes all tests won't work if we will choose 0 as our number to guess. Also solution that works for all tests is not described among procedures in Wikipedia and visa versa: procedures that described in Wikipedia won't pass any of tests

Need to fix tests to match proper solution

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

2 participants