CHESS CLOCK
by J.H. Wall
from ZX Computing Feb/Mar.1985

Use your ZX81 as an impartial time keeper when playing that
next game of chess! The Rev. J H Wall of Newcastle shows you how.


Fed up with thrashing "Grandmaster Chess" at level ten? Why
not take on a real live opponent - your son for instance (or
your old man - Ed.) You might show him a thing or two with
the old chess pieces even if you can't get near his score on
Galaxians! Here's a program to help you - help you play,
that is not win! It's a fully automatic chess clock.

I was driven to write CHESS CLOCK for our poor old dusty
ZX81 because I couldn't get near the Spectrum for all the
burnt out space ships. This program does all that a proper
chess clock would do, and much more besides. That could save
you #20 if you were buying one for home use.


Tournament clocks

The chess clock used in tournaments is just two cheap clock
movements joined together. A lever with two buttons allows
you to start one clock when you stop the other. Two little
flags show when you have run out of time.

This simple program copies the chess clock, but in digital
form. In addition, the program shows you how many moves you
still must make before your time runs out. When you have
made the required number of moves within the time allowed,
the program automatically adds your next ration of time and
the extra moves you have to make. Should you exceed the time
limit, the display informs you of the bad news; ie. you have
lost on time.


Program description

Lines 10-100 ask you to set the move rate, and the duration
of the first and subsequent sessions. Lines 110 to 292 set
up the initial values of the variables and create the
display. The 300s are the routines for updating the move
number and the actual clock for White. Black is catered for
in the same way in the 400s. 500 and 600 contain the bad
news if you lose on time. The routine at 800 updates the
variables when you have made all the moves required for one
session. Lines 900 to 920 enable you to stop both clocks
while you have tea or write down a sealed move.

The main problem in writing the program was to make both
digital clocks as accurate as possible. White's clock is
contained within lines 350-398, with Black's almost
identical routine in 450 to 498.

The use of PAUSE though obvious is far too crude and
actually doesn't allow for sufficiently accurate adjustment.
Satisfactory adjustment was achieved by the FOR-NEXT loop at
lines 372-376 (black 472-476) for basic setting, and by a
couple of dodges for fine tuning. Lines 371 and 471 have
extra spaces on the end of "STOP" which fractionally slow
the routine, and for Black's clock, line 474 - which
apparently prints nothing - gives a repeated adjustment in
the loop. Incidentally, PRINT AT 0,0 takes far more time
than PRINT AT 21,12 though I have no idea why! I would be
very interested to know if every ZX81 will work with the
same adjustments or whether you will need to make provisions
for your own machine. I achieved an accuracy of 1/5th of a
second in 5 minutes for both clocks.


How to use CHESS CLOCK

Set up your board with the ZX81, with the VDU on White's
left. Choose a move rate. 16 moves per hour is Grandmaster
stuff, 24 per hour is usual Club rate and novices probably
play at around 60 moves per hour!

Next, decide how long your playing session will be to the
first time-check. (Remember this is the time for each player
so the session could be twice as long).

Next, enter the length of the sessions after the first,
assuming the game isn't finished before you get that far!
The computer calculates how many moves each player must make
in the first session and then invites you to begin.

The display shows you how many moves are still to be made
and the time left for each player. When White has made his
first move he presses "1" which stops his clock and starts
Black's. Black then replies with a move and presses "0".
Tournament rules usually require you to use the same hand to
move the pieces and to press the clock.


Blitz chess

This popular form of chess, in which each player must make
all his moves in, say, 10 minutes, can be played by entering
a high move-rate; ie. 1000 per hour. The player who first
uses up his time is the loser, unless mate has been reached
first. Blitz is very good for sharpening your reactions and
for improving your sight of the board.


--
Another Fine Product transcribed by:
Jim Grimwood (jimg@globalnet.co.uk), Weardale, England
--
