Hangman

Author(s): Richard Van Workum
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v2 n5 (Volume 2, Issue 5)
Date: May 1981
Pages: 3

This program is a ZX80 version of the 2 person spelling game, Hangman. To use, type in the program then hit RUN (NL). While the second player looks away, type in a mystery word or expression and hit (NL). The second player sees a series of blanks, each representing one character. Guess a letter by pressing that key and then (NL). If you’re right, ZX80 fills in all blanks for that letter. If you’re wrong, it displays your incorrect guess and adds another part to the man. The game continues until you fill all the blanks, or you hang the man. Maximum word or phrase length is 14 characters. You don’t have to guess spaces. Graphics: Line 80 shift Q; Line 301 5 shift W shift D; Line 400 5 spaces shift Q: Line 412 shift A; Line 416 5 spaces shift A; Line 418 4 spaces X 1 space.

(Note: I put in a 36 character phrase and it worked fine.–AZ)

  10 PRINT "WORD?"
15 INPUT A$
40 LET Z=0
50 DIM T(25)
55 DIM D(11)
60 FOR X=0 TO 25
65 LET T(X)=220
70 NEXT X
80 LET G$="▌"
100 CLS
104 LET A=0
105 LET Q=0
106 LET N=0
110 LET T$=A$
115 LET X=CODE(T$)
120 LET N=N+1
122 IF NOT CODE(T$)=CODE(G$) THEN LET A=A+1
125 IF X<30 OR X>63 THEN GO TO 170
130 PRINT CHR$(T(X-38));
135 IF T(X-38)=220 THEN LET Q=Q+1
140 LET T$=TL$(T$)
160 GO TO 115
170 IF X=1 THEN GO TO 190
175 PRINT CHR$(X);
180 GO TO 140
190 PRINT
191 IF Q=0 THEN GO TO 520
195 IF A=N THEN GO SUB 250
196 GO TO 301
200 PRINT "LETTER?"
210 INPUT G$
220 LET T(CODE(G$)-38)=CODE(G$)
230 GO TO 100
250 LET Z=Z+1
251 LET D(Z-1)=CODE(G$)
252 RETURN
301 PRINT "▄▄▄▄▄▖"
303 LET R=0
304 FOR K=1 TO Z
305 GO SUB 400+R
306 LET R=R+2
307 NEXT K
308 PRINT
310 FOR L=1 TO Z
311 PRINT CHR$(D(L));
312 NEXT L
313 PRINT
315 GO TO 200
400 PRINT " ▌"
401 RETURN
402 PRINT " )";
403 RETURN
404 PRINT "O";
405 RETURN
406 PRINT "("
407 RETURN
408 PRINT " +"
409 RETURN
410 PRINT " V";
411 RETURN
412 PRINT "▒";
413 RETURN
414 PRINT "V"
415 RETURN
416 PRINT " ▒"
417 RETURN
418 PRINT " X ";
419 RETURN
420 PRINT "X"
421 PRINT
500 PRINT A$
501 STOP
520 PRINT "WINNER"
521 STOP
SYNTACTIC SUM= 980

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