Simple Search Experiment with Distractor Stimuli

OS (e.g. Win10): MacOS 11.01
PsychoPy version (e.g. 1.84.x): v2020.2.5
**Standard Standalone? Yes
**What are you trying to achieve?: I am trying to create a simple search experiment. A pentagon will appear in 8 random locations across the screen and the participant will have to click on them. However, I also need 5 distractor stimuli (hexagons) to appear on the screen as well. These distractors can appear in any of the 8 random locations except where the pentagon will appear. I am completely stumped and do not know where to begin. If anyone could explain how to make the randomization without overlap possible, that would be much appreciated. Thank you for your time.

Hi There,

Try adding a code component and in the ‘Begin routine tab’ have:

myPositions = [[-0.5, -0.5], [0, -0.5], [0.5, -0.5], [0.5, -0.5]] shuffle(myPositions)

Except the list of positions will contain 8 coordinate pairs for your study.

Then add 8 image/polygon components to your study and in the ‘position’ field set each to be:

myPositions[0]

then

myPositions[1]

and so on… and ensure that field is set to ‘set every repeat’ - this will select the coordinate from the randomly shuffled list.

Hope this helps,
Becca

1 Like

Also for reference (and a shameless self-plug), there is a chapter on implementing exactly this task step-by-step in the Builder text book (Chapter 9, plus extended to use eye tracking in Chapter 19):

2 Likes