Friday 1 April 2011

Empirical Rabbit Timer

Measuring my solution times with a stopwatch, entering them into a spreadsheet and constructing a histogram from the results was a laborious task, so I decided to write a Java program to do the work for me.  This program brings up a window giving me the number of the next problem to be solved and asks whether I am ready:












Hitting any key (except “s”, which I will address shortly) starts the clock and takes me to the next screen:












Hitting “t” displays the time that I have spent so far (shown as on the next screen).  Hitting any other key takes me to the next screen:












Hitting 0 or 1 (to indicate the result) records the problem number, the time spent solving the problem and the result - the program then increments the problem number and takes me back to the first screen.  Hitting “r” (for redo) takes me back to the first screen without incrementing the problem number, and resets and restarts the clock (e.g. because I have just realised that it is Black and not White to move).  Hitting “b” takes me back to the previous screen, without having stopped the clock.  Hitting any other key results in an error beep.

I usually find it most convenient to use the Enter key on the numeric key pad to navigate between the first two screens.  The Enter key then functions like the start/stop button on a stopwatch (except that I can use the “b” key to undo the action of hitting Enter).  In the normal course of events, I simply press Enter twice to start and stop the clock, and type 0 or 1 to indicate whether or not I got the right answer.  (I do not usually see the second screen, because I am looking at the problem.)  The results are written as comma separated values, so that I can easily import them into a spreadsheet.  Hitting “s” (for statistics) on the first screen adds the number of solution times falling within each histogram “bucket” to the results.

This was my first Java program.  I learned sufficient Java to write it using Rogers Cadenhead’s Sams Teach Yourself Java in 24 Hours (which was cheap and had good reviews on Amazon).  I used the free NetBeans and JDK development tools.  The Empirical Rabbit Timer currently runs in NetBeans, and writes its output to the console. [See my later article Rabbit Timer Revamped for the improvements that I made to this program.]

No comments:

Post a Comment