Apple-1-Mini/code/programs/BASIC/HANGMAN.TXT

124 lines
5.3 KiB
Plaintext

LOMEM=1024
HIMEM=8192
SCR
10 PRINT " HANGMAN"
20 PRINT "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
22 REM PORTED TO REPLICA/1 BY CARL CLAUNCH
25 PRINT:PRINT:PRINT
30 DIM P$(145),D$(20),N$(26),U(50),A$(19)
35 DIM S$(145),V$(255),V(50),Z$(85)
40 C=1:N=50
50 FOR I=1 TO 20:D$(I)="-":NEXT I:M=0
55 GOSUB 700 : REM REINITIALIZE THE WORD ARRAYS
70 P$="XXXXXXX " : REM SET UP EMPTY SCAFFOLD
80 P$(13)="X X "
90 FOR I=2 TO 11:P$(I*12+1)="X ":NEXT I
94 N$="" : REM NO LETTERS YET
95 IF C<N THEN 100
97 PRINT "YOU USED UP ALL THE WORDS!!":GOTO 999
100 Q=RND(50)+1 : REM PICK ONE OF THE 50 WORDS
110 IF U(Q)=1 THEN 100 : REM BUT NOT IF ALREADY USED
115 C=C+1:T1=0 : REM KEEP TRACK OF WORDS AND TRIES
120 IF Q<44 THEN 150 : REM WORDS KEPT IN TWO STRINGS AS > 255
125 A$=Z$(V(Q),V(Q)+U(Q)-1):U(Q)=1 : REM FETCH WORD IN 1ST STR
130 GOTO 160
150 A$=V$(V(Q),V(Q)+U(Q)-1):U(Q)=1 : REM FETCH WORD IN 2ND STR
160 L=LEN(A$)
170 PRINT "HERE ARE THE LETTERS YOU USED:"
180 FOR I =1 TO 26:IF LEN(N$)>=I THEN PRINT N$(I,I);:IF I=LEN(N$) THEN I=27
190 IF I<LEN(N$) THEN PRINT ",";:NEXT I
200 PRINT:PRINT:PRINT D$(1,L):PRINT:PRINT
210 INPUT "WHAT IS YOUR GUESS",S$:R=0:S$(LEN(S$)+1)=" ":G$=S$(1,1)
215 IF G$=" " THEN 210 :REM TRY AGAIN IF NULL ENTRY
220 A=0:FOR I=1 TO LEN(N$)
225 IF LEN(N$)=0 THEN 240
230 IF G$#N$(I,I) THEN 240
235 PRINT "YOU GUESSED THAT LETTER BEFORE!":A=1: I=26
240 NEXT I: IF A=1 THEN 170 : REM DID WE HAVE A DUPLICATE? ERROR
250 N$(LEN(N$)+1)=G$:T1=T1+1 : REM ADD LETTER AND BUMP TRY COUNT
260 FOR I=1 TO L:IF A$(I,I)=G$ THEN 280 : REM LOOK FOR A MATCH
270 NEXT I: IF R=0 THEN 290 : REM R IS THE NUMBER OF MATCHES THIS TIME
275 GOTO 300
280 S$=D$(I):D$(I)=G$:R=R+1:IF I=26 THEN 270
285 D$(I+1)=S$(2):GOTO 270
290 M=M+1:GOTO 400 : REM DIDN'T FIND A MATCH, GO GIVE NEWS
300 A=0:FOR I=1 TO L:IF D$(I,I)="-" THEN A=1
310 NEXT I: IF A=0 THEN GOTO 390 :REM A 1 IF WE HAVE HIDDEN LTRS
320 PRINT:PRINT D$(1,L): PRINT:PRINT
330 INPUT "WHAT IS YOUR GUESS FOR THE WORD?",S$
340 IF A$=S$ THEN 360
350 PRINT "WRONG. TRY ANOTHER LETTER.":PRINT:GOTO 170
360 PRINT "RIGHT! IT TOOK YOU ";T1;" GUESSES!"
370 INPUT "ENTER YES IF YOU WANT ANOTHER WORD:",S$: IF S$="YES" THEN 50
380 PRINT:PRINT"IT'S BEEN FUN. BYE FOR NOW.":GOTO 999
390 PRINT "YOU FOUND THE WORD!":GOTO 370
400 PRINT:PRINT:PRINT "SORRY, THAT LETTER ISN'T IN THE WORD."
410 GOTO 410+5*M :REM M IS THE NUMBER OF MISSES SO FAR
415 PRINT "FIRST, WE DRAW A HEAD":GOTO 470
420 PRINT "NOW WE DRAW A BODY.":GOTO 470
425 PRINT "NEXT WE DRAW AN ARM.":GOTO 470
430 PRINT "THIS TIME IT'S THE OTHER ARM.":GOTO 470
435 PRINT "NOW, LET'S DRAW THE RIGHT LEG.":GOTO 470
440 PRINT "THIS TIME WE DRAW THE LEFT LEG.":GOTO 470
445 PRINT "NOW WE PUT UP A HAND.":GOTO 470
450 PRINT "NEXT THE OTHER HAND.":GOTO 470
455 PRINT "NOW WE DRAW ONE FOOT":GOTO 470
460 PRINT "HERE'S THE OTHER FOOT -- YOU'RE HUNG!!"
470 GOTO 470+10*M : REM M IS THE NUMBER OF MISSES SO FAR
480 X$="-":X=3:Y=6:GOSUB 900:Y=7:GOSUB 900:Y=8:GOSUB 900
481 X$="(":X=4:Y=5:GOSUB 900:Y=6:X$=".":GOSUB 900
482 Y=8:GOSUB 900:Y=9:X$=")":GOSUB 900:X=5:Y=6:
483 X$="-":GOSUB 900:Y=7:GOSUB 900:Y=8:GOSUB 900:GOTO 580
490 X=6:Y=7:X$="X":GOSUB 900:X=7:GOSUB 900:X=8:GOSUB 900
495 X=9:GOSUB 900:GOTO 580
500 X=4:Y=3:X$="\":GOSUB 900:X=5:Y=4:GOSUB 900
505 X=6:Y=5:GOSUB 900:X=7:Y=6:GOSUB 900:GOTO 580
510 X$="/":X=4:Y=11:GOSUB 900:X=5:Y=10:GOSUB 900
515 X=6:Y=9:GOSUB 900:X=7:Y=8:GOSUB 900:GOTO 580
520 X$="/":X=10:Y=6:GOSUB 900:X=11:Y=5:GOSUB 900:GOTO 580
530 X$="\":X=10:Y=8:GOSUB 900:X=11:Y=9:GOSUB 900:GOTO 580
540 X$="\":X=3:Y=11:GOSUB 900:GOTO 580
550 X$="/":X=3:Y=3:GOSUB 900:GOTO 580
560 X$="\":X=12:Y=10:GOSUB 900:Y=11:X$="-":GOSUB 900:GOTO 580
570 X$="-":X=12:Y=3:GOSUB 900:Y=4:X$="/":GOSUB 900
580 FOR I=0 TO 11 : REM LOOP LINE BY LINE
584 PRINT P$(I*12+1,(I+1)*12) : REM PRINT LINE
588 NEXT I
590 PRINT:PRINT:IF M#10 THEN 170
600 PRINT "SORRY, YOU LOSE. THE WORD WAS ";A$
610 PRINT "YOU MISSED THAT ONE. DO YOU ";:GOTO 370
620 INPUT "TYPE YES OR NO",Y$: IF Y$="YES" THEN 50
699 REM V$,Z$ ARE WORD STRINGS. V IS INDEX OF WORD, U IS LENGTH
700 V$ = "GUMSINFORCRYLUGBYEFLY"
705 U(1)=3:U(2)=3:U(3)=3:U(4)=3:U(5)=3:U(6)=3:U(7)=3
710 V$(LEN(V$)+1)="UGLYEACHFROMWORKTALKWITHSELF"
715 U(8)=4:U(9)=4:U(10)=4:U(11)=4:U(12)=4:U(13)=4:U(14)=4
720 V$(LEN(V$)+1)="PIZZATHINGFEIGNFIENDELBOWFAULTDIRTY"
725 U(15)=5:U(16)=5:U(17)=5:U(18)=5:U(19)=5:U(20)=5:U(21)=5
730 V$(LEN(V$)+1)="BUDGETSPIRITQUAINTMAIDENESCORTPICKAX"
735 U(22)=6:U(23)=6:U(24)=6:U(25)=6:U(26)=6:U(27)=6
740 V$(LEN(V$)+1)="EXAMPLETENSIONQUININEKIDNEYREPLICASLEEPER"
745 U(28)=7:U(29)=7:U(30)=7:U(31)=6:U(32)=7:U(33)=7
750 V$(LEN(V$)+1)="TRIANGLEKANGAROOMAHOGANYSARGEANTSEQUENCE"
755 U(34)=8:U(35)=8:U(36)=8:U(37)=8:U(38)=8
760 V$(LEN(V$)+1)="MOUSTACHEDANGEROUSSCIENTISTDIFFERENTQUIESCENT"
765 U(39)=9:U(40)=9:U(41)=9:U(42)=9:U(43)=9
770 Z$="MAGISTRATEERRONEOUSLYLOUDSPEAKERPHYTOTOXIC"
775 U(44)=10:U(45)=11:U(46)=11:U(47)=10
780 Z$(LEN(Z$)+1)="MATRIMONIALPARASYMPATHOMIMETICTHIGNOTROPISM"
785 U(48)=11:U(49)=19:U(50)=13
790 V(1)=1: FOR I=2 TO 43: V(I)=V(I-1)+U(I-1):NEXT I
795 V(44)=1:FOR I=45 TO 50: V(I)=V(I-1)+U(I-1):NEXT I
800 RETURN
900 REM X AND Y ARE INDICES, X$ IS CHARACTER TO INSERT
910 Z=(X-1)*12+Y
915 S$="":IF Z<144 THEN S$=P$(Z+1)
920 P$(Z)=X$(1,1)
925 IF Z < 144 THEN P$(Z+1)=S$
930 RETURN
990 PRINT "BYE NOW"
999 END
RUN