Spaces:
Runtime error
Runtime error
update generators module
Browse files- scripts/quiz/generators.py +11 -24
scripts/quiz/generators.py
CHANGED
|
@@ -1,33 +1,20 @@
|
|
|
|
|
| 1 |
from .questions import generate_question_data
|
| 2 |
-
from .utils import
|
| 3 |
|
| 4 |
|
| 5 |
-
def start_interactive_math(
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
elif right_answers > 2:
|
| 11 |
-
right_answers = 0
|
| 12 |
-
wrong_answers = 0
|
| 13 |
-
level = get_next_level(level)
|
| 14 |
-
|
| 15 |
-
question_data = generate_question_data(level)
|
| 16 |
question = question_data['question']
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
ord_num = question_data['ordinal_number']
|
| 20 |
-
times = question_data['times']
|
| 21 |
|
| 22 |
-
numbers_group = [cur_num, ord_num, times]
|
| 23 |
output = {
|
| 24 |
"text": question,
|
| 25 |
-
"
|
| 26 |
-
"
|
| 27 |
-
'number_correct': right_answers,
|
| 28 |
-
'number_incorrect': wrong_answers,
|
| 29 |
-
'level': level,
|
| 30 |
-
"hints_used": 0
|
| 31 |
}
|
| 32 |
return output
|
| 33 |
-
|
|
|
|
| 1 |
+
import random
|
| 2 |
from .questions import generate_question_data
|
| 3 |
+
from .utils import get_next_difficulty, generate_start_step
|
| 4 |
|
| 5 |
|
| 6 |
+
def start_interactive_math(difficulty=0.01, do_increase: True | False = True):
|
| 7 |
+
next_difficulty = get_next_difficulty(difficulty, do_increase)
|
| 8 |
+
start, step = generate_start_step(difficulty)
|
| 9 |
+
question_data = generate_question_data(start, step, question_num=random.randint(0, 5))
|
| 10 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
question = question_data['question']
|
| 12 |
+
start = question_data['start']
|
| 13 |
+
step = question_data['step']
|
|
|
|
|
|
|
| 14 |
|
|
|
|
| 15 |
output = {
|
| 16 |
"text": question,
|
| 17 |
+
"difficulty": next_difficulty,
|
| 18 |
+
"question_numbers": [start, step, start + step]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
return output
|
|
|