Not necessarily: there are many ways to use randomisation, with advantages and disadvantages. The advantage of your scheme is that the order is fully random across subjects but you retain a balancing of events across any other design factors and can be sure that the proportion of events is exactly 0.2 for every subject. Using a random number on every trial doesn’t satisfy that, as there will be sampling variability across subjects (for some the proportion might be 0.18, for others 0.23, etc) and events will not be exactly balanced across any other factors in your design.
You need to use some custom code to keep track of both the score and the current value of the risk of losing a point. I’m going to assume that you have defined a “correct answer” column in your conditions column which is
'q' on 20% of trials and empty on the other trials, and that therefore the keyboard component will record a correct or incorrect value on each trial accordingly (i.e. I suggest you stick with your current arrangement of a fixed proportion of 20% of trials unless there is a good reason to change).
So insert a code component from the “custom” component panel. In its “begin routine” tab, put something like this:
# only on the first trial, initialise these values:
if your_loop_name.thisN == 0:
score = 0
loss_threshold = 0.0
And in the “end routine” tab:
score = score + 1
# increment loss threshold, to a maximum of 1.0:
loss_threshold = min(loss_threshold + 0.1, 1.0)
# compare against a sample from a uniform distribution of (0.0, 1.0]:
if random() < loss_threshold:
score = score -1
# save in the data for this trial: