1000 Remarkable Hangman program by Michael McIntyre
1100 DIM U(26),D%(400),L$(20)
1200 FOR I=1 TO 400 \ D%(I)=0 \ NEXT I
1210 D1%=0
1230 T7$=CHR$(ASC("Q")-64) \ T8$=CHR$(ASC("S")-64)
1235 A=SYS(7,1) \ REM Disable lowercase
1240 A=TTYSET(255,255) \ REM NOMARGIN #0
1500 PRINT CHR$(27);"[1;10H";CHR$(27);"[2J";CHR$(27);"#3";"Welcome to Hangman !"
1510 PRINT CHR$(27);"[2;10H";CHR$(27);"#4";"Welcome to Hangman !"
2000 DEF FNP$(L,C)=E$+"["+STR$(L)+";"+STR$(C)+"H"
2010 DEF FNM$(M$)=FNP$(24,1)+W$+M$+C2$
2100 E$=CHR$(27) \ U$=CHR$(95) \ D$=CHR$(10)
2110 C1$=E$+"[2J" \ O$=CHR$(15) \ N$=CHR$(14) \ B$=CHR$(8) \ S$=CHR$(92)
2120 P$(1)=FNP$(10,63)+N$+"lvk"+B$+B$+B$+D$+"mwj"+O$
2130 P$(2)=FNP$(12,64)+N$+"x"+B$+D$+"x"+B$+D$+"x"+O$
2140 P$(3)=FNP$(15,63)+"/"+B$+B$+D$+"/"+B$+B$+D$+"/"
2150 P$(4)=FNP$(15,65)+S$+D$+S$+D$+S$
2160 P$(5)=FNP$(10,61)+S$+D$+S$+D$+S$
2170 P$(6)=FNP$(10,67)+"/"+B$+B$+D$+"/"+B$+B$+D$+"/"
2180 P$(7)=FNP$(17,60)+N$+"s"+O$
2190 P$(8)=FNP$(17,68)+N$+"s"+O$
2200 P$(9)=FNP$(10,60)+N$+"o"+O$
2210 P$(10)=FNP$(10,68)+N$+"o"+O$
2220 W$=E$+"#6" \ C2$=E$+"[0K"
2230 Q$="qqqqqqqqqq"
2240 S$(1)="First we draw the head."
2250 S$(2)="Now comes the body."
2260 S$(3)="Let's put a leg next."
2270 S$(4)="And another leg."
2280 S$(5)="There goes the left arm."
2290 S$(6)="Oh my, another arm."
2300 S$(7)="Let's add a foot now."
2310 S$(8)="Gee, another foot!"
2320 S$(9)="Come on, there's one hand left!"
2330 S$(10)="Now you're hung!"
2340 O$(1)="once." \ O$(2)="twice." \ O$(3)="three times." \ O$(4)="four times."
2350 O$(5)="five times." \ O$(6)="six times."
2360 FOR D9=1 TO 3000 \ NEXT D9 \ REM SLEEP 3
2500 PRINT E$+"<"+E$+")0"
2510 RESTORE  \ READ N \ RANDOMIZE
2511 IF D1%<N THEN 2515
2512 PRINT C1$+FNM$("That is the whole list!")
2513 FOR D9=1 TO 3000 \ NEXT D9 \ REM SLEEP 3
2514 GO TO 30000
2515 K=INT(RND*N+1) \ IF D%(K)<>0 THEN 2515
2517 D%(K)=1 \ D1%=D1%+1%
2520 FOR I=1 TO K \ READ A1$ \ NEXT I
2530 A$="" \ FOR I=1 TO LEN(A1$) \ A$=A$+CHR$(ASC(SEG$(A1$,I,I))-1)
2532 L$(I)=SEG$(A$,I,I) \ NEXT I
2535 L=LEN(A$) \ G=0 \ U=0
2540 PRINT C1$; \ GOSUB 25000 \ REM display frame
2550 PRINT FNP$(24,1);W$;"The word has ";STR$(L);" letters.";
2560 PRINT FNP$(2,1);W$
2565 FOR I=1 TO 26 \ U(I)=0 \ NEXT I
2570 PRINT FNP$(4,1);W$; \ FOR I=1 TO L \ PRINT " ";U$; \ NEXT I
2580 PRINT FNP$(1,1);W$;"You have used the following letters:"
2600 PRINT FNP$(6,1);W$;"What is your guess";C2$;
2610 PRINT T7$; \ INPUT G$ \ PRINT T8$; \ REM G$=EDIT$(G$,127)
2615 IF G$="" THEN 2600
2620 IF G$=A$ THEN 3100
2630 IF LEN(G$)=1 THEN 2640
2631 IF LEN(G$)<>L THEN 2636
2632 PRINT FNM$(G$+" is not the word.");
2635 GO TO 2910
2636 PRINT FNM$("The word has "+STR$(L)+" letters.");
2637 GO TO 2600
2640 C$=SEG$(G$,1,1) \ C=ASC(C$)-64
2643 IF C>=1 THEN IF C<=26 THEN 2650
2645 PRINT FNM$("Try a letter or a word.");
2647 GO TO 2600
2650 IF U(C)=0 THEN 2680
2660 PRINT FNM$("That letter has already been used.");
2670 GO TO 2600
2680 U(C)=1 \ U=U+1 \ D=0 \ Z=0
2690 FOR I=1 TO L \ IF L$(I)="" THEN 2750
2700 IF L$(I)<>G$ THEN 2745
2710 PRINT FNP$(4,I*2);G$;
2720 Z=Z+1
2730 L$(I)=""
2740 GO TO 2750
2745 D=1
2750 NEXT I
2760 IF D=0 THEN 3100
2800 IF U>1 THEN PRINT FNP$(2,2*U-1);",";
2810 PRINT FNP$(2,2*U);G$
2870 IF Z=0 THEN 2900
2880 PRINT FNM$(G$+" is in the word "+O$(Z));
2885 IF D=0 THEN 3100
2890 GO TO 2600
2900 PRINT FNM$(G$+" is not in the word.");
2910 FOR D9=1 TO 1000 \ NEXT D9 \ REM SLEEP 1
2920 G=G+1
2930 PRINT FNM$(S$(G));
2940 FOR D9=1 TO 1000 \ NEXT D9 \ REM SLEEP 1
2945 PRINT FNP$(12,12);" ";
2950 PRINT P$(G)
2960 IF G<10 THEN 2600
2970 FOR D9=1 TO 2000 \ NEXT D9 \ REM SLEEP 2
2980 PRINT FNM$("The word was: "+A$)
2985 FOR D9=1 TO 2000 \ NEXT D9 \ REM SLEEP 2
3000 PRINT FNP$(4,1);C1$;W$;"Would you like to play again";
3010 PRINT T7$; \ INPUT A$ \ PRINT T8$; \ REM A$=EDIT$(A$,127)
3020 IF SEG$(A$,1,1)<>"N" THEN 2500
3030 PRINT FNM$("Bye, Bye and don't hang around long!")
3040 FOR D9=1 TO 3000 \ NEXT D9 \ REM SLEEP 3
3050 PRINT C2$;T7$
3060 GO TO 30000
3100 PRINT FNM$("That's right!");
3110 FOR D9=1 TO 2000 \ NEXT D9 \ REM SLEEP 2
3120 GO TO 3000
10000 DATA 216
10010 DATA QPMBSJUZ,NJOJN,MBUFOU,HMBNNFS,FTUPQ,DPSSVQUJPO,UPBTU,PWFSTIPPU
10020 DATA EPH,DBU,IPSTF,NFBUMPBG,CBMPHOB,DPOEJUJPOFS,DIBJ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OEFS,GMVUF,GBWPSJUF,GBMDPO,ESFEHF
10190 DATA EJWJOFS,EFDMBJN,DPOWPLF,DPOGFS,DMJOH,CVSSPX,CSJTUMJOH,CFTUPX
10200 DATA BXBLF,BQQFSUBJO,BNCFS,BGSBJE,BDDFMFSBUPS,MJOFBS,BCPMJTI
10210 DATA SFTPVSDF,GPSUVOBUF,QJMMCPY,QPJHOBOU,MPWJOH,DISPOJDBM,OPSUIFSO
10220 DATA DPOWVMTF,RVBIPH,NBOHSPWF,JHOJUJPO,HJSUI,NBOIPMF,MFBUIFSOFDL
10230 DATA TBVFSLSBVU,QSPQSJFUZ,LOPVU,NBMBEKVTUFE,NFTTFOHFS,IJSF,OBWZ,OPC
10240 DATA MBUUFS,OJUSPHMZDFSJO,TUBNQFEF,OFUIFS,GMJQQBOU,FYIBVTUJPO
10250 DATA CVGGPPO,IBSNPOJD,IBSL,JOUFSNJOHMF,JOFRVJUZ,FUIBOF,OJUSBUF
10260 DATA MVCSJDBUF,OJY,IBSFN,NPMMJGZ,MBVE,HFPNFUSZ,EPDVNFOU,PWFSTUBUF
10270 DATA QSPTUSBUF,IBSFMJQ,EBN,HFOVGMFDU,FEJDU,FEJU,TVSFUZ,EJSFDUPSZ
10280 DATA IZQFSUSPQIZ,IZQPDIPOESJBD,DBEBWFS,SBUMJOF,GPSUZ,QVOL,TDVGGMF
10290 DATA TDVMMJPO,TDPSCVUJD,IBOHNBO,TDSFXESJWFS,GMVUF,TQBSL,SIPNCPJE
10300 DATA SIPEPEFOESPO
20000 GO TO 20000
25000 PRINT FNP$(21,53);N$;"lq";Q$;Q$;"vvqk";FNP$(22,78);"x"
25010 PRINT FNP$(23,53);"m";Q$;Q$;"qqqqj";FNP$(22,53);"x";
25020 PRINT FNP$(9,75); \ FOR I=9 TO 20 \ PRINT "xx"+B$+B$+D$; \ NEXT I
25030 PRINT FNP$(7,63);"l";Q$;"qqqqk";FNP$(8,63);"mw";Q$;"wwqj";FNP$(9,64);"x"
25040 PRINT O$
25050 RETURN
30000 A=TTYSET(255,73) \ A=SYS(7,0)
30010 END
