Unjumble Word Games

Author(s): C. Inman
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v4 n12 (Volume 4, Issue 12)
Date: December 1983
Pages: 22

Our local newspaper carries a scrambled word game. This program helps me unscramble any word.

RUN Unjumble in FAST. Until it fills, the screen blanks. For short words, hit BREAK to see the list. If you see no correct word, press CONT for more combinations. Successive screens take longer. In 2K, you can do at most 5 letters.

   1 REM UNJUMBLE BY C.INMAN
2 SLOW
5 PRINT AT 10,5;"INPUT THE WORD TO BE"
6 PRINT AT 11,9;"UNSCRAMBLED:"
10 INPUT A$
15 FAST
16 CLS
20 LET B=LEN A$
25 DIM C$(200,B)
30 DIM W$(B)
40 FOR C=1 TO B
50 LET W$(C)=A$(C)
60 NEXT C
95 LET R$=""
100 LET R=INT (RND*B)+1
110 IF W$(R)="/" THEN GOTO 100
120 LET R$=R$+W$(R)
130 IF LEN R$=B THEN GOTO 200
140 LET W$(R)="/"
150 GOTO 100
200 GOSUB 300
210 GOTO 40
300 LET E=0
320 LET E=E+1
330 IF R$=C$(E) THEN RETURN
340 IF CODE C$(E)<1 THEN LET C$(E)=R$
350 IF C$(E)=R$ THEN PRINT C$(E);
360 IF C$(E)=R$ THEN RETURN
370 GOTO 320
SYNTACTIC SUM: 33483, 8K ROM

This program isn’t fast, but it’s persistent. To avoid waiting forever for a new word that didn’t exist, I added this routine to count how many words the computer already came up with. With a word of n letters, you can make n! possible combinations. With a five-letter word, for example, 5! means 5*4*3*2*1, or 120.–AZ

   7 LET S=0
355 IF C$(E)=R$ THEN LET S=S+1
357 IF C$(E)=R$ THEN PRINT S
NEW SYNTACTIC SUM: 36919

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