Possible? correct_response dependent on cumulative response
In my probability guessing experiment I show a pre-set sequence of 100 trials of blue and orange squares. The subject has to guess whether the next colour will be blue or orange. Feedback sound is given when the guess was incorrect.
The correct_response is dependent on the cumulative proportion of the responses compared to the cumulative proportion of the given sequence. e.g. when at trial 10 the cumulative proportion of the given sequence of blue is 0.7 and orange is 0.3, then the answer is correct when the cumulative proportion of the responses lies in between 0.8 and 0.6 for the blue colour.
Is it possible to make the correct_response dependent on the response given up until that trial in a block sequence? See image for what that could look like in python(Jupyter).
Thank you very much in advance!