Hangman (Syntax)

Developer(s): Richard Van Workum
Date: 1981
Type: Program
Platform(s): ZX80
Tags: Game

RUN and type the secret word at WORD?; the screen then shows a dash for each letter. The other player answers LETTER? one guess at a time. Right letters are filled in; each wrong letter is listed and adds a part to the gallows and the hanging figure. Guess the whole word and the program prints WINNER.

On the eleventh wrong guess the figure is complete and the program shows the word and stops. Words of up to 14 letters fit comfortably.

Published in Syntax May 1981 (Hangman).

Related Articles

ZX80 version of the 2 person spelling game, Hangman.

Image Gallery

Source Code

  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

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