This app implements a mental math task in which participants solve addition problems for a fixed amount of time. Participants first read a set of instructions describing the task. They are then shown a sequence of additions composed of randomly generated numbers. Their goal is to solve as many additions as possible within the allotted time.
Each problem consists of several numbers that must be added mentally. Participants enter their answer in a numeric input field and confirm it by clicking the Valider button or pressing Enter. Once an answer is submitted, the next problem is displayed immediately. No feedback about correctness is given during the task.
Parameters
The structure of the task is controlled by several constants defined in __init__.py.
Constant MATH_TASK_DURATION: the total duration of the task in seconds.
Constant MATH_TASK_NUMBER_OF_NUMBERS : the number of numbers that must be added in each problem.
Constant MATH_TASK_NUMBER_OF_DIGITS: the number of digits of each number appearing in the addition.
Generation of problems
When the task begins, the server generates a list of additions using random numbers. The numbers are drawn uniformly from the interval determined by the number of digits. Each task contains a list of additions stored in player.task_data, which ensures that participants continue from the same point if the page is refreshed.
App structure
The app contains two pages:
FirstPartIntro displays the instructions and shows an example of the task.
MentalMath implements the interactive task using oTree live pages. After each answer, the server stores:
the current question index
the number of correct answers
the time left to complete the task
This ensures that the task can resume correctly if the page is refreshed.
In practice: How to make it run?
Download mathtask.zip from this repository
Places the files in your oTree project
Add the mathtask folder to your otree main folder
Add the following configuration to the SESSION_CONFIGS list in your settings.py file:
dict(
name='mathtask',
display_name="An addition task",
app_sequence=['mathtask'],
num_demo_participants=6,
)