Digit Span Task
Jaap MurreThis is a fairly typical implementation of the digit span forward task, similar to what one might encounter in a neuropsychological test battery. The task takes less than 5 min and can be done on a PC with a mouse or on a large touchscreen (tablet or large mobile phone). The digit span is reported at the end of the task.
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 stimuli_forward = [ [[], [] ], [[1], [1] ], [[9,7], [6,3] ], [[5,8,2], [6,9,4] ], [[7,2,8,6], [6,4,3,9] ], [[4,2,7,3,1], [7,5,8,3,6] ], [[3,9,2,4,8,7], [6,1,9,4,7,3] ], [[4,1,7,9,3,8,6], [6,9,1,7,4,2,8] ], [[3,8,2,9,6,1,7,4], [5,8,1,3,2,6,4,7] ], [[2,7,5,8,6,3,1,9,4],[7,1,3,9,4,2,5,6,8] ] ]; var stimuli_forward_example = [ [[], [] ], [[1], [1] ], [[1,2], [4,2] ], [[7,8,2], [5,1,3] ] ]; main.setfontsize(60); instruction("First, you will do a brief example of the task"); digit_span_forward_example(); instruction("Now comes the real task"); digit_span_forward(); function digit_span_forward_example() { var digits, span, trial, i, answer, correct, mistakes, total_correct = 0, finished = false; instruction('You will see a number of digits in succession.' + ' They are only shown once.' + ' After the digits have been shown, you must repeat them in the same order by' + ' clicking on the numbers at the bottom of the screen.' + ' There are several series of numbers.' + ' The series are getting longer and longer.', 'OK', 'Instruction'); instruction('We will start with a brief example so you can practice for a while', 'OK', ' '); for (span = 3; span < 4; span++) { mistakes = 0; for (trial = 0; trial < 2; trial++) // Subjects get two chances { digits = stimuli_forward_example[span][trial]; await(2000); for (i = 0; i < digits.length; i++) { text(digits[i],300); await(1000); clear(); await(500); } answer = get_answer(10000); correct = matches(digits,answer); if (correct < answer.length) { await(500); alert("Make sure you click on the digits in the same order as presented"); } else { ++total_correct; } } } // log(total_correct,"total_correct_digit_span_forward_example"); } function digit_span_forward() { var digits, span, trial, i, answer, correct, mistakes, total_correct = 0, finished = false; var t0 = now(); for (span = 2; span < 10; span++) { mistakes = 0; for (trial = 0; trial < 2; trial++) // Subjects get two chances { digits = stimuli_forward[span][trial]; await(2000); for (i = 0; i < digits.length; i++) { text(digits[i],300); await(1000); clear(); await(500); } answer = get_answer(); correct = matches(digits,answer); if (correct !== span) { ++mistakes; } else { ++total_correct; } if (mistakes === 2) { finished = true; } } if (finished) { break; } } --span; // Last span is one too high, because was not completed // log(total_correct,"total_correct_digit_span_forward"); // log(span,"span_digit_span_forward"); // log(span*total_correct,"kessels_score_digit_span_forward"); var t1 = now(); // log(t1 - t0,"timing_digit_span_forward"); await(1000); text("You have a forward digit span of " + span + "
" + "Click on the space bar to exit the experiment"); awaitkey(' '); } function matches(correct,answer,type) { var i, score = 0; for (i = 0; i < Math.min(correct.length,answer.length); i++) { if (correct[i] === +answer[i]) { ++score; } } return score; } function get_answer(time_out) { var i, digits_answer = [], local_blocks = [], e; feedback = addblock(6,65,90,10).align('left').style('font-weight','bold'); correction = addblock(70,65,10,10,"lightgrey","C").style('cursor','pointer'); ok = addblock(85,65,10,10,"grey","OK").style('cursor','pointer'); local_blocks.push(feedback); local_blocks.push(correction); local_blocks.push(ok); correction.on('click',function() { if (digits_answer.length) { digits_answer.pop(); feedback.text(digits_answer.join(' ')); } }); for (i = 1; i < 10; i++) { width = 8; margin = 2; b = addblock(6 + (width + margin)*(i-1),80,width,width,"lightgrey",i); var obj = {it: i}; var f = dojo.hitch(obj,function() { digits_answer.push(this.it); feedback.text(digits_answer.join(' ')); }); b.on('click',f); b.style('cursor','pointer').style('color','black'); local_blocks.push(b); } e = ok.await('click',time_out); if (e.type === 'timeout') { alert('Het is de bedoeling dat u alle cijfers aanklikt die zojuist werden getoond in dezelfde volgorde.'); ok.await('click'); } if (digits_answer.length === 0) { alert("Het is de bedoeling dat u eerst de cijfers aanklikt die zojuist werden getoond en dan pas op OK klikt."); ok.await('click'); } for (i = 0; i < local_blocks.length; i++) { main.removeblock(local_blocks[i]); } return digits_answer; }