Skip to content

Number Guessing Game With Dual Modes: Player Vs PC (3 Difficulty Levels) And AI Binary Search Solver - Features High Score Persistence, Smart Mathematical Hints, And OOP Structure - Educational Tool For Game Logic & Algorithms 🎲

Notifications You must be signed in to change notification settings

hexbido/Guessing-Number-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Number Guessing Game Game Die

An Interactive Gaming Experience: From Simple Random Number Guessing To Advanced AI Solver Mode, Multi-Level Difficulty System, High Score Tracking, And Intelligent Hint Generation.

AboutTech StackGalleryEvolutionHow To RunWarnings


separator

About The Project Memo

This Repository Represents The Fourth Major Milestone In My Front-End Diploma (Programming Fundamentals Track).

It's More Than Just A Game, It's A Documentation Of My Journey In Game Development & Algorithm Design. The Project Chronicles The Evolution From Simple Random Number Generation Using Basic Input/Output To A Sophisticated Gaming System Powered By Object-Oriented Programming And Binary Search AI.

The Final Version Is An Intelligent Game That Features Two Distinct Modes: Player vs PC Where Users Try To Guess The Computer's Number Across Three Difficulty Levels, And AI Solver Mode Where An Artificial Intelligence Uses Binary Search Algorithm To Guess Your Number With Maximum Efficiency. The System Includes Persistent High Score Tracking, Smart Mathematical Hints, And A Professional Menu-Driven Interface.


separator

Tech Stack & Tools Tools

Python OOP Binary Search VS Code Miro

Python (3.10+): The Core Language Driving All Game Logic, Random Number Generation, And File Management Operations.
Object-Oriented Programming: Utilizes Class-Based Architecture With Methods For Game Modes, Score Management, And Hint Generation.
Random & Math Modules: Implements Random Number Generation For Game Mechanics And Mathematical Functions For Prime Number Detection.
Binary Search Algorithm: Powers The AI Solver Mode With Optimal Guessing Strategy, Minimizing Attempts Through Smart Divide-And-Conquer Approach.
File I/O Operations: Manages Persistent High Score Storage Using Text Files, Ensuring Records Survive Across Multiple Gaming Sessions.
Miro: Used For Planning And Designing The Game Flow, Logic Flowcharts, And Algorithm Structure Before Writing Any Code.


separator
The Project Followed A Structured "Plan-Then-Code" Approach - Below Is The Comparison Between The Planning Phase And The Final Execution For Both Versions.

Basic Version Advanced Version
Planning (Logic)

Basic Flowchart
Planning (Logic)

Advanced Flowchart
Execution (Main Result)

Basic Output
Execution (Main Result)

Advanced Output

View More Screenshots (Click Here) Search

Basic Version - Extra Shots

Basic Shot 2 Basic Shot 3

Basic Shot 4 Basic Shot 5





Advanced Version - Extra Shots

Advanced Shot 2 Advanced Shot 3

Advanced Shot 4 Advanced Shot 5

Advanced Shot 6 Advanced Shot 7

Live Demo Video

Watch The Game In Action: Playing Both Modes With Different Difficulty Levels And AI Solving Strategy.

Watch Video
Click To Watch Video ▷

separator

Features & Evolution Rocket

The Transition From The Basic Single-Mode Game To The Advanced Dual-Mode System Highlights A Significant Leap In Algorithmic Complexity And Gaming Experience.

Feature Basic Version Advanced Version (AI-Ready)
Game Modes Single Mode (Player Guesses) Dual Mode (Player + AI Solver)
Difficulty Levels Fixed Range (1-10) 3 Levels (Easy/Medium/Hard)
Score System Session-Based Tracking Persistent High Score (File Storage)
Hint System Basic Higher/Lower Hints Mathematical Properties & Prime Detection
Code Structure Procedural Programming Object-Oriented (Class-Based)
AI Intelligence No AI Features Binary Search Algorithm

Key Features In Advanced Version Star

Dual Game Modes: Play As A Human Player Trying To Guess The Computer's Number, Or Watch The AI Solver Use Binary Search To Guess Your Number With Maximum Efficiency.
Three Difficulty Levels: Choose Between Easy (1-10), Medium (1-100), Or Hard (1-1000) With Different Attempt Limits For Each Level.
Persistent High Score System: The Game Automatically Tracks And Saves Your Best Performance To highscore.txt File, Challenging You To Beat Your Previous Records.
Smart Mathematical Hints: Receive Intelligent Clues Based On Number Properties Including Divisibility Rules And Prime Number Detection When You Reach Mid-Game.
Binary Search AI: The AI Solver Mode Demonstrates Computer Science Algorithms In Action, Using Divide-And-Conquer Strategy To Find Any Number With Optimal Speed.
Professional Menu System: Navigate Through A Clean, Menu-Driven Interface With Screen Clearing, Player Name Tracking, And Real-Time Score Display.


separator

Installation & Usage Download

Follow The Steps Below To Run The Project Locally On Your Machine - Ensure You Have Python 3.10+ Installed.

1️⃣ Clone The Repository

Open Your Terminal And Run The Following Command To Download The Project Files:
git clone https://github.com/hexbido/Guessing-Number-Game.git
cd Guessing-Number-Game

2️⃣ No External Dependencies Required

This Project Uses Only Python's Built-In Libraries (random, math, os, time). No Additional Packages Need To Be Installed!

3️⃣ Run The Basic Version

Navigate To The Basic Version Folder And Execute The Simple Guessing Game:
cd Basic-Version
python Guessing_Game.py

4️⃣ Run The Advanced Version (AI + OOP)

To Launch The Full Game With AI Solver Mode And Multi-Level System:
cd Advanced-Version
python Guessing_Game_AI.py

5️⃣ Game Instructions

Follow These Steps To Play The Game Successfully:

Player Mode: Select Mode 1, Choose Your Difficulty Level, And Try To Guess The Computer's Secret Number Within The Allowed Attempts.
AI Solver Mode: Select Mode 2, Think Of A Number, And Guide The AI By Responding With (H)igh, (L)ow, Or (C)orrect To Its Guesses.
Using Hints: In Player Mode, You'll Receive Basic Direction Hints And A Smart Mathematical Hint At The Halfway Point.
High Score: Your Best Performance Is Automatically Saved - Beat Your Record By Completing The Game In Fewer Attempts!


separator

Warnings & Troubleshooting Warning

Please Review The Following Notes To Ensure Smooth Operation And Avoid Common Issues:

Input Validation: The Game Expects Numeric Inputs For Guessing - Entering Text Or Special Characters Will Be Ignored Or Prompt Re-Entry.

File Permissions: Ensure The Application Has Write Permissions In Its Directory To Create And Modify The highscore.txt File For Score Tracking.

Screen Clearing: The Advanced Version Uses OS-Specific Commands To Clear The Screen - This Feature Works On Windows (cls) And Unix/Mac (clear) Systems.

AI Solver Honesty: When Using AI Solver Mode, Provide Accurate Feedback (H/L/C) To The AI's Guesses - Incorrect Responses Will Cause The Algorithm To Fail.

High Score Reset: To Reset Your High Score, Simply Delete The highscore.txt File - A New Record Will Be Created On The Next Game.

Number Range: When Selecting Difficulty Levels, Pay Attention To The Range Limits - Guessing Outside The Valid Range Will Not Count As An Attempt.

Mathematical Hints: The Smart Hint System Analyzes Number Properties - If Your Secret Number Has No Distinct Mathematical Properties, The Hint May Be Generic.


Made With Red Heart By B I D O

About

Number Guessing Game With Dual Modes: Player Vs PC (3 Difficulty Levels) And AI Binary Search Solver - Features High Score Persistence, Smart Mathematical Hints, And OOP Structure - Educational Tool For Game Logic & Algorithms 🎲

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages