Application Kata “n-back”
Write a program to do so called [n-back] tests [1] with.
A test person is presented with letters as a series of visual stimuli. For each stimulus she needs to decide whether the current stimulus is a repetition of the n-th previous one [1].
In the following example letters are marked which should be recognized as repetitions with n=3 (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
The parameters for a test are:
- Name of test person
- n (1..9)
- Duration of stimulus (msec): How long should a letter be presented for the test person to decide?
- Number of stimuli (10..100)
After a test the test person is presented with the percentage of correctly recognized stimuli. Correct means a letter was correctly recognized as a repetition or it was correctly recognized not to be a recognition.
Whether a stimulus is a repetition or not the test person should signal by clicking a button or pressing a key (e.g. space bar).
The test result will be written to a log file at the end. Example [2]:
Name=John Doe Duration=500 N=3 StartedAt=2013-05-16T18:34:23 Stimuli=TLHCHSCCQLCKLH... Answers=----!-!---!-!!...
A running test can be aborted at any time. A result is shown and the log written in any case.
While there is no test running a new one can be started.
Variations
While the test is running show the remaining time and the number of stimuli presented.
Resources
[n-back] Wikipedia, n-back, https://en.wikipedia.org/wiki/N-back
End notes
[1]Letters cannot just be presented in a random order because then repetitions would be too rare. Instead repetitions should be inserted explicitly into a letter sequence with a certain probability.
[2]Do not log correctness of answers but which answer was given, -=no repetition, !=repetition.