Skip to content

Commit 03e1ae8

Browse files
author
Stephan
committed
Making game harder
Making game harder
1 parent 09118de commit 03e1ae8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/com/foxelyss/maththemright/Game.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public void generateExercise() {
144144

145145
int operation = random.nextInt(4);
146146

147-
double right_result = (double) a / b;
147+
int right_result = a / b;
148148

149149
char operand = '/';
150150
switch (operation) {
@@ -169,7 +169,8 @@ public void generateExercise() {
169169

170170
answers.deleteAll();
171171
for (int i = 0; i < 4; i++) {
172-
String answer = (right_result + 1 + random.nextInt(16)) + "";
172+
int offset = random.nextInt(24);
173+
String answer = (right_result + offset < 12 ? -1 * (1 + offset) : offset) + "";
173174
if (i == right_answer_index) {
174175
answer = "" + right_result;
175176
}

0 commit comments

Comments
 (0)