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

Logical Error In Guessing Game (chapter 2) #4221

Open
csm-18 opened this issue Feb 4, 2025 · 0 comments
Open

Logical Error In Guessing Game (chapter 2) #4221

csm-18 opened this issue Feb 4, 2025 · 0 comments

Comments

@csm-18
Copy link

csm-18 commented Feb 4, 2025

Description of the problem:
So, the whole meaning and purpose of a guessing game is to guess a number and the program will tell whether it is high or low to get to the real number. But, although the current guessing game program is excellent at teaching many basic rust concepts, it is kind of weird that the number being guessed by the user is being changed after each guess before the user can guess it.
I mean suppose the number is 10 and the user enters something like 9, now the program says too small.Here, the user thinks that now he needs to make the guess bigger than 9 and enters something like 10 , which is actually correct, but the program generated a new number after the last input (because the number was created in the last iteration) so user is technically guessing a number without too small and too high hints! Which is guessing a number just like that!
I hope you got what I am trying to say!
Suggested fix:
I know, for a beginner learner current program is simple and serves the purpose of teaching the concepts but we could try to make the program to handle the error by introducing another loop for processing the guessing of the user for that generated number.So, one loop for the main program and one loop for use input.

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