Per Problem Time Limit for ToL Task


Author
Message
chunhoilauhk
chunhoilauhk
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 9, Visits: 34
Hi All,
I'm back! After some discussion we decided we still need a time limit set for each problem. I'm trying to implement a problem time limit on the Tower of London task from Inquisitlab. I want the script to move on to the next problem once a set time limit that is same for all problems is up ( for example, 60 seconds, then it automatically moves to the next problem).

The part of the script I was thinking of adding to the choice trial is:

/branch [if (script.currenttime - values.t_roundstart > 60000) trial.stopblock

But it doesn't seem to work the way I want it to, and nothing seems to happen. Am I misunderstanding how I should implement the code, or is my approach completely wrong?



chunhoilauhk
chunhoilauhk
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 9, Visits: 34
chunhoilauhk - Sunday, May 6, 2018
Hi All,
I'm back! After some discussion we decided we still need a time limit set for each problem. I'm trying to implement a problem time limit on the Tower of London task from Inquisitlab. I want the script to move on to the next problem once a set time limit that is same for all problems is up ( for example, 60 seconds, then it automatically moves to the next problem).

The part of the script I was thinking of adding to the choice trial is:

/branch [if (script.currenttime - values.t_roundstart > 60000) trial.stopblock

But it doesn't seem to work the way I want it to, and nothing seems to happen. Am I misunderstanding how I should implement the code, or is my approach completely wrong?



Sorry, I forgot the parentheses, /branch [if (script.currenttime - values.t_roundstart > 60000) trial.stopblock]
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
chunhoilauhk - Sunday, May 6, 2018
chunhoilauhk - Sunday, May 6, 2018
Hi All,
I'm back! After some discussion we decided we still need a time limit set for each problem. I'm trying to implement a problem time limit on the Tower of London task from Inquisitlab. I want the script to move on to the next problem once a set time limit that is same for all problems is up ( for example, 60 seconds, then it automatically moves to the next problem).

The part of the script I was thinking of adding to the choice trial is:

/branch [if (script.currenttime - values.t_roundstart > 60000) trial.stopblock

But it doesn't seem to work the way I want it to, and nothing seems to happen. Am I misunderstanding how I should implement the code, or is my approach completely wrong?



Sorry, I forgot the parentheses, /branch [if (script.currenttime - values.t_roundstart > 60000) trial.stopblock]

script.currenttime returns the current time in HH:MM:SS format, it's a string, you cannot do math with it, and subtracting milliseconds from it does not make sense.

You'll need to work with script.elapsedtime instead, see how the solution time is calculated throughout the script, i.e. look at

values.t_roundstart, which records the point in time a given round was started in milliseconds elapsed since the start of the script
and
values.t_solution, which records the point in time a given problem was solved in milliseconds elapsed since the start of the script

You'll need to do something similar to implement your per-problem timeout. Note that t_roundstart is _reset_ when a given problem is re-started.

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
Dave - Monday, May 7, 2018
chunhoilauhk - Sunday, May 6, 2018
chunhoilauhk - Sunday, May 6, 2018
Hi All,
I'm back! After some discussion we decided we still need a time limit set for each problem. I'm trying to implement a problem time limit on the Tower of London task from Inquisitlab. I want the script to move on to the next problem once a set time limit that is same for all problems is up ( for example, 60 seconds, then it automatically moves to the next problem).

The part of the script I was thinking of adding to the choice trial is:

/branch [if (script.currenttime - values.t_roundstart > 60000) trial.stopblock

But it doesn't seem to work the way I want it to, and nothing seems to happen. Am I misunderstanding how I should implement the code, or is my approach completely wrong?



Sorry, I forgot the parentheses, /branch [if (script.currenttime - values.t_roundstart > 60000) trial.stopblock]

script.currenttime returns the current time in HH:MM:SS format, it's a string, you cannot do math with it, and subtracting milliseconds from it does not make sense.

You'll need to work with script.elapsedtime instead, see how the solution time is calculated throughout the script, i.e. look at

values.t_roundstart, which records the point in time a given round was started in milliseconds elapsed since the start of the script
and
values.t_solution, which records the point in time a given problem was solved in milliseconds elapsed since the start of the script

You'll need to do something similar to implement your per-problem timeout. Note that t_roundstart is _reset_ when a given problem is re-started.

Okay, here (attached) is something to give you a start. The general idea is to have a new parameter setting the time allowed per problem (here: set to 60000 ms, i.e. one minute):

<parameters>
/ maxattempts = 3
/ npracticeproblems = 1
/ time_per_problem = 60000
...
</parameter>

Then set a value to that parameter at the start of each round (<trial newround>):

<trial newround>
/ ontrialbegin = [
values.timeleft = parameters.time_per_problem;
values.t_roundstart=0;
values.t_firstmove=0;
values.t_solution=0;
...
</trial>

and use the value as a /timeout in the choice trial (<trial choice>) while subtracting the time taken by each choice on a trial-by-trial basis:

<trial choice>
...
/ ontrialend = [
values.t_choiceend=script.elapsedtime;
values.timeleft -= (values.t_choiceend - values.t_choicestart);
...
/ branch = [
if(trial.choice.response=="resetround")
{
    if (values.subjectattempts < parameters.maxattempts)
        trial.resetround;
    else
        trial.stopblock;
}
else if (trial.choice.response == "nextround" || trial.choice.response == 0)
    trial.stopblock;
else if (expressions.targetachieved)
    trial.feedback;
else
    trial.choice;
]
/ timeout = values.timeleft

</trial>

Among the decisions you have to make:
- Do you want to interrupt the subject in the middle of a move if time has run out (this is what the above code will do) or do you want them to be able to complete the move even if time has run out?
- Do you want to allow 1 minute _per problem_ or per _attempt_ at a given problem? Suppose a participant solves the problem in the 1st attempt but not in the minimum amount of moves. Further suppose that 1st attempt took 40 seconds. Is the participant supposed to only have 20 seconds left for their 2nd attempt or are they supposed to get another full minute? The code attached does the former, if you want the latter you would need to set values.timeleft back to 60000ms in <trial resetround>

There probably are a number of other, similar complications that I haven't thought of, so I'd recommend you clarify for yourself how exactly you want things to work before making major modifications to the code.

Attachments
toweroflondon.iqx (626 views, 48.00 KB)
chunhoilauhk
chunhoilauhk
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 9, Visits: 34
Dave - Monday, May 7, 2018
Dave - Monday, May 7, 2018
chunhoilauhk - Sunday, May 6, 2018
chunhoilauhk - Sunday, May 6, 2018
Hi All,
I'm back! After some discussion we decided we still need a time limit set for each problem. I'm trying to implement a problem time limit on the Tower of London task from Inquisitlab. I want the script to move on to the next problem once a set time limit that is same for all problems is up ( for example, 60 seconds, then it automatically moves to the next problem).

The part of the script I was thinking of adding to the choice trial is:

/branch [if (script.currenttime - values.t_roundstart > 60000) trial.stopblock

But it doesn't seem to work the way I want it to, and nothing seems to happen. Am I misunderstanding how I should implement the code, or is my approach completely wrong?



Sorry, I forgot the parentheses, /branch [if (script.currenttime - values.t_roundstart > 60000) trial.stopblock]

script.currenttime returns the current time in HH:MM:SS format, it's a string, you cannot do math with it, and subtracting milliseconds from it does not make sense.

You'll need to work with script.elapsedtime instead, see how the solution time is calculated throughout the script, i.e. look at

values.t_roundstart, which records the point in time a given round was started in milliseconds elapsed since the start of the script
and
values.t_solution, which records the point in time a given problem was solved in milliseconds elapsed since the start of the script

You'll need to do something similar to implement your per-problem timeout. Note that t_roundstart is _reset_ when a given problem is re-started.

Okay, here (attached) is something to give you a start. The general idea is to have a new parameter setting the time allowed per problem (here: set to 60000 ms, i.e. one minute):

<parameters>
/ maxattempts = 3
/ npracticeproblems = 1
/ time_per_problem = 60000
...
</parameter>

Then set a value to that parameter at the start of each round (<trial newround>):

<trial newround>
/ ontrialbegin = [
values.timeleft = parameters.time_per_problem;
values.t_roundstart=0;
values.t_firstmove=0;
values.t_solution=0;
...
</trial>

and use the value as a /timeout in the choice trial (<trial choice>) while subtracting the time taken by each choice on a trial-by-trial basis:

<trial choice>
...
/ ontrialend = [
values.t_choiceend=script.elapsedtime;
values.timeleft -= (values.t_choiceend - values.t_choicestart);
...
/ branch = [
if(trial.choice.response=="resetround")
{
    if (values.subjectattempts < parameters.maxattempts)
        trial.resetround;
    else
        trial.stopblock;
}
else if (trial.choice.response == "nextround" || trial.choice.response == 0)
    trial.stopblock;
else if (expressions.targetachieved)
    trial.feedback;
else
    trial.choice;
]
/ timeout = values.timeleft

</trial>

Among the decisions you have to make:
- Do you want to interrupt the subject in the middle of a move if time has run out (this is what the above code will do) or do you want them to be able to complete the move even if time has run out?
- Do you want to allow 1 minute _per problem_ or per _attempt_ at a given problem? Suppose a participant solves the problem in the 1st attempt but not in the minimum amount of moves. Further suppose that 1st attempt took 40 seconds. Is the participant supposed to only have 20 seconds left for their 2nd attempt or are they supposed to get another full minute? The code attached does the former, if you want the latter you would need to set values.timeleft back to 60000ms in <trial resetround>

There probably are a number of other, similar complications that I haven't thought of, so I'd recommend you clarify for yourself how exactly you want things to work before making major modifications to the code.

Thank you so much for your help again! I think so far what you have is definitely what we would need, I'll try my best to modify the code by myself before consulting the forums again.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search