A simple number guessing game where you try to guess a randomly generated number. The game features both a user-friendly graphical user interface (GUI) and a classic console mode.
Features:
- Swing-based GUI (default)
- Console mode (use
--consoleflag) - High score tracking with usernames
- Persistent score storage
- Cross-platform
For Debian/Ubuntu and derivatives (recommended for terminal usage):
-
Download the
.debpackage from the latest releaseYou can use curl to do it from the command line:
curl -s -L -o numberguessingame.deb https://github.com/Project516/NumberGuessingGame/releases/download/0.x.y/numberguessinggame.deb
where
xandyis the version you want. -
Install it:
sudo apt update # Update packages sudo apt install ./numberguessinggame.deb # From directory with the deb package sudo apt install -f # Install dependencies echo 'export PATH=$PATH:/usr/games' >> ~/.bashrc # Add games directory to user PATH source ~/.bashrc
-
Run from anywhere in your terminal:
numberguessinggame
To uninstall:
sudo apt remove numberguessinggame
sudo apt autoremove -y # Remove dependenciesDownload the platform-specific package with bundled JRE from the latest release:
- Windows:
NumberGuessingGame-windows.zip - macOS:
NumberGuessingGame-macos.zip - Linux:
NumberGuessingGame-linux.tar.xz
Extract the downloaded archive and run:
On Windows:
Run run.bat
On Linux/Mac:
Run run.sh
Download the archive.zip from the latest release
- Java 8 or higher
On Windows:
Run run.bat
On Linux/Mac:
Run run.sh
The game features both a graphical user interface (GUI) and a console mode.
- Start the game using one of the methods above
- A window will appear with the game interface
- Enter your guess in the text field and click "Submit Guess" or press Enter
- The game will provide visual feedback:
- Blue text indicates your guess was too low
- Orange text indicates your guess was too high
- Green text indicates you guessed correctly!
- The number of guesses is displayed and updated in real-time
- When you guess correctly, you'll be prompted to enter your username
- After entering your username, your score will be saved and the top high scores will be displayed
- Click "New Game" to play again
- Use the menu bar for additional options:
- File → New Game (Ctrl+N): Start a new game
- File → Exit: Close the application
- View → High Scores: View the top high scores
- Help → About: View game information
To run the classic console version, use the --console or -c flag:
java -jar app.jar --console
# or
./run.sh --console # Linux/Mac
run.bat --console # WindowsIn console mode:
- Enter your guess when prompted
- The game will tell you if your guess is too high or too low
- Keep guessing until you find the correct number
- The game will display how many guesses it took you
- Enter your username when prompted to save your score
- The top high scores will be displayed after saving your score
The game automatically tracks high scores (games won with the least guesses). High scores are stored in your home directory at ~/.numberguessinggame/highscores.properties.
- The top 10 scores are kept
- Scores are sorted by the number of guesses (least is best)
- Each score includes the username and number of guesses
- High scores persist across game sessions
- View high scores from the GUI menu (View → High Scores) or after completing a game
- Java 25 (Eclipse Temurin recommended for development)
SDKMAN! is the recommended way to install Java and Gradle:
sdk install java 25-tem
Alternatively, install Eclipse Temurin JDK directly from https://adoptium.net/
From the project root:
./gradlew build
On Windows:
Run .\gradlew build and .\package.bat from the project root.
On Linux/Mac:
Run ./package.sh from the project root.
This will create archive.zip containing the application, run scripts, README, and LICENSE. The archive can be released to GitHub Releases.
On Linux:
Run ./package-deb.sh from the project root.
This will create numberguessinggame.deb which can be installed via apt/dpkg on Debian-based systems. The package can be released to GitHub Releases for easy distribution.
On Linux: Run the following scripts to create platform-specific packages with bundled JRE:
./package-win.sh # Creates NumberGuessingGame-windows.zip
./package-macos.sh # Creates NumberGuessingGame-macos.zip
./package-linux.sh # Creates NumberGuessingGame-linux.tar.xzThese packages include a bundled JRE and do not require Java to be installed on the target system. They are automatically built and uploaded to GitHub Releases via GitHub Actions.