Application Kata "n-back"
Develop a program with which a so-called [n-back test] can be carried out.
The subject is presented with a sequence of letters as visual stimuli. For each stimulus, they have to decide whether the current stimulus matches the nth previous stimulus [1].
In the following example, the letters markedwhich should be recognized as repetitions at 3-back:
T L H C H S C C Q L C K L H C Q T R R K C H R
For a new test must be specified:
- Name of the test person
- n (1..9)
- Stimulus duration: How long should each stimulus be presented? (in msec)
- Number of stimuli (10..100)
At the end of the test, the subject is presented with the percentage of correct decisions as a result. The decision is correct if it recognizes a repetitive stimulus, but also if it does not indicate a repetition where there is none.
The respondent is asked to indicate whether a stimulus is repeated by clicking a button or pressing a key (e.g. space bar).
The progress of a test is written to a log file at the end. Example [2]:
Test person=Peter Müller Stimulus duration=500 N=3 Start=2013-05-16T18:34:23 Stimuli=TLHCHSCCQLCKLH... Answers=NNNNJNJNNNJNJJ...
A test in progress can be aborted at any time. Even then, a result is shown and a log is written.
If no test is currently running, a new one can be started.
Variation #1
During the test, display the remaining duration and the number of stimuli presented.
Endnotes
[1] The letters cannot simply be chosen at random. Then repetitions would occur too rarely. It should therefore also be decided at random when a repetition takes place.
[2] It is not the correctness of the answers that is recorded, but which answer was given: N=no repetition, Y=repetition.