Memory Game
Jaap MurreThis is an experiment that may be considered a variant on a well-known game.
A number of cards are shown face-down. The game is played by clicking two cards with the left mouse button. When clicked a card is turned and you view it. If two clicked cards are equal, they are taken out of the game.
You win if all pairs have been identified.
Though this is a minimal implementation (less than 70 lines of JavaScript), it is fully functional and works on phones and tables too.
If you are a registered user and signed in, you can here copy this script and its stimuli to your own account, where you can edit it and change it in any way you want.
It is absolutely free to register (no credit card info asked!). You can then instantly copy this experiment with one click and edit it, change its accompanying texts, its landing page, stimuli, etc. Invite your colleagues, friends, or students to check out your experiment. There is no limit on how many people can do your experiment, even with a free account.
The catch? There is no catch! Just keep in mind that with a free account, you cannot collect data. For teaching that is usually not a problem. For research, prepaid data collection (unlimited subjects) starts as low as €10.00 for a 10-day period.
var cards = [], blocks = [], rows = 3, cols = 4, use_icons = true, i, t, r, k, b, id, waiting = false, symbols = [], first = null, trials = 0, success = 0, message = main.addblock(20,2,70,10).text("0 trials") .style("font-size","1.2em"), imb = main.addblock(1,'top',20,20) .setimage("https://scripting.neurotask.com/images/cache/e5c436c360f1aec505f6a03f6586901f.png"); var icons = ['glass','music','search','envelope-alt','heart','star', 'user','film','cog','trash','home','time']; for (i = 1; i <= rows*cols/2; i++) { t = use_icons ? '' : i; symbols.push(t); symbols.push(t); } symbols = shuffle(symbols); function onClick(_b) { return function() { if (waiting) { return; } var b = _b; if (first) { waiting = true; console.log("b: ",b, b.id); if (first.id === b.id) { b.text(b.id).style("background-color","lightblue"); await(1000); first.clear().style("background-color","silver"); b.clear().style("background-color","silver"); first.handler.remove(); b.handler.remove(); success += 2; if (success === rows*cols) { message.text("Finished in " + ++trials + " trials!"); } else { message.text("" + (++trials) + " trial" + (trials === 1?"":"s")); } } else { b.text(b.id).style("background-color","lightblue"); await(2000); b.clear().style("background-color","steelblue"); first.clear().style("background-color","steelblue"); message.text("" + (++trials) + " trial" + (trials === 1?"":"s")); } first = null; } else { first = b; b.text(b.id).style("background-color","lightblue"); } waiting = false; } } for (c = 0; c < cols; c++) { for (r = 0; r < rows; r++) { id = symbols[c*rows+r]; b = main.addblock(c*(100/cols)+2,20+r*(80/rows), 91/cols,75/rows,"steelblue").style("font-size","2em"); b.id = id; b.handler = b.on("click",onClick(b)); } } addblock(85,3,15,7,"lightgrey","Quit").await('click');