Skip to content

anshumanjadiya1102/Number-Guessing-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎲 Number Guessing Game (Java)

A fun little project in Java where the computer picks a random number between 1 and 100 and you have to guess it. Simple, interactive, and a perfect beginner-friendly game!


✨ Features

  • 🎯 Computer randomly generates a number between 1–100
  • ⌨️ Accepts user guesses and gives hints (Too high / Too low)
  • πŸ” Unlimited attempts until you guess correctly
  • πŸŽ‰ Congratulates you with total attempts taken
  • πŸšͺ Exit gracefully with Ctrl+D (Linux/macOS) or Ctrl+Z (Windows)

πŸš€ Getting Started

1. Compile

javac Number_Guessing_Game.java

πŸ–₯️ Example Gameplay

Welcome to the Number Guessing Game!
I'm thinking of a number between 1 and 100. Try to guess it!
Press Ctrl+D (Unix/macOS) or Ctrl+Z (Windows) then Enter to exit.

Enter your guess: 50
Too low! Try again.

Enter your guess: 75
Too high! Try again.

Enter your guess: 63
πŸŽ‰ Congratulations! You guessed the number in 3 tries.
Thanks for playing!

πŸ”§ Tech Stack

  • Language: Java 11+

  • Type: CLI (Command-Line Interface)

  • Libraries: None (only Scanner & Random)

🀝 Contributing

Want to improve this little game? Fork the repo and submit a PR:

git checkout -b feature/new-idea
git commit -m "Add difficulty levels"
git push origin feature/new-idea

πŸ“œ License

This project is open-source and free to use...

πŸ’‘ β€œEvery wrong guess brings you closer to the right one!”

About

A command-line number guessing game where the user guesses until correct.

Topics

Resources

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published