# Modify the time of appearance of the stimuli in each block according to the % of success

Hi, in my experiment, a participant has to complete a mental fatigue task, its an alternation of numbers and letters. They have to press “2” when the number is even, “3” when he is odd, and “space” if 2 identical letters follow each other.
There are 20 different blocks. In each block there are 60 alternating numbers and letters.

The time of appearance of the stimuli vary by 100msec between each block:

We start with a stimulus appearance time of 1400msec for Block 1. If at the end of Block 1 (i.e. after the 60 stimuli in the first list), the participant has more than 85% correct answers, we decrease the stimulus appearance time for Block 2 by 100msec. So in Block 2, the stimulus appearance time will be 1300msec.

The task continues in this way, if the participant has more than 85% correct answer in a block, the time of appearance in the next block is decreased by 100 ms, until the participant gets a score below 85% in a block. At this point the task stops and the response time of the previous block is recorded (i.e. the block or the participant last obtained a score of more than 85%).

Example = Block 1: 1400ms (time of appearance of stimuli); if the success rate is >= 85% = We move on to Block 2 with a time of appearance of stimuli at 1300ms (1400-100). If the success rate in Block 2 is >= 85% = We move on to Block 3 with a stimulus appearance time of 1200ms (1300-100).If in Block 3 the success rate is < 85%, the task stops and the response time of Block 2 is recorded, so 1300ms IS NOTED as the participant’s score.

I have this code to varies the time of appearance of the stimuli by 100 ms based on each participant’s response.

But the time of appearance of the stimuli have to by 100msec between each block (one block = an external list created with Excel, therefore 60 stimuli), and not at each participant’s response.

I also have a code to stop the task when the participant reaches 85% success. Here it is:

But i would like to adapt this code for 2 things:

As soon as the participant reaches 85% correct answers in a block, the task moves on to the next block.

And also, how to make the task stop when the participant gets in a block less than 85% correct answers?

Thank you