Skip to content

Commit 01032c1

Browse files
committed
refactor: logic change
1 parent 2149b77 commit 01032c1

File tree

2 files changed

+22
-33
lines changed

2 files changed

+22
-33
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package hexlet.code.games;
2+
3+
import hexlet.code.Engine;
4+
5+
import java.util.Random;
6+
7+
public class Even {
8+
public static void startGame() {
9+
final int rndMax = 100;
10+
String description = "Answer 'yes' if the number is even, otherwise answer 'no'.";
11+
String[][] roundsData = new String[Engine.ROUNDS][2];
12+
Random rand = new Random();
13+
14+
for (int i = 0; i < Engine.ROUNDS; i++) {
15+
int question = rand.nextInt(rndMax);
16+
String answer = (question % 2 == 0) ? "yes" : "no";
17+
roundsData[i][0] = String.valueOf(question);
18+
roundsData[i][1] = answer;
19+
}
20+
Engine.run(description, roundsData);
21+
}
22+
}

app/src/main/java/hexlet/code/games/EvenGame.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)