Perform functions according to coordinates within xy_grid?
Hi there,
I was just wondering if it is possible to use the xy_grid function to draw a grid with different stimuli, according to the coordinates? Can you reference the coordinates somehow?
Essentially, I am trying to produce a grid of letters whose positions are random.
Many thanks,
Joff
Comments
Hi Joff,
I'm not sure I understand your question correctly, but what you're describing is exactly what the
xy_grid()function is for. A simple 3x3 grid with letters at random locations can be created like this:If you have no experience with Python, you may also want to walk through one of the beginner Python tutorials:
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastian,
Sorry for the initial vagueness, regardless your advice was very helpful and I think I am very close to achieving what I want to do.
Rather than these being completely random letters there are some rules. It is a visual search task where a letter F is presented in a grid of distracter letters (E's and t's). The size of the grid will change depending on the performance of the individual and the letters can be oriented as normal, or they can be mirror images.
I am having a problem with the final loop which draws the letters into their corresponding positions in the grid. I imagine it is just a question of syntax, but I can't see it myself.
I would greatly appreciate the help of your trained eye!
Many thanks,
Joff
Hi Joff,
There are a few things that quite work out in the code you posted.
1) There is a
:missing in the end of the line in which you initiate theforloop2) Your usage of
random.randintallows indices to be selected that are out of the range of your list. You should usei*j-1instead3) You don't present anything yet. I added two lines in the end, that will actually show your displays (until a key is pressed)
Here is your (updated) code:
I hope this solved your issue.
Best,
Eduard