Number (game)
Number is an early 1970s text-based computer game for BASIC designed by People's Computer Company in which one must guess a number from one to 100, which the computer is "thinking of." The game appeared on page 2 of the book What to Do After You Hit Return or P.C.C.'s First Book of Computer Games.
A Sample Run of the Game
User input has been bolded. Computer output is in normal text.
I will think of a whole number from 1 to 100. Try to guess my number. After each guess, I will tell you if you have guessed my number or if your guess is too small or too big.
Ok, I have a number. Start guessing.
What is your guess?10
Too small. Try a larger number.
What is your guess?20
Too small. Try a larger number.
What is your guess?30
Too small. Try a larger number.
What is your guess?40
Too small. Try a larger number.
What is your guess?50
Too small. Try a larger number.
What is your guess?60
Too small. Try a larger number.
What is your guess?70
Too big. Try a smaller number.
What is your guess?69
Too big. Try a smaller number.
What is your guess?68
Too big. Try a smaller number.
What is your guess?67
You guessed it!!! Let's play again."
Trivia
It is possible to always win the game in at most 7 guesses.
now this May Be one of the solution guess no is 67
ask: what is your guess? 50 too small. try a bigger number
what is your guess? 75 to big. try a smaller number
what is your guess? 63 too small. try a bigger number
what is your guess?69 too big. try a smaller number
what is your guess?66 too small. try a bigger number
what is your guess?68 too big. your guess is 67
the number is found is six go.......
so if you ask the guess number starting from 50. the second will be 25 or 75
and if the second guess is 25. then you need to calculate the integer average of the limiting values (ie. 25 and 50 in this case). and so on..............
(Edited by Pradip Malla) (For more information, this is a binary search method which reduces the times of searching a number or any element)