Releases: JF3800/Human-Vs-Computer-Geussing-Duel
Release list
Human Vs Computer: Geussing Duel
Mind vs Machine: The Guessing Duel
A number guessing game where you go head to head against a computer. You both guess each other's numbers, and whoever does it in fewer tries wins. Sounds simple until you realize the computer uses binary search and will beat you most of the time.
How It Works
You and the computer each pick a secret number. Then you take turns guessing each other's number. The game tells you if each guess is too high or too low.
The computer doesn't guess randomly. It always picks the midpoint of whatever range is still possible, cutting the options in half every single guess. You can watch it happen in real time.
Fewest guesses wins. Ties are possible but beating it is hard.
Getting Started
Requirements: Python 3.x
Install dependencies:
pip install richRun the game:
python Game.pyOr just download the binary for your OS from the releases page and run it directly. No Python needed.
Example
Welcome To My Number Geussing Game
What Number do you choose (for the computer to geuss)? 33
Geuss the number: 50
Too Low
Geuss the number: 75
Too High
Geuss the number: 62
Too High
Geuss the number: 56
Too Low
Geuss the number: 60
CORRECT :) | You took 5 tries
Now its computers turn
The Computer Geusses: 50
The Computer Geusses: 25
The Computer Geusses: 37
The Computer Geusses: 31
The Computer Geusses: 34
The Computer Geusses: 32
The Computer Geusses: 33
Computer got it! in 7 tries
YOU WON!!!!
Why the Computer Is Hard to Beat
Binary search is one of the most efficient algorithms out there. For a range of 1 to 100, it finds any number in at most 7 guesses every time. No luck involved, just math.
Built With
- Python 3
richfor terminal colors and formattingrandomfor generating the computer's number