Welcome to the Guess A Number Game, a simple and fun command-line game where you try to guess a randomly generated number within a limited number of attempts. Test your luck and logical thinking skills!
- The computer picks a random number between 1 and 1000.
- You have 10 attempts to guess the number correctly.
- After each guess, you’ll receive hints to guide you:
- If your guess is too low, the game will let you know whether it's "Too Low" or just "Low".
- If your guess is too high, the game will respond with "Too High" or "High".
- If you guess the correct number, you win!
- If you run out of attempts, the game will reveal the correct number, and you lose. 😢
- Random number generation for unique gameplay every time.
- Smart hints based on the difference between your guess and the target.
- Validates input to ensure only numbers are allowed.
- Fun messages for both success and failure scenarios.
- A Unix-like operating system (Linux, macOS, or WSL for Windows).
- A Bash shell environment.
- Copy the game script to a file, for example,
Game.sh. - Make the script executable:
chmod +x Game.sh ./Game.sh
- Input: Enter your guesses as numeric values.
- Quit: Close the terminal or use
Ctrl+Cto exit the game prematurely.
Welcome to the Guess A Number Game!
I Have Already Thought Of A Number Between 1 to 1000
-------Can You Guess It In 10 Guesses-------
Enter your guess: 500
High! Try again.
Enter your guess: 250
Low! Try again.
Enter your guess: 300
Congratulations! You guessed the correct number: 300
Well Done! Exiting the game.
Made By msaadsbr
- 0: Successful completion (either guessed the number or quit gracefully).
- 1: Game ended due to failure (exceeded the maximum number of guesses).
Made by Muhammad Saad Sabir (msaadsbr)
This game is open-source and free to use. Modify it as you like! 🚀