Skip to content

Commit

Permalink
added more valid inputs ("1" and "0")
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmp33 committed Sep 3, 2021
1 parent 84540f1 commit 7dff4fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/com/labrisca/catalan/io/UserInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public static String askGameMode() {
while (true) {
System.out.print("> ");
String input = SC.nextLine().trim().toLowerCase();
if (input.equals("si")) {
if (input.equals("si") || input.equals("1")) {
System.out.println("Mode hacker activat!");
System.out.print("Text" + Color.ANSI_PURPLE + " lila " + Color.ANSI_RESET);
System.out.println("= text que no veuries ;)");
System.out.println();
return "hacker";
} else if (input.equals("no")) {
} else if (input.equals("no") || input.equals("0")) {
System.out.println("Mode normal activat!");
System.out.println();
return "default";
Expand All @@ -37,11 +37,11 @@ public static boolean askAIBot() {
while (true) {
System.out.print("> ");
String input = SC.nextLine().trim().toLowerCase();
if (input.equals("si")) {
if (input.equals("si") || input.equals("1")) {
System.out.println("Perdràs :P!");
System.out.println();
return true;
} else if (input.equals("no")) {
} else if (input.equals("no") || input.equals("0")) {
System.out.println("Beep beep...");
System.out.println();
return false;
Expand All @@ -56,8 +56,8 @@ public static boolean askPrintCardsInfo() {
while (true) {
System.out.print("> ");
String input = SC.nextLine().trim().toLowerCase();
if (input.equals("si")) return true;
else if (input.equals("no")) return false;
if (input.equals("si") || input.equals("1")) return true;
else if (input.equals("no") || input.equals("0")) return false;
System.out.println("Introdueix \"si\" o \"no\"...");
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/com/labrisca/english/io/UserInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public static String askGameMode() {
while (true) {
System.out.print("> ");
String input = SC.nextLine().trim().toLowerCase();
if (input.equals("yes")) {
if (input.equals("yes") || input.equals("1")) {
System.out.println("Hacker mode on!");
System.out.print(Color.ANSI_PURPLE + "Purple " + Color.ANSI_RESET);
System.out.println("text = text you wouldn't see ;)");
System.out.println();
return "hacker";
} else if (input.equals("no")) {
} else if (input.equals("no") || input.equals("0")) {
System.out.println("Default mode on!");
System.out.println();
return "default";
Expand All @@ -37,11 +37,11 @@ public static boolean askAIBot() {
while (true) {
System.out.print("> ");
String input = SC.nextLine().trim().toLowerCase();
if (input.equals("yes")) {
if (input.equals("yes") || input.equals("1")) {
System.out.println("You'll lose :P!");
System.out.println();
return true;
} else if (input.equals("no")) {
} else if (input.equals("no") || input.equals("0")) {
System.out.println("Beep beep...");
System.out.println();
return false;
Expand All @@ -56,8 +56,8 @@ public static boolean askPrintCardsInfo() {
while (true) {
System.out.print("> ");
String input = SC.nextLine().trim().toLowerCase();
if (input.equals("yes")) return true;
else if (input.equals("no")) return false;
if (input.equals("yes") || input.equals("1")) return true;
else if (input.equals("no") || input.equals("0")) return false;
System.out.println("Input \"yes\" or \"no\"...");
}
}
Expand Down

0 comments on commit 7dff4fb

Please sign in to comment.