Question: I need help creating a guessing game using CSS, html and javascript where the computer creates a random number between 1 and 100, and the
I need help creating a guessing game using CSS, html and javascript where the computer creates a random number between 1 and 100, and the user tries to guess that number. It should take no more than 7 tries to guess the number in that range, if the user uses a binary search algorithm -- always guess in the middle of the range. So the first guess in a range of 1 to 100 should be 50. If that number is too high, then all of the numbers from 50 and up are eliminated, and the range becomes 1 to 49. Guess in the middle of that, 25, and see which half of that range is eliminated. Continue that process, and it should take no more than 7 tries to guess one number out of 100.
Here's an example:

it needs to have 3 functions! one for validation, one for a reset, and the other for game over, which will start a new game.
Number guessing game I have selected a random number between 1 and 100. See if you can guess it in 10 turns or fewer. I'll tell you if your guess was too high or too low. Enter a guess: Previous guesses: 50 75 87 81 78 77 Congratulations! You got it right! Start new game
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
