Ive noticed TTFn has a few ZX80/81 programs that arent in the standard .O
and .P formats, so I thought I would convert them as appropriate so that
they can be used with the widest range of emulators. Ive attached new
versions of each program, although for some it was only necessary to rename
the file extension. [ PF ]

.TAP
No conversion necessary  website update required:
-HW83053011027Cypher(ZX81).TAP

This one confused me for a while (although I later recalled I have
originally submitted the files to you!). Then I noticed you also have the
program .P format in the download zip but the website only shows .TAP. So
you simply need to update the website to include .P format. The magazine
listing says the program can be used on the ZX81 or Spectrum, although only
presents conversion tips for the Spectrum version, so perhaps the program
should be listed under both the ZX81 and Spectrum with .TAP shown for the
Spectrum and .P shown for the ZX81? [ PF ]


--

CYPHER (1K ZX-81)
By Ray Elder
from Home Computing Weekly No. 11 (17 May 1983), pages 27-28

Can you crack the code before time runs out?

Your help is needed to decode secret cyphers from our agents, now MI5's
computer can't cope. Ray Elder sets the task

You are in charge of MI5's cypher decoding computer, represented by your ZX81,
with a 16K RAM pack, or Spectrum.

The messages which are fed into the computer from agents are words split into
two three-letter parts and the order of each part - the number combination -
will mean different things to your boss.

Unfortunately the computer is malfunctioning. Instead of showing a steady
display of work parts 1 to 16, it flashes each word up at random.

Time is also running out, so you can only have 16 attempts.

Can you match up the number of the two parts of each word... or is it the end
of civilisation as we know it?

Increase or decrease the number 16 in line 690 to make the game easier or harder.


Variables

Q$()  array holds 16 half words
A$()  array holds Q$ word halves in random order
S$    string of 32 spaces used to wipe a line of text
G     counter for number of goes
Y     variable used to hold various random numbers
S/T   used to determine print positions
A/B   hold inputs
L/K   flags to indicate results of input checks


How it works

10-30     dimension two string arrays to hold 16 three-letter groups, set up string of 32 spaces, set
          counter G (for guesses) to zero
40-190    store 16 parts of eight words in Q$(1-16)
200-230   clear screen, print message while word parts transferred to A$(1-16), set up loop of 16 passes
240-300   give Y random value of 1-16, if Y has had that value back to 240, if not transfer Q$(I), next I,
          clear screen
310-340   print numbers 1-4, 5-8, 9-12 and 13-16 across screen
400-430   print "key press" message 15 lines down, give Y random number 1-16, check if number previously
          correctly matched and if so GOTO 410 (A$(Y) is set to three spaces when correct match has been
          made - lines 800-810), duplicate value of Y in S
440-450   reduce value of S to less than 5 to position word horizontally
455-460   formulae to position word in exact horizontal and exact vertical (stored in T) location
470       print word part T rows down, S columns across
480-490   delay loop (stops flicker when using PAUSE), increase/decrease TO value to alter display time
500-640   print request for number at row 15, get input (A), "wipe" first input message, print request for
          second input at row 17, "wipe" second input, allocate to C$ both chosen word parts as single
          word
650-700   loop 1-16 in steps of two, compare C$ with correct word part combinations, if match found GOSUB
          to "correct" routine, next (check), check flag, if match not found K=0, so GOSUB to "wrong"
          routine, increase guesses counter by one, check allowed number of tries, if all used GOTO "lose"
          routine, return to word part routine
800-810   clear the two random word part stores so they are not printed
830-860   print correct message at row 16, set "game complete" flag (L) to 0, set up 1-16 loop, check each
          array A$() - if any contain a word set flag L to 1, next array check, wipe "correct" message
870-890   check L flag, if zero all word parts have been correctly matched so jump to "win" routine, set K
          (correct guess) flag to 1, return to main program
900-910   print "wrong" message, jump to 835 to use existing code as delay and return, to save re-writing
          wipe, return etc
1000-1170 clear screen, print "lose" messages, jump to 1050 for replay option, clear screen, print "win"
          messages, print replay option messages, if no ley pressed keep checking by going back to 1160,
          if key pressed RUN program