Dot Matrix Task

109 views
Skip to first unread message

aysegu...@gmail.com

unread,
Feb 24, 2022, 7:52:49 AM2/24/22
to oTree help & discussion
Hi everyone, 

I would like to write an oTree app for the Dot Matrix Task (Miyake, A., Friedman, N. P., Rettinger, D. A., Shah, P. & Hegarty, M. (2001). How Are Visuospatial Working Memory, Executive Functioning, and Spatial Abilities Related? A Latent-Variable Analysis. Journal of Experimental Psychology: General, 130(4), 621–640. https://doi.org/10.1037/0096-3445.130.4.621) and I am searching an elegant way to do this. 

The task is for one player and consists of 2 pages. 
On the first page, a 3x3 is shown with 4 random dots on it. 
On the second page, the player has to choose from 4 grid options the pattern that he has seen on the first page. 

Now I can do it with static image files. But since oTree is oTree, I would like to generate the grid pattern shown randomly on the first page and also generate the grid patterns in the incorrect choices on the second page randomly. And of course, there can be only one correct answer, so the randomly generated 3 incorrect choices must be different from each other and from the correct choice. 

The data that I need to store are: 
Player's choice correct/incorrect 
Time spent on both pages in ms 

I would be very grateful for your ideas. 
Cheers 
Ayşegül

Chris @ oTree

unread,
Feb 24, 2022, 8:57:45 AM2/24/22
to oTree help & discussion
this is pretty easy. a matrix has 9 squares, each square can be either a dot or blank. so randomly generate a 9-character string of 0's and 1's, for example 100010001, and call that field 'grid'. then in the template, make a <table> element with 3 rows and 3 columns.

<td> {{ grid.0 }} </td>
...
<td> {{ grid.8 }} </td>

Reply all
Reply to author
Forward
0 new messages