Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ void check(int guess) {
throw new IllegalArgumentException("Invalid number!");
}
}

void quit(int input) {
// 0 is quit
// 1 is continue
if (input != 0 || input != 1) {
throw new IllegalArgumentException("Invalid number!");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ void run() {
DebugInfo debugInfo = new DebugInfo();
GameInfo gameInfo = new GameInfo();
GameLogic logic = new GameLogic();
CheckGuess check = new CheckGuess();

debugInfo.launchDebug();
gameInfo.about();
Expand All @@ -25,13 +26,10 @@ void run() {
System.out.print("\nPlay again? (1 -> Y / 0 -> N) ");
try {
play = scan.userGuess();
if (play == 0) {
break;
} else if (play != 1) {
throw new IllegalArgumentException("");
}
check.quit(play);
} catch (Exception e) {
System.out.println("Error reading input!");
debugInfo.gameCrash();
e.printStackTrace();
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package io.github.project516.NumberGuessingGame;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

/**
* Reads version information for the Number Guessing Game. Currently returns a placeholder version
* string.
Expand All @@ -12,6 +16,13 @@ public class ReadVersionFile {
* @return the version string
*/
public String readVersion() {
return "0.0.8";
String filePath = "version.txt";
String content = "rolling"; // Placeholder version
try {
content = new String(Files.readAllBytes(Paths.get(filePath)));
} catch (IOException e) {
System.err.println("Error reading file: " + e.getMessage());
}
return content;
}
}
2 changes: 1 addition & 1 deletion app/src/main/resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.8
rolling
2 changes: 1 addition & 1 deletion debian-package/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: numberguessinggame
Version: 0.0.8
Version: 1.0.0
Section: games
Priority: optional
Architecture: all
Expand Down
Loading