The old game of Hangman can also be played on your ZX80. The program listed below preserves not only the battle of wits between the two players, but also draws on the graphics capabilities of the ZX80 to draw the figure for you. The program with full prompts on the screen requires over 1K, but it can be played on 1K by making the changes listed at the end of the program.
After typing in your program, press RUN and NEWLINE. The first player then types in a secret word of up to 17 characters. After clearing the screen, the computer will indicate by dashes how many letters the word has. The other player then attempts to guess the word by typing in letters most likely to be in the word. A right letter is placed in its correct position(s). A wrong or repeated letter is printed in the center of the screen and a body part is added to the figure on the gallows.
The game ends when the figure is completed or when the secret word is filled in.
Sample Runs
1. HANGMAN
INPUT SECRET WORD.
“SOFTWARE”
2.

SECRET WORD: ——–
3.

SECRET WORD: SOFTWARE
I N G C B M H P D (Player’s guesses)
YOU GUESSED IT.
THE WORD WAS: SOFTWARE
PLAY AGAIN?
“YES”
Hangman Program Listing
10 CLS
20 PRINT ,"##HANGMAN"
30 PRINT
40 PRINT
50 PRINT "INPUT SECRET WORD."
60 INPUT A$
70 CLS
80 PRINT "###TTTTTT" (6 shift T)
90 PRINT "###Q####A" (shift Q; shift A)
100 PRINT "###Q####A" (shift Q; shift A)
110 FOR A=1 TO 7
120 PRINT "########A" (shift A)
130 NEXT A
140 PRINT "AAAAAAAAAAAA" (12 shift A)
150 PRINT "AAAAAAAAAAAA" (12 shift A)
160 PRINT
170 PRINT
180 PRINT "SECRET WORD:##";
190 LET B$=A$
200 DIM A(17)
210 FOR E=0 TO 17
220 IF B$="" THEN GO TO 310
230 LET A(E)=CODE(B$)
240 PRINT "-";
250 LET B$=TL$(B$)
260 NEXT E
310 PRINT
320 PRINT
330 LET F=0
340 LET B$="#T2AG04CLNUY"
350 INPUT C$
360 LET B=0
370 FOR A=0 TO E-1
380 IF CODE(C$)=A(A) THEN GO SUB
500
390 IF E=F THEN GO TO 550
400 NEXT A
420 IF B THEN GO TO 350
430 PRINT CHR$(CODE(C));"#";
440 LET C=CODE(B$)
450 IF C>15 THEN LET C=C-10
460 POKE 34+PEEK(16396)+PEEK(16397)
*256+C,9
470 LET B$=TL$(B$)
480 IF B$="" THEN GO TO 590
490 GO TO 350
500 POKE 143+PEEK(16396)+PEEK(16397)
*256+A,CODE(C$)
510 LET A(A)=-1
520 LET F=F+1
530 LET B=1
540 RETURN
550 PRINT
560 PRINT
570 PRINT "YOU GUESSED IT."
580 GO TO 620
590 PRINT
600 PRINT
610 PRINT "YOU LOSE."
620 PRINT
630 PRINT "THE WORD WAS:#";A$
650 PRINT
660 PRINT "PLAY AGAIN?"
670 INPUT A$
680 IF CODE(A$)=62 THEN RUN
In the original listing the graphic characters are printed as underlined letters: the T, Q and A in lines 80-150 (as noted beside them) and the T, A and G in line 340 are underlined, i.e. shifted (graphic) characters.
This program may be converted for 1K by doing the following:
Delete lines 20-40 and 550-610
Change line 620 to: 620 CLS
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.