'Reaction tester by Axel Nordin 'It should be fairly easy to create new tests, the only things you really need to include are in the PrintResults sub Tests=2 'Number of tests NumAttempts=5 'how many times each test will be carried out dim Average(Tests),Best(Tests),Worst(Tests),Errors(Tests) randomize timer gosub TestInkeyTime 'Tests your computer speed to make sure the test times are correct gosub SimpleReac 'Test one, simple reaction test gosub FindReac 'Test two, read,get the right key and press it gosub PrintResults 'Print out the results end SimpleReac: TheTest=1 'Which test is this? 'Print out the information: ? "Reaction Test ";TheTest;":" ? "Every time the circle changes color to red hit space" input "OK?(hit return to continue)" 'Paint the wait screen a second before the test starts forecolor 0,65535,0 fcircle 100,100,100 wait 1 'Wait 1 second for i=1 to NumAttempts 'how many times each test will be carried out 'Paint the wait screen cls forecolor 0,65535,0 fcircle 100,100,100 WT=rnd*4 'The random time to wait t=timer while timer-t"" then 'Check for cheating ' ? "Release key" : wait key up 'Removed because you can use it to cheat Errors(TheTest)=Errors(TheTest)+1 'Increment the errors made during the test end if wend 'Paint the go screen forecolor 65535,0,0 fcircle 100,100,100 ST=timer 'Start time wait key 'Wait until user responds TTime=timer-ST-InkeyTime 'This time, used later Time=Time+timer-ST-InkeyTime 'Total time for the test if TTimeWorst(TheTest) then Worst(TheTest)=TTime 'Check for worse time wait 1 next Average(TheTest)=Time/NumAttempts 'Calculate the average response time Time=0 'Reset the variable 'Time', used again later return FindReac: cls TheTest=2 ? "Reaction Test ";TheTest;":" ? "A number between 1 and 3(1,2,3) will be displayed hit the key '1' when the number 1 is displayed,2 when 2 is displayedŠ" input "OK?(hit return to continue)" cls forecolor 0,65535,0 textsize 50 : text 100,100,"Wait" wait 1 for i=1 to NumAttempts cls forecolor 0,65535,0 textsize 50 : text 100,100,"Wait" WT=rnd*4 t=timer while timer-t"" then ? "Release key" : wait key up end if wend c$=str$( int(rnd*3+1) ) forecolor 0,65535,0 cls textsize 50 : text 100,100,c$ ST=timer while inkey$<>c$ a$=inkey$ if a$<>"" and a$<>Last$ and a$<>c$ then Errors(TheTest)=Errors(TheTest)+1 Last$=a$ end if wend TTime=timer-ST-InkeyTime Time=Time+timer-ST-InkeyTime if TTimeWorst(TheTest) then Worst(TheTest)=TTime wait 1 Last$="" next Average(TheTest)=Time/NumAttempts Time=0 return PrintResults: for i=1 to Tests ? "Test: ";i:? ? "Errors (if you pressed the wrong key)";Errors(i) ? "Best time: ";Best(i) ? "Worst time: ";Worst(i) ? "Average time: ";Average(i) ? "----------------------------------------" next return TestInkeyTime: t=timer a$=inkey$ a$=inkey$ InkeyTime=timer-t return