|
| 1 | +<<<<<<< HEAD |
1 | 2 | # Number Guessing Game |
2 | 3 |
|
3 | 4 | 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. |
@@ -179,3 +180,187 @@ Run the following scripts to create platform-specific packages with bundled JRE: |
179 | 180 | ``` |
180 | 181 |
|
181 | 182 | These 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. |
| 183 | +======= |
| 184 | +# Number Guessing Game |
| 185 | + |
| 186 | +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. The GUI provides visual feedback with color-coded hints and tracks your progress in real-time. |
| 187 | + |
| 188 | +**Features:** |
| 189 | +- Swing-based GUI (default) |
| 190 | +- Console mode (use `--console` flag) |
| 191 | +- High score tracking with usernames |
| 192 | +- Persistent score storage |
| 193 | +- Cross-platform (Made in Java!) |
| 194 | + |
| 195 | +## Installation & Running |
| 196 | + |
| 197 | +### Installation via Debian Package (Linux) |
| 198 | + |
| 199 | +For Debian/Ubuntu and derivatives (recommended for terminal usage): |
| 200 | + |
| 201 | +1. Download the `.deb` package from the [latest release](https://github.com/Project516/NumberGuessingGame/releases) |
| 202 | + |
| 203 | + You can use curl to do it from the command line: |
| 204 | + ```bash |
| 205 | + curl -s -L -o numberguessingame.deb https://github.com/Project516/NumberGuessingGame/releases/download/0.x.y/numberguessinggame.deb |
| 206 | + ``` |
| 207 | + where `x` and `y` is the version you want. |
| 208 | +2. Install it: |
| 209 | + ```bash |
| 210 | + sudo apt update # Update packages |
| 211 | + sudo apt install ./numberguessinggame.deb # From directory with the deb package |
| 212 | + sudo apt install -f # Install dependencies |
| 213 | + echo 'export PATH=$PATH:/usr/games' >> ~/.bashrc # Add games directory to user PATH |
| 214 | + source ~/.bashrc |
| 215 | + ``` |
| 216 | +3. Run from anywhere in your terminal: |
| 217 | + ```bash |
| 218 | + numberguessinggame |
| 219 | + ``` |
| 220 | + |
| 221 | +To uninstall: |
| 222 | +```bash |
| 223 | +sudo apt remove numberguessinggame |
| 224 | +sudo apt autoremove -y # Remove dependencies |
| 225 | +``` |
| 226 | + |
| 227 | +### Standalone Packages with Bundled JRE (Recommended) |
| 228 | + |
| 229 | +Download the platform-specific package with bundled JRE from the [latest release](https://github.com/project516/numberguessinggame/releases): |
| 230 | + |
| 231 | +- **Windows**: `NumberGuessingGame-windows.zip` (no Java installation required) |
| 232 | +- **macOS**: `NumberGuessingGame-macos.zip` (no Java installation required) |
| 233 | +- **Linux**: `NumberGuessingGame-linux.tar.xz` (no Java installation required) |
| 234 | + |
| 235 | +Extract the downloaded archive and run: |
| 236 | + |
| 237 | +**On Windows:** |
| 238 | +Run `run.bat` |
| 239 | + |
| 240 | +**On Linux/Mac:** |
| 241 | +Run `run.sh` |
| 242 | + |
| 243 | +### Manual Installation (Requires Java) |
| 244 | + |
| 245 | +Download the `archive.zip` from the [latest release](https://github.com/project516/numberguessinggame/releases) |
| 246 | + |
| 247 | +#### Requirements |
| 248 | + |
| 249 | +- Java 8 or higher |
| 250 | + |
| 251 | +#### How to Run |
| 252 | + |
| 253 | +**On Windows:** |
| 254 | +Run `run.bat` |
| 255 | + |
| 256 | +**On Linux/Mac:** |
| 257 | +Run `run.sh` |
| 258 | + |
| 259 | +### How to Play |
| 260 | + |
| 261 | +The game now features both a graphical user interface (GUI) and a console mode. |
| 262 | + |
| 263 | +#### GUI Mode (Default) |
| 264 | + |
| 265 | +1. Start the game using one of the methods above |
| 266 | +2. A window will appear with the game interface |
| 267 | +3. Enter your guess in the text field and click "Submit Guess" or press Enter |
| 268 | +4. The game will provide visual feedback: |
| 269 | + - Blue text indicates your guess was too low |
| 270 | + - Orange text indicates your guess was too high |
| 271 | + - Green text indicates you guessed correctly! |
| 272 | +5. The number of guesses is displayed and updated in real-time |
| 273 | +6. When you guess correctly, you'll be prompted to enter your username |
| 274 | +7. After entering your username, your score will be saved and the top high scores will be displayed |
| 275 | +8. Click "New Game" to play again |
| 276 | +9. Use the menu bar for additional options: |
| 277 | + - File → New Game (Ctrl+N): Start a new game |
| 278 | + - File → Exit: Close the application |
| 279 | + - View → High Scores: View the top high scores |
| 280 | + - Help → About: View game information |
| 281 | + |
| 282 | +#### Console Mode |
| 283 | + |
| 284 | +To run the classic console version, use the `--console` or `-c` flag: |
| 285 | + |
| 286 | +```bash |
| 287 | +java -jar app.jar --console |
| 288 | +# or |
| 289 | +./run.sh --console # Linux/Mac |
| 290 | +run.bat --console # Windows |
| 291 | +``` |
| 292 | + |
| 293 | +In console mode: |
| 294 | +1. Enter your guess when prompted |
| 295 | +2. The game will tell you if your guess is too high or too low |
| 296 | +3. Keep guessing until you find the correct number |
| 297 | +4. The game will display how many guesses it took you |
| 298 | +5. Enter your username when prompted to save your score |
| 299 | +6. The top high scores will be displayed after saving your score |
| 300 | + |
| 301 | +### High Scores |
| 302 | + |
| 303 | +The game automatically tracks high scores (games won with the fewest guesses). High scores are stored persistently in your home directory at `~/.numberguessinggame/highscores.properties`. |
| 304 | + |
| 305 | +- The top 10 scores are kept |
| 306 | +- Scores are sorted by the number of guesses (fewest is best) |
| 307 | +- Each score includes the username and number of guesses |
| 308 | +- High scores persist across game sessions |
| 309 | +- View high scores from the GUI menu (View → High Scores) or after completing a game |
| 310 | + |
| 311 | +## Development |
| 312 | + |
| 313 | +### Requirements |
| 314 | + |
| 315 | +- Java 25 (Eclipse Temurin recommended for development) |
| 316 | +- Gradle |
| 317 | + |
| 318 | +### Development Setup |
| 319 | + |
| 320 | +[SDKMAN!](https://sdkman.io) is the recommended way to install Java and Gradle: |
| 321 | + |
| 322 | +``` |
| 323 | +sdk install java 25-tem |
| 324 | +``` |
| 325 | + |
| 326 | +Alternatively, install Eclipse Temurin JDK directly from https://adoptium.net/ |
| 327 | + |
| 328 | +### Building |
| 329 | + |
| 330 | +From the project root: |
| 331 | +``` |
| 332 | +./gradlew build |
| 333 | +``` |
| 334 | + |
| 335 | +### Creating Release Archives |
| 336 | + |
| 337 | +#### Zip Archive (Requires Java) |
| 338 | + |
| 339 | +**On Windows:** |
| 340 | +Run `.\gradlew build` and `.\package.bat` from the project root. |
| 341 | + |
| 342 | +**On Linux/Mac:** |
| 343 | +Run `./package.sh` from the project root. |
| 344 | + |
| 345 | +This will create `archive.zip` containing the application, run scripts, README, and LICENSE. The archive can be released to GitHub Releases. |
| 346 | + |
| 347 | +#### Debian Package |
| 348 | + |
| 349 | +**On Linux:** |
| 350 | +Run `./package-deb.sh` from the project root. |
| 351 | + |
| 352 | +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. |
| 353 | + |
| 354 | +#### Platform-Specific Packages with Bundled JRE |
| 355 | + |
| 356 | +**On Linux:** |
| 357 | +Run the following scripts to create platform-specific packages with bundled JRE: |
| 358 | + |
| 359 | +```bash |
| 360 | +./package-win.sh # Creates NumberGuessingGame-windows.zip |
| 361 | +./package-macos.sh # Creates NumberGuessingGame-macos.zip |
| 362 | +./package-linux.sh # Creates NumberGuessingGame-linux.tar.xz |
| 363 | +``` |
| 364 | + |
| 365 | +These 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. |
| 366 | +>>>>>>> parent of ad04a2e (readme fix) |
0 commit comments