10 REM   *** GAME OF HANGMAN BY DAVE AHL, DIGITAL
20 REM   *** BASED ON A PROGRAM WRITTEN BY KEN AUPPERLE, CLASS OF '75,
30 REM   *** HALF HOLLOW HILLS H.S., DIX HILLS, NY
40 PRINT "GAME OF HANGMAN" \ PRINT  \ PRINT 
50 DIM P$(12,12),L$(20),D$(20),N$(26),U(50)
60 C=1 \ RANDOMIZE \ N=50
70 FOR I=1 TO 20 \ D$(I)="-" \ NEXT I \ M=0
80 FOR I=1 TO 26 \ N$(I)="" \ NEXT I
90 FOR I=1 TO 12 \ FOR J=1 TO 12 \ P$(I,J)=" " \ NEXT J \ NEXT I
100 FOR I=1 TO 12 \ P$(I,1)="X" \ NEXT I
110 FOR I=1 TO 7 \ P$(1,I)="X" \ NEXT I \ P$(2,7)="X"
120 IF C>=N THEN PRINT "YOU DID ALL THE WORDS!!" \ STOP
130 Q=INT(N*RND+1)
140 IF U(Q)=1 THEN 130
150 U(Q)=1 \ C=C+1 \ RESTORE  \ T1=0
160 FOR I=1 TO Q \ READ A$ \ NEXT I
170 L=LEN(A$) \ FOR I=1 TO L \ L$(I)=SEG$(A$,I,I) \ NEXT I
180 PRINT "HERE ARE THE LETTERS YOU USED:"
190 FOR I=1 TO 26 \ PRINT N$(I); \ IF N$(I+1)="" THEN 210
200 PRINT ","; \ NEXT I
210 PRINT  \ PRINT  \ FOR I=1 TO L \ PRINT D$(I); \ NEXT I \ PRINT  \ PRINT 
220 PRINT "WHAT IS YOUR GUESS"; \ INPUT G$ \ R=0
230 FOR I=1 TO 26 \ IF N$(I)="" THEN 260
240 IF G$=N$(I) THEN PRINT "YOU GUESSED THAT LETTER BEFORE" \ GO TO 180
250 NEXT I \ PRINT "PROGRAM ERROR.  RUN AGAIN." \ STOP
260 N$(I)=G$ \ T1=T1+1
270 FOR I=1 TO L \ IF L$(I)=G$ THEN D$(I)=G$ \ R=R+1
280 NEXT I \ IF R=0 THEN M=M+1 \ GO TO 410
310 FOR I=1 TO L \ IF D$(I)="-" THEN 330
320 NEXT I \ GO TO 400
330 PRINT  \ FOR I=1 TO L \ PRINT D$(I); \ NEXT I \ PRINT  \ PRINT 
340 PRINT "WHAT IS YOUR GUESS FOR THE WORD"; \ INPUT B$
350 IF B$=A$ THEN 370
360 PRINT "WRONG.  TRY ANOTHER LETTER." \ PRINT  \ GO TO 180
370 PRINT "RIGHT!!  IT TOOK YOU";T1;"GUESSES!"
380 PRINT "WANT ANOTHER WORD"; \ INPUT W$ \ IF W$="YES" THEN 70
390 PRINT  \ PRINT "IT'S BEEN FUN!  BYE FOR NOW." \ STOP
400 PRINT "YOU FOUND THE WORD!" \ GO TO 380
410 PRINT  \ PRINT  \ PRINT "SORRY, THAT LETTER ISN'T IN THE WORD."
420 ON M GO TO 430,440,450,460,470,480,490,500,510,520
430 PRINT "FIRST, WE DRAW A HEAD" \ GO TO 530
440 PRINT "NOW WE DRAW A BODY" \ GO TO 530
450 PRINT "NEXT WE DRAW AN ARM" \ GO TO 530
460 PRINT "THIS TIME IT'S THE OTHER ARM" \ GO TO 530
470 PRINT "NOW, LET'S DRAW THE RIGHT LEG" \ GO TO 530
480 PRINT "THIS TIME WE DRAW THE LEFT LEG" \ GO TO 530
490 PRINT "NOW WE PUT UP A HAND" \ GO TO 530
500 PRINT "NEXT THE OTHER HAND" \ GO TO 530
510 PRINT "NOW WE DRAW ONE FOOT" \ GO TO 530
520 PRINT "HERE'S THE OTHER FOOT -- YOU'RE HUNG!!"
530 ON M GO TO 540,560,570,580,590,600,610,620,630,640
540 P$(3,6)="-" \ P$(3,7)="-" \ P$(3,8)="-" \ P$(4,5)="(" \ P$(4,6)="."
550 P$(4,8)="." \ P$(4,9)=")" \ P$(5,6)="-" \ P$(5,7)="-" \ P$(5,8)="-" \ GO TO 650
560 FOR I=6 TO 9 \ P$(I,7)="X" \ NEXT I \ GO TO 650
570 FOR I=4 TO 7 \ P$(I,I-1)="\" \ NEXT I \ GO TO 650
580 P$(4,11)="/" \ P$(5,10)="/" \ P$(6,9)="/" \ P$(7,8)="/" \ GO TO 650
590 P$(10,6)="/" \ P$(11,5)="/" \ GO TO 650
600 P$(10,8)="\" \ P$(11,9)="\" \ GO TO 650
610 P$(3,11)="\" \ GO TO 650
620 P$(3,3)="/" \ GO TO 650
630 P$(12,10)="\" \ P$(12,11)="-" \ GO TO 650
640 P$(12,3)="-" \ P$(12,4)="/"
650 FOR I=1 TO 12 \ FOR J=1 TO 12 \ PRINT P$(I,J); \ NEXT J
660 PRINT  \ NEXT I \ PRINT  \ PRINT  \ IF M<>10 THEN 180
670 PRINT "SORRY, YOU LOSE.  THE WORD WAS ";A$
680 PRINT "YOU MISSED THAT ONE.  DO YOU" \ GO TO 380
690 DATA "GUM","SIN","FOR","CRY","LUG","BYE","FLY"
700 DATA "UGLY","EACH","FROM","WORK","TALK","WITH","SELF"
710 DATA "PIZZA","THING","FEIGN","FIEND","ELBOW","FAULT","DIRTY"
720 DATA "BUDGET","SPIRIT","QUAINT","MAIDEN","ESCORT","PICKAX"
730 DATA "EXAMPLE","TENSION","QUININE","KIDNEY","REPLICA","SLEEPER"
740 DATA "TRIANGLE","KANGAROO","MAHOGANY","SERGEANT","SEQUENCE"
750 DATA "MOUSTACHE","DANGEROUS","SCIENTIST","DIFFERENT","QUIESCENT"
760 DATA "MAGISTRATE","ERRONEOUSLY","LOUDSPEAKER","PHYTOTOXIC"
770 DATA "MATRIMONIAL","PARASYMPATHOMIMETIC","THIGMOTROPISM"
780 END
