Skip to content

Commit

Permalink
update games and engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Asterroth committed Nov 13, 2023
1 parent 90341d9 commit 4dddec6
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 16 deletions.
13 changes: 4 additions & 9 deletions app/src/main/java/hexlet/code/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

public final class Engine {
public static final int MAX_ROUNDS = 3;
private Engine() { }
// Main method running the games
public static void runGame(String gameDescription, String[][] gameData) {
var player = Cli.greeter();
Expand All @@ -17,18 +16,14 @@ public static void runGame(String gameDescription, String[][] gameData) {
if (answer.equals(gameData[i][1])) {
System.out.println("Correct!");
} else {
wrongAnswer(gameData[i][1], answer, player);
System.out.println("'" + answer
+ "' is wrong answer ;(. Correct answer was "
+ "'" + gameData[i][1] + "'.");
System.out.println("Let's try again, " + player + "!");
return;
}
}
System.out.println("Congratulations, " + player + "!");
scan.close();
}
// Wrong answer message
public static void wrongAnswer(String correctAnswer, String answer, String playerName) {
System.out.println("'" + answer
+ "' is wrong answer ;(. Correct answer was "
+ "'" + correctAnswer + "'.");
System.out.println("Let's try again, " + playerName + "!");
}
}
1 change: 0 additions & 1 deletion app/src/main/java/hexlet/code/games/Calc.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import hexlet.code.Utils;

public final class Calc {
private Calc() { }
private static final String DESCRIPTION = "What is the result of the expression?";
private static final int RANDOM_MIN = 0; // Minimum random number used in the game
private static final int RANDOM_MAX = 100; // Maximum random number used in the game
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/hexlet/code/games/Even.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import hexlet.code.Utils;

public final class Even {
private Even() { }

private static final String DESCRIPTION = "Answer 'yes' if the number is even, otherwise answer 'no'.";
private static final int RANDOM_MIN = 0;
private static final int RANDOM_MAX = 100;
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/hexlet/code/games/Gcd.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import hexlet.code.Utils;

public final class Gcd {
private Gcd() { }
private static final String DESCRIPTION = "Find the greatest common divisor of given numbers.";
private static final int RANDOM_MIN = 0; // Minimum random number used in the game
private static final int RANDOM_MAX = 100; // Maximum random number used in the game
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/hexlet/code/games/Prime.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import hexlet.code.Utils;

public final class Prime {
private Prime() { }
private static final String DESCRIPTION = "Answer 'yes' if given number is prime. Otherwise answer 'no'.";
private static final int RANDOM_MIN = 0; // Minimum random number used in the game
private static final int RANDOM_MAX = 100; // Maximum random number used in the game
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/hexlet/code/games/Progression.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ public final class Progression {
private static final int MIN_STEP = 1; // Minimum value of step in sequence
private static final int SEQ_LENGTH = 6; // Sequence (progression) length

private Progression() {
}
// Line-up of game data
public static void genGame() {
String[][] gameData = new String[Engine.MAX_ROUNDS][2];
Expand Down

0 comments on commit 4dddec6

Please sign in to comment.