This is a simple command-line number guessing game written in Rust.
In this game, the computer generates a random number between 1 and 100, and the player tries to guess it. After each guess, the game provides feedback, telling the player if their guess was too high, too low, or correct.
- Random number generation
- User input handling
- Comparison of user's guess with the secret number
- Continuous gameplay until the correct number is guessed
- Run the program.
- You'll see the message "Guess the number".
- Enter your guess when prompted with "Please input your guess (number)".
- The program will tell you if your guess is too small, too big, or correct.
- Keep guessing until you find the correct number.
- When you guess correctly, you'll see "You win" and the game will end.
- Rust programming language
- Make sure you have Rust installed on your system.
- Clone this repository or copy the code into a file named
main.rs
. - Open a terminal and navigate to the directory containing
main.rs
. - Run the following command: cargo run
- Follow the on-screen instructions to play the game.
This game uses the following standard Rust libraries:
std::io
for input/output operationsrand::Rng
for random number generationstd::cmp::Ordering
for comparison operations
Make sure to include these dependencies in your Cargo.toml
file.
This project is open source and available under the MIT License.
Contributions, issues, and feature requests are welcome. Feel free to check issues page if you want to contribute.
Shrikrushna Gundre
Enjoy the game!