File tree Expand file tree Collapse file tree 5 files changed +14
-9
lines changed
app/src/main/java/hexlet/code/games Expand file tree Collapse file tree 5 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,10 @@ public static void startGame() {
2323 char [] operators = {'+' , '-' , '*' };
2424 String [][] data = new String [Engine .getRoundsCount ()][2 ];
2525 SecureRandom random = new SecureRandom ();
26- int numbersCount = 100 ;
27-
2826
2927 for (int i = 0 ; i < Engine .getRoundsCount (); i ++) {
28+ int numbersCount = 100 ;
29+
3030 int number1 = random .nextInt (numbersCount ) + 1 ;
3131 int number2 = random .nextInt (numbersCount ) + 1 ;
3232 char operator = operators [random .nextInt (operators .length )];
Original file line number Diff line number Diff line change @@ -8,10 +8,11 @@ public static void startGame() {
88 String description = "Answer 'yes' if the number is even, otherwise answer 'no'." ;
99 String [][] data = new String [Engine .getRoundsCount ()][2 ];
1010 SecureRandom random = new SecureRandom ();
11- int numbersCount = 100 ;
1211
1312
1413 for (int i = 0 ; i < Engine .getRoundsCount (); i ++) {
14+ int numbersCount = 100 ;
15+
1516 int number = random .nextInt (numbersCount ) + 1 ;
1617 String question = String .valueOf (number );
1718 String correctAnswer = number % 2 == 0 ? "yes" : "no" ;
Original file line number Diff line number Diff line change @@ -19,9 +19,10 @@ public static void startGame() {
1919 String description = "Find the greatest common divisor of given numbers." ;
2020 String [][] data = new String [Engine .getRoundsCount ()][2 ];
2121 SecureRandom random = new SecureRandom ();
22- int numbersCount = 100 ;
2322
2423 for (int i = 0 ; i < Engine .getRoundsCount (); i ++) {
24+ int numbersCount = 100 ;
25+
2526 int number1 = random .nextInt (numbersCount ) + 1 ;
2627 int number2 = random .nextInt (numbersCount ) + 1 ;
2728 String question = number1 + " " + number2 ;
Original file line number Diff line number Diff line change @@ -20,9 +20,10 @@ public static void startGame() {
2020 String description = "Answer 'yes' if given number is prime. Otherwise answer 'no'." ;
2121 String [][] data = new String [Engine .getRoundsCount ()][2 ];
2222 SecureRandom random = new SecureRandom ();
23- int numbersCount = 100 ;
2423
2524 for (int i = 0 ; i < Engine .getRoundsCount (); i ++) {
25+ int numbersCount = 100 ;
26+
2627 int number = random .nextInt (numbersCount ) + 1 ;
2728 String question = String .valueOf (number );
2829 String correctAnswer = isPrime (number ) ? "yes" : "no" ;
Original file line number Diff line number Diff line change @@ -16,16 +16,18 @@ public static void startGame() {
1616 String description = "What number is missing in the progression?" ;
1717 String [][] data = new String [Engine .getRoundsCount ()][2 ];
1818 SecureRandom random = new SecureRandom ();
19- int startNumber = 60 ;
20- int stepNumber = 10 ;
21- int hiddenNumber = 10 ;
19+
2220
2321
2422 for (int i = 0 ; i < Engine .getRoundsCount (); i ++) {
23+ int startNumber = 60 ;
24+ int stepNumber = 10 ;
25+ int hiddenNumber = 10 ;
26+ int length = 10 ;
27+
2528 int start = random .nextInt (startNumber ) + 1 ;
2629 int step = random .nextInt (stepNumber ) + 1 ;
2730 int hiddenIndex = random .nextInt (hiddenNumber );
28- int length = 10 ;
2931
3032 String [] progression = generateProgression (start , step , length );
3133 String correctAnswer = progression [hiddenIndex ];
You can’t perform that action at this time.
0 commit comments