` ANTIC VOL. 3, NO. 5 / SEPTEMBER 1984`

# TELLING TIME IN PILOT

## Easy educational program - only 104 lines

by RICHARD SELTZER

SYNOPSIS
This is a simple and well-documented program to teach children to tell time using three levels of difficulty.  Best of all, it's only 104 lines long and runs on all Atari computers.  Antic Disk subscribers simply LOAD D:TIME.PLT [RETURN]. Now type RUN.

In "Turtle Sketch Pad" in the December 1983 Antic, it was interesting to see how to use PEEK and POKE-type commands in PILOT to get results similar to programs written in BASIC.
But the real power and value of PILOT comes from its simplicity.  Programs that stick to PILOT (without all the PEEKs and POKES) can be written and rejuggled right at the keyboard and can be understood at a glance.
In other words, for question and answer kinds of drills and exercises, teachers or parents can write programs in PILOT as easily as they might prepare worksheets or handouts.  PILOT programs are a very do-it-yourself medium.
The following program illustrates the power and simplicity of PILOT with Turtle Graphics.  I wrote it for my daughter Heather, age six, who wanted practice in telling time.  It provides three levels of difficulty-hours alone, quarter hours, and five minute increments-all in just 104 short instructions.

PROGRAM NOTES
PILOT's TURN and TURNTO commands, using the 360 degrees of a circle, are well suited to drawing lines radiating from a center point, like the hands of a clock.  For instance, for the hour hand, we pick a random number from 0 to 11 (line 170), set 0 equal to 12 (line 180).  Then (in line 200) we go to the center of the screen(0,0), and from the straight up position (TURNTO 0 in line 190) turn 30 degrees times the number of the hour and draw a line 15 units long (just a bit shorter than the minute hand, which we arbitrarily made 20 units long in line 190),
For the Quarter Hour version, we add an extra line (line 390) so the hour hand realistically moves ahead a quarter of 30 degrees (or 15/2) for each quarter hour beyond the hour.  Similarly for the five minute version (line 590), the hour hand moves ahead a twelfth of 30 degrees (5/2) for each five minute increment beyond the hour.
Using the clock hands alone, without the numbers, made the games more interesting to play and also greatly simplified the programming.
Variables:
#H=the hour, a random number from 0 to 11
#Q=the quarter hour, a random number from 0 to 3
#M=the five minute increment, a random number from 0 to 11
#N=the quarter or the five minute increment translated to minutes
#R=the number of questions answered right
#T=the number of questions asked (a game is 12 questions)
In the five minute version, if the correct answer was 5:05, with the standard format of #H:#M the program would expect an answer of 5:5.  So in line 660, we add a match of #H:05, so the right answer is recognized as right.  Also, when the answer is an exact hour, the natural inclination is to type just the number of the hour, without a colon and zeroes.  Lines 460 and 670 make sure that that, too, will be accepted as a match.

Richard Seltzer is the author of two children's books, The Lizard of Oz and Now and Then and other Tales from Ome. He lives in West Roxbury, Mass.

Listing: TIME.PLT Download / View

10 T:WHAT'S YOUR NAME?
20 A:\$NAME
30 GR:CLEAR
40 *CIRCLE
50 GR:PEN RED;GOTO 0,0;TURNTO #X;GO 25
60 C:#X=#X+l
70 J(#X<>360):*CIRCLE
80 *START
90 C:#R=0
100 C:#T=0
110 T:DO YOU WANT TO PLAY HOURS (H), Q
UARTER HOURS (Q) OR FIVE MINUTES (M)?
(TYPE H,Q, OR M)
120 A:
130 M:H,Q,M
140 JM:*HOUR,*QUARTER,*MINUTE
150 JN:*START
160 *HOUR
170 C:#H=?\12
180 C(#H=0):#H=12
190 GR:GOTO 0,0;TURNTO 0;PEN YELLOW;DR
AW 20
200 GR:GOTO 0,0;TURNTO #H*30;DRAW 15
210 GR:PEN RED;GOTO 0,0
220 T:
230 T:WHAT TIME IS IT, \$NAME? (JUST TY
PE THE HOUR)
240 A:
250 M:#H
260 C:#T=#T+l
270 TN:NO, IT'S REALLY #H. GOOD LUCK 0
N THE NEXT ONE, \$NAME.
280 PAN:150
290 UY:*RIGHT
300 GR:GOTO 0,0;TURNTO #H*30;PEN ERASE
;DRAW 15
310 J(#T<12):*HOUR
320 GR(#T=12):GOTO 0,0;TURNTO 0;PEN ER
ASE;DRAW 20
330 J(#T=12):*REPLAY
340 *QUARTER
350 C:#H=?\12
360 C(#H=0):#H=12
370 C:#Q=?\4
380 C:#N=15*#Q
390 GR:GOTO 0,0;TURNTO #H*30;TURN #Q*(
15/2);PEN YELLOW;DRAW 15
400 GR:GOTO 0,0;TURNTO #Q*90;DRAW 20
410 GR:PEN RED;GOTO 0,0
420 T:
430 T:WHAT TIME IS IT, \$NAME? (USE THE
FORM 9:15, 10:30, ETC.)
440 A:
450 M:#H:#N
460 M(#Q=0):#H
470 C:#T=#T+l
480 UY:*RIGHT
490 UN:*ANSWER
500 GR:GOTO 0,0;TURNTO #H*30;TURN #Q*(
15/2);PEN ERASE;DRAW 15
510 GR:GOTO 0,0;TURNTO #Q*90;DRAW 20
520 J(#T<12):*QUARTER
530 J(#T=12):*REPLAY
540 *MINUTE
550 C:#H=?\12
560 C(#H=0):#H=12
570 C:#M=?\12
580 C:#N=#M*5
590 GR:GOTO 0,0;TURNTO #H*30;TURN #M*(
5/2);PEN YELLOW;DRAW 15
600 GR:GOTO 0,0;TURNTO #M*30;DRAW 20
610 GR:PEN RED;GOTO 0,0
620 T:
630 T:WHAT TIME IS IT, \$NAME? (USE THE
FORM 5:25, 12:05, ETC.)
640 A:
650 M:#H:#N
660 M(#N=5):#H:05
670 M(#N=0):#H
680 C:#T=#T+l
690 UY:*RIGHT
700 UN:*ANSWER
710 GR:GOTO 0,0;TURNTO #H*30;TURN #M*(
5/2);PEN ERASE;DRAW 15
720 GR:GOTO 0,0;TURNTO #M*30;DRAW 20
730 J(#T<12):*MINUTE
740 J(#T=12):*REPLAY
750 *RIGHT
760 T:RIGHT!
770 C:#R=#R+l
780 SO:13
790 PA:15
800 SO:17
810 PA:15
820 SO:20
830 PA:15
840 SO:25
850 PA:30
860 SO:0
870 E:
880 *ANSWER
890 T(#N=0):NO, IT'S #H:00. GOOD LUCK
ON THE NEXT ONE, \$ NAME.
900 PA(#N=0):150
910 E(#N=0):
920 T(#N=5):NO, IT'S #H:05. GOOD LUCK
ON THE NEXT ONE, \$NAME .
930 T(#N<>5):NO IT'S #H:#N. GOOD LUCK
ON THE NEXT ONE, \$NAME.
940 PA:150
950 E:
960 *REPLAY
970 T:VERY GOOD, \$NAME. OUT OF 12, YOU
GOT #R RIGHT. WANT TO PLAY SOME MORE?
980 A :
990 M:Y,YES
1000 JM:*START
1010 JN:*END
1020 *END
1030 T:GOODBYE, \$NAME.
1040 E: