minVal and MaxVal

Hi everyone, I 'm trying to assign a minimum and a maximum value to my handler staircase. I created a staircase not using the dedicated function. Specifically, I attributed an start value to my target stimulus and this value changes according to the response of partecipant and the previous target.
For example:

StimulusStart = 10
LastStimulus = StimulusStart

if resp.corr:
StimulusStart = LastStimulus + 1

if not resp.corr:
StimulusStart = LastStimulus - 2

Fortunately staircase works as it should but I would like the presentation of the stimulus (StimulusStart) can reach a minimum value of 5 and a maximum value of 15.

I tried to use minVal = 5 and maxVal = 15 but it doesn’t work.
How can I do?

I hope in your help,

thank you in advance

Hello PsychoB

why don’t you include the limits in your if-construction?

if resp.corr and StimulusStart < 15:
    StimulusStart = LastStimulus + 1

if not resp.corr and StimulusStart > 6:
    StimulusStart = LastStimulus - 2

This way StimulusStart can not get larger than 15 and smaller that 5.

Best wishes Jens

Thank you for your time Jens. I solved with this code:

if not resp.corr and StimulusStart < 6:
StimulusStart = 6

if resp.corr and StimulusStart > 15:
StimulusStart = 15