1
0
mirror of https://github.com/rfivet/BCG101.git synced 2024-11-18 02:17:00 -05:00
BCG101/dec/HANG.BAS

78 lines
3.2 KiB
QBasic

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