Parrot

Developer(s): Hal Renko, Sam Edwards
Date: 1983
Type: Program
Platform(s): TS 2068
Tags: Game

Parrot is a quick memory and reflex game. It draws a parrot’s head with arcs and circles and asks “Are you ready, parrot?”. When you press a key, a random letter is shown for a moment and then disappears. You have to type it back, like a parrot repeating what it heard. Each correct letter scores a point and brings up the next one. The round lasts ten seconds, after which the program shows your score and the time and asks if you want to play again.

The program is from the book Tantalizing Games for the Timex/Sinclair 2000 Series by Hal Renko and Sam Edwards (Addison-Wesley, 1983), and was typed in on a Larken disk with other games from the book.

Program Analysis

Drawing

Line 120 reads seven sets of DRAW x,y,a values from DATA line 1000. The third parameter of each DRAW draws an arc, which forms the head and beak. A short arc adds the eye, and a loop of CIRCLE commands with growing radius fills the pupil.

Timing

DEF FN t() reads the three-byte FRAMES counter at 23672 and divides it by 60 to give seconds. Each letter is CHR$ (97+25*RND). It is printed once, then replaced by a space while the program waits for that key.

Notable Techniques

  • Arcs drawn with the third parameter of DRAW.
  • A user-defined function that reads the FRAMES system variable as a seconds clock.
  • The letter is overwritten almost at once, so the game tests memory as well as speed.

Potential Issues

  • CHR$ (97+25*RND) never produces “z”.
  • The FRAMES-based clock assumes a 60 Hz machine.
  • Answering N to “Play again” jumps to line 9998, which on the disk loaded the Larken menu. In this version the program simply ends.

This copy came from a Larken disk. For tape, the LKDOS prefixes were removed from the SAVE and menu-load lines, and the saved variables were dropped. It was tested in ZEsarUX on a stock TS2068.

Image Gallery

Source Code

   10 REM    Parrot
   80 POKE 23658,0: PAPER 7: BORDER 7: INK 0
  100 CLS : RESTORE : PLOT 100,90
  120 FOR i=1 TO 7: READ x: READ y: READ a: DRAW x,y,a: NEXT i
  130 PLOT 89,139: DRAW 15,-10,-PI
  140 FOR i=0 TO 5 STEP .2: CIRCLE 95,131,i: NEXT i
  200 DEF FN t()=INT ((65536*PEEK 23674+256*PEEK 23673+PEEK 23672)/60): REM seconds since start
  210 PRINT AT 14,0;"Are you ready, parrot?": IF INKEY$="" THEN GO TO 210
  220 LET a=97: LET b=25: LET t1=FN t(): LET c=0
  230 LET x$=CHR$ (a+b*RND): LET a$=x$: PAUSE 1
  240 PRINT AT 16,15;x$;
  250 LET t2=FN t(): IF t2-t1>=10 THEN GO TO 300
  260 LET x$=" ": PAUSE 10: IF INKEY$<>a$ THEN GO TO 240
  270 LET c=c+1: GO TO 230
  300 PRINT AT 18,5;"Your score :";c
  310 LET t=INT (t2-t1): PRINT AT 19,5;"Time : ";t;" seconds"
  320 INPUT "Play again (Y/N)? ";a$
  330 IF a$="y" OR a$="Y" THEN GO TO 100
  340 IF a$="N" OR a$="n" THEN GO TO 9998
  350 GO TO 320
 1000 DATA -5,8,.5,-8,-2,1,5,7,-1,-10,-15,2,10,35,-3,40,5,-4,-15,-40,.5
 9992 SAVE "PARROT.B1" LINE 1
 9998 REM  was LKDOS-only

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.