|
1 | 1 | <<<<<<< HEAD |
2 | | -# Number Guessing Game |
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. |
5 | | - |
6 | | -**Features:** |
7 | | -- Swing-based GUI (default) |
8 | | -- Console mode (use `--console` flag) |
9 | | -- High score tracking with usernames |
10 | | -- Persistent score storage |
11 | | -- Cross-platform |
12 | | - |
13 | | -## Installation & Running |
14 | | - |
15 | | -### Installation via Debian Package (APT) |
16 | | - |
17 | | -For Debian/Ubuntu and derivatives (recommended for terminal usage): |
18 | | - |
19 | | -1. Download the `.deb` package from the [latest release](https://github.com/Project516/NumberGuessingGame/releases) |
20 | | - |
21 | | - You can use curl to do it from the command line: |
22 | | - ```bash |
23 | | - curl -s -L -o numberguessingame.deb https://github.com/Project516/NumberGuessingGame/releases/download/0.x.y/numberguessinggame.deb |
24 | | - ``` |
25 | | - where `x` and `y` is the version you want. |
26 | | -2. Install it: |
27 | | - ```bash |
28 | | - sudo apt update # Update packages |
29 | | - sudo apt install ./numberguessinggame.deb # From directory with the deb package |
30 | | - sudo apt install -f # Install dependencies |
31 | | - echo 'export PATH=$PATH:/usr/games' >> ~/.bashrc # Add games directory to user PATH |
32 | | - source ~/.bashrc |
33 | | - ``` |
34 | | -3. Run from anywhere in your terminal: |
35 | | - ```bash |
36 | | - numberguessinggame |
37 | | - ``` |
38 | | - |
39 | | -To uninstall: |
40 | | -```bash |
41 | | -sudo apt remove numberguessinggame |
42 | | -sudo apt autoremove -y # Remove dependencies |
43 | | -``` |
44 | | - |
45 | | -### Standalone Packages with Bundled JRE (Recommended) |
46 | | - |
47 | | -Download the platform-specific package with bundled JRE from the [latest release](https://github.com/project516/numberguessinggame/releases): |
48 | | - |
49 | | -- **Windows**: `NumberGuessingGame-windows.zip` |
50 | | -- **macOS**: `NumberGuessingGame-macos.zip` |
51 | | -- **Linux**: `NumberGuessingGame-linux.tar.xz` |
52 | | - |
53 | | -Extract the downloaded archive and run: |
54 | | - |
55 | | -**On Windows:** |
56 | | -Run `run.bat` |
57 | | - |
58 | | -**On Linux/Mac:** |
59 | | -Run `run.sh` |
60 | | - |
61 | | -### Manual Installation (Requires Java) |
62 | | - |
63 | | -Download the `archive.zip` from the [latest release](https://github.com/project516/numberguessinggame/releases) |
64 | | - |
65 | | -#### Requirements |
66 | | - |
67 | | -- Java 8 or higher |
68 | | - |
69 | | -#### How to Run |
70 | | - |
71 | | -**On Windows:** |
72 | | -Run `run.bat` |
73 | | - |
74 | | -**On Linux/Mac:** |
75 | | -Run `run.sh` |
76 | | - |
77 | | -### How to Play |
78 | | - |
79 | | -The game features both a graphical user interface (GUI) and a console mode. |
80 | | - |
81 | | -#### GUI Mode (Default) |
82 | | - |
83 | | -1. Start the game using one of the methods above |
84 | | -2. A window will appear with the game interface |
85 | | -3. Enter your guess in the text field and click "Submit Guess" or press Enter |
86 | | -4. The game will provide visual feedback: |
87 | | - - Blue text indicates your guess was too low |
88 | | - - Orange text indicates your guess was too high |
89 | | - - Green text indicates you guessed correctly! |
90 | | -5. The number of guesses is displayed and updated in real-time |
91 | | -6. When you guess correctly, you'll be prompted to enter your username |
92 | | -7. After entering your username, your score will be saved and the top high scores will be displayed |
93 | | -8. Click "New Game" to play again |
94 | | -9. Use the menu bar for additional options: |
95 | | - - File → New Game (Ctrl+N): Start a new game |
96 | | - - File → Exit: Close the application |
97 | | - - View → High Scores: View the top high scores |
98 | | - - Help → About: View game information |
99 | | - |
100 | | -#### Console Mode |
101 | | - |
102 | | -To run the classic console version, use the `--console` or `-c` flag: |
103 | | - |
104 | | -```bash |
105 | | -java -jar app.jar --console |
106 | | -# or |
107 | | -./run.sh --console # Linux/Mac |
108 | | -run.bat --console # Windows |
109 | | -``` |
110 | | - |
111 | | -In console mode: |
112 | | -1. Enter your guess when prompted |
113 | | -2. The game will tell you if your guess is too high or too low |
114 | | -3. Keep guessing until you find the correct number |
115 | | -4. The game will display how many guesses it took you |
116 | | -5. Enter your username when prompted to save your score |
117 | | -6. The top high scores will be displayed after saving your score |
118 | | - |
119 | | -### High Scores |
120 | | - |
121 | | -The game automatically tracks high scores (games won with the least guesses). High scores are stored in your home directory at `~/.numberguessinggame/highscores.properties`. |
122 | | - |
123 | | -- The top 10 scores are kept |
124 | | -- Scores are sorted by the number of guesses (least is best) |
125 | | -- Each score includes the username and number of guesses |
126 | | -- High scores persist across game sessions |
127 | | -- View high scores from the GUI menu (View → High Scores) or after completing a game |
128 | | - |
129 | | -## Development |
130 | | - |
131 | | -### Requirements |
132 | | - |
133 | | -- Java 25 (Eclipse Temurin recommended for development) |
134 | | - |
135 | | -### Development Setup |
136 | | - |
137 | | -[SDKMAN!](https://sdkman.io) is the recommended way to install Java and Gradle: |
138 | | - |
139 | | -``` |
140 | | -sdk install java 25-tem |
141 | | -``` |
142 | | - |
143 | | -Alternatively, install Eclipse Temurin JDK directly from https://adoptium.net/ |
144 | | - |
145 | | -### Building |
146 | | - |
147 | | -From the project root: |
148 | | -``` |
149 | | -./gradlew build |
150 | | -``` |
151 | | - |
152 | | -### Creating Release Archives |
153 | | - |
154 | | -#### Zip Archive |
155 | | - |
156 | | -**On Windows:** |
157 | | -Run `.\gradlew build` and `.\package.bat` from the project root. |
158 | | - |
159 | | -**On Linux/Mac:** |
160 | | -Run `./package.sh` from the project root. |
161 | | - |
162 | | -This will create `archive.zip` containing the application, run scripts, README, and LICENSE. The archive can be released to GitHub Releases. |
163 | | - |
164 | | -#### Debian Package |
165 | | - |
166 | | -**On Linux:** |
167 | | -Run `./package-deb.sh` from the project root. |
168 | | - |
169 | | -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. |
170 | | - |
171 | | -#### Platform-Specific Packages with Bundled JRE |
172 | | - |
173 | | -**On Linux:** |
174 | | -Run the following scripts to create platform-specific packages with bundled JRE: |
175 | | - |
176 | | -```bash |
177 | | -./package-win.sh # Creates NumberGuessingGame-windows.zip |
178 | | -./package-macos.sh # Creates NumberGuessingGame-macos.zip |
179 | | -./package-linux.sh # Creates NumberGuessingGame-linux.tar.xz |
180 | | -``` |
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. |
| 2 | +# Number Guessing Game |
| 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. |
| 5 | + |
| 6 | +**Features:** |
| 7 | +- Swing-based GUI (default) |
| 8 | +- Console mode (use `--console` flag) |
| 9 | +- High score tracking with usernames |
| 10 | +- Persistent score storage |
| 11 | +- Cross-platform |
| 12 | + |
| 13 | +## Installation & Running |
| 14 | + |
| 15 | +### Installation via Debian Package (APT) |
| 16 | + |
| 17 | +For Debian/Ubuntu and derivatives (recommended for terminal usage): |
| 18 | + |
| 19 | +1. Download the `.deb` package from the [latest release](https://github.com/Project516/NumberGuessingGame/releases) |
| 20 | + |
| 21 | + You can use curl to do it from the command line: |
| 22 | + ```bash |
| 23 | + curl -s -L -o numberguessingame.deb https://github.com/Project516/NumberGuessingGame/releases/download/0.x.y/numberguessinggame.deb |
| 24 | + ``` |
| 25 | + where `x` and `y` is the version you want. |
| 26 | +2. Install it: |
| 27 | + ```bash |
| 28 | + sudo apt update # Update packages |
| 29 | + sudo apt install ./numberguessinggame.deb # From directory with the deb package |
| 30 | + sudo apt install -f # Install dependencies |
| 31 | + echo 'export PATH=$PATH:/usr/games' >> ~/.bashrc # Add games directory to user PATH |
| 32 | + source ~/.bashrc |
| 33 | + ``` |
| 34 | +3. Run from anywhere in your terminal: |
| 35 | + ```bash |
| 36 | + numberguessinggame |
| 37 | + ``` |
| 38 | + |
| 39 | +To uninstall: |
| 40 | +```bash |
| 41 | +sudo apt remove numberguessinggame |
| 42 | +sudo apt autoremove -y # Remove dependencies |
| 43 | +``` |
| 44 | + |
| 45 | +### Standalone Packages with Bundled JRE (Recommended) |
| 46 | + |
| 47 | +Download the platform-specific package with bundled JRE from the [latest release](https://github.com/project516/numberguessinggame/releases): |
| 48 | + |
| 49 | +- **Windows**: `NumberGuessingGame-windows.zip` |
| 50 | +- **macOS**: `NumberGuessingGame-macos.zip` |
| 51 | +- **Linux**: `NumberGuessingGame-linux.tar.xz` |
| 52 | + |
| 53 | +Extract the downloaded archive and run: |
| 54 | + |
| 55 | +**On Windows:** |
| 56 | +Run `run.bat` |
| 57 | + |
| 58 | +**On Linux/Mac:** |
| 59 | +Run `run.sh` |
| 60 | + |
| 61 | +### Manual Installation (Requires Java) |
| 62 | + |
| 63 | +Download the `archive.zip` from the [latest release](https://github.com/project516/numberguessinggame/releases) |
| 64 | + |
| 65 | +#### Requirements |
| 66 | + |
| 67 | +- Java 8 or higher |
| 68 | + |
| 69 | +#### How to Run |
| 70 | + |
| 71 | +**On Windows:** |
| 72 | +Run `run.bat` |
| 73 | + |
| 74 | +**On Linux/Mac:** |
| 75 | +Run `run.sh` |
| 76 | + |
| 77 | +### How to Play |
| 78 | + |
| 79 | +The game features both a graphical user interface (GUI) and a console mode. |
| 80 | + |
| 81 | +#### GUI Mode (Default) |
| 82 | + |
| 83 | +1. Start the game using one of the methods above |
| 84 | +2. A window will appear with the game interface |
| 85 | +3. Enter your guess in the text field and click "Submit Guess" or press Enter |
| 86 | +4. The game will provide visual feedback: |
| 87 | + - Blue text indicates your guess was too low |
| 88 | + - Orange text indicates your guess was too high |
| 89 | + - Green text indicates you guessed correctly! |
| 90 | +5. The number of guesses is displayed and updated in real-time |
| 91 | +6. When you guess correctly, you'll be prompted to enter your username |
| 92 | +7. After entering your username, your score will be saved and the top high scores will be displayed |
| 93 | +8. Click "New Game" to play again |
| 94 | +9. Use the menu bar for additional options: |
| 95 | + - File → New Game (Ctrl+N): Start a new game |
| 96 | + - File → Exit: Close the application |
| 97 | + - View → High Scores: View the top high scores |
| 98 | + - Help → About: View game information |
| 99 | + |
| 100 | +#### Console Mode |
| 101 | + |
| 102 | +To run the classic console version, use the `--console` or `-c` flag: |
| 103 | + |
| 104 | +```bash |
| 105 | +java -jar app.jar --console |
| 106 | +# or |
| 107 | +./run.sh --console # Linux/Mac |
| 108 | +run.bat --console # Windows |
| 109 | +``` |
| 110 | + |
| 111 | +In console mode: |
| 112 | +1. Enter your guess when prompted |
| 113 | +2. The game will tell you if your guess is too high or too low |
| 114 | +3. Keep guessing until you find the correct number |
| 115 | +4. The game will display how many guesses it took you |
| 116 | +5. Enter your username when prompted to save your score |
| 117 | +6. The top high scores will be displayed after saving your score |
| 118 | + |
| 119 | +### High Scores |
| 120 | + |
| 121 | +The game automatically tracks high scores (games won with the least guesses). High scores are stored in your home directory at `~/.numberguessinggame/highscores.properties`. |
| 122 | + |
| 123 | +- The top 10 scores are kept |
| 124 | +- Scores are sorted by the number of guesses (least is best) |
| 125 | +- Each score includes the username and number of guesses |
| 126 | +- High scores persist across game sessions |
| 127 | +- View high scores from the GUI menu (View → High Scores) or after completing a game |
| 128 | + |
| 129 | +## Development |
| 130 | + |
| 131 | +### Requirements |
| 132 | + |
| 133 | +- Java 25 (Eclipse Temurin recommended for development) |
| 134 | + |
| 135 | +### Development Setup |
| 136 | + |
| 137 | +[SDKMAN!](https://sdkman.io) is the recommended way to install Java and Gradle: |
| 138 | + |
| 139 | +``` |
| 140 | +sdk install java 25-tem |
| 141 | +``` |
| 142 | + |
| 143 | +Alternatively, install Eclipse Temurin JDK directly from https://adoptium.net/ |
| 144 | + |
| 145 | +### Building |
| 146 | + |
| 147 | +From the project root: |
| 148 | +``` |
| 149 | +./gradlew build |
| 150 | +``` |
| 151 | + |
| 152 | +### Creating Release Archives |
| 153 | + |
| 154 | +#### Zip Archive |
| 155 | + |
| 156 | +**On Windows:** |
| 157 | +Run `.\gradlew build` and `.\package.bat` from the project root. |
| 158 | + |
| 159 | +**On Linux/Mac:** |
| 160 | +Run `./package.sh` from the project root. |
| 161 | + |
| 162 | +This will create `archive.zip` containing the application, run scripts, README, and LICENSE. The archive can be released to GitHub Releases. |
| 163 | + |
| 164 | +#### Debian Package |
| 165 | + |
| 166 | +**On Linux:** |
| 167 | +Run `./package-deb.sh` from the project root. |
| 168 | + |
| 169 | +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. |
| 170 | + |
| 171 | +#### Platform-Specific Packages with Bundled JRE |
| 172 | + |
| 173 | +**On Linux:** |
| 174 | +Run the following scripts to create platform-specific packages with bundled JRE: |
| 175 | + |
| 176 | +```bash |
| 177 | +./package-win.sh # Creates NumberGuessingGame-windows.zip |
| 178 | +./package-macos.sh # Creates NumberGuessingGame-macos.zip |
| 179 | +./package-linux.sh # Creates NumberGuessingGame-linux.tar.xz |
| 180 | +``` |
| 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 | 183 | ======= |
184 | 184 | # Number Guessing Game |
185 | 185 |
|
|
0 commit comments