home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug044.arc
/
HANGMAN1.BAS
< prev
next >
Wrap
BASIC Source File
|
1979-12-31
|
6KB
|
185 lines
100 PRINT:PRINT:PRINT:PRINT "HELLO. WHAT IS YOUR NAME";:INPUT N$
110 PRINT "HI ";N$;". THIS IS THE GAME KNOWN AS HANGMAN. DO YOU KNOW"
120 PRINT "HOW TO PLAY ";:INPUT Y$
130 IF Y$="YES" THEN 210
140 IF Y$ ="NO" THEN160
150 PRINT "JUST A YES OR NO WILL DO JUST FINE HERE. ";:INPUT Y$:GOTO130
160 PRINT "I THINK OF A WORD, AND YOU GUESS THE LETTERS IN THE WORD."
170 PRINT "YOU HAVE 10 GUESSES. IF YOU GUESS THE CORRECT WORD, YOU"
180 PRINT "WIN. IF NOT, YOU HANG. CORRECT LETTER GUESSES WILL NOT AFFECT"
190 PRINT "YOUR COUNTER. YOU MAY SURRENDER AT ANY TIME BY TYPING IN AN"
200 PRINT "ASTERISK (*). WE ARE NOW READY TO BEGIN."
210 PRINT "THIS THE IS BEGINNING VOCABULARY GAME":PRINT:PRINT
220 DIM V(20)
230 DIM B(20)
240 DIMC$(20),G$(20),B$(40)
250 DIM F(10),O$(10),Q$(20)
260 DIM A(20),H(1)
270 DIM W$(20)
280 PRINT "LET'S PLAY HANGMAN."
290 GOSUB 1450
300 PRINT L$
310 W7$="IES"
320 L7$="S."
330 H(0)=1
340 RESTORE
350 FOR I=1 TO 10: READ F(I):NEXT
360 FOR I=1 TO 10: READ O$(I):NEXT
370 READ N9
380 LET N=0
390 Q=0
400 N2 = 0
410 FOR J = 1 TO 20
420 Q$(J) = " "
430 NEXT J
440 I=INT(N9*RND(1)+1)
450 FOR J=1 TO I
460 READ A$
470 NEXT J
480 A=LEN(A$)
490 FOR I = 1 TO A
500 G$(I)=MID$(A$,I,1)
510 W$(I)=G$(I)
520 NEXT I
530 A=LEN(A$)
540 FOR J=1 TO 20
550 C$(J)="-"
560 NEXT J
570 X=10
580 N=1
590 N1=0
600 REM DON"T PRINT GUESSES
610 IF Q=1 THEN 670
620 PRINT "THE WORD IS ";
630 FOR J=1 TO A
640 PRINT C$(J);" ";
650 NEXT J
660 PRINT L$
670 Q=0
680 PRINT "GUESS";
690 INPUT G1$
700 IF G1$="*" THEN 1260
710 IF G1$=A$ THEN 1240
720 FOR K=1 TO A
730 IF G1$=G$(K) THEN 890
740 NEXT K
750 FOR L=1 TO N
760 IF G1$><B$(L) THEN 790
770 PRINT "NO...YOU TRIED THIS BEFORE."
780 GOTO 810
790 NEXT L
800 PRINT "NO"
810 X = X - 1
820 N2 = N2 + 1
830 Q=1
840 Q$(F(N2))=O$(N2)
850 IF X=0 THEN 1200
860 GOSUB 1440
870 GOSUB 1000
880 GOTO 970
890 PRINT "HEY, THAT""S RIGHT!!!!!"
900 FOR L=K TO A
910 IF G$(L)><G1$ THEN 950
920 C$(L)=G1$
930 G$(L)="=,$*):"
940 N1=N1+1
950 NEXT L
960 GOSUB 1000
970 IF N1=A THEN 1240
980 IF X=0 THEN 1200
990 GOTO 600
1000 V=LEN(G1$)
1010 IF V<1 THEN 1140
1020 N = N + 1
1030 LET B(N)=ASC(G1$)
1040 B$(N)=G1$
1050 FOR I=1 TO N-1
1060 IF B(N-I+1)>=B(N-I) THEN 1130
1070 G1$=B$(N-I)
1080 B$(N-I)=B$(N-I+1)
1090 B$(N-I+1)=G1$
1100 A5=B(N-I)
1110 B(N-I)=B(N-I+1)
1120 B(N-I+1)=A5
1130 NEXT I
1140 PRINT "YOU HAVE USED ";
1150 FOR L=1 TO N
1160 PRINT B$(L);
1170 NEXT L
1180 PRINT ". ";
1190 RETURN
1200 PRINT "YOU HAVE BEEN HUNG!"
1210 L8=L8+1
1220 GOSUB 1440
1230 GOTO 1260
1240 PRINT "YOU WIN"
1250 W8=W8+1
1260 PRINT "THE WORD WAS ";
1270 FOR J=1 TO A
1280 PRINT W$(J);
1290 NEXT J
1300 REM
1310 PRINT:PRINT "DO YOU WANT TO TRY ANOTHER WORD ";N$;"."
1320 INPUT T$
1330 IF T$="YES" THEN 340
1340 PRINT L$
1350 IF W8<>1 THEN 1370
1360 W7$="Y"
1370 IF L8<>1 THEN 1390
1380 L7$="."
1390 PRINT "WELL ";N$;" YOU RETIRE WITH A RECORD OF";W8;"VICTOR";W7$;" AND";
1400 PRINT L8;"DEFEAT";L7$
1410 IF W8>0 THEN 1420
1420 PRINT "THANKS FOR PLAYING THE BEGINNING LEVEL OF HANGMAN."
1430 END
1440 IF X>0 THEN 1570
1450 PRINT "-----"
1460 PRINT "I I"
1470 FOR I = 1 TO 4
1480 PRINT "I ";
1490 FOR J = 1 TO 5
1500 PRINT Q$(5*(I-1)+J);
1510 NEXT J
1520 PRINT L$
1530 NEXT I
1540 PRINT "I"
1550 PRINT "--------"
1560 RETURN
1570 PRINT "YOU HAVE ";X;" MORE GUESSES."
1580 RETURN
1590 DATA 3,8,14,12,7,9,16,20,1,5
1600 DATA "0","I","\","/","-","-","-","-","\","/"
1610 DATA 180
1620 DATA BATTLE,CATTLE,PENNY,SUDDEN,ARMY,CASTLE:
1630 DATA SHELTER,WELCOME,BETWEEN,BUCKET,FINISH,STABLE:
1640 DATA QUIET,IDEA,VIOLIN,USUAL,MAID,MAIN:
1650 DATA PAID,TRAIL,GATE,HATE,SAFE,SHADE:
1660 DATA STATE,TRADE,WAVE,STAGE,GAY,NEIGHBOR:
1670 DATA LAZY,PARADE,BEAT,CREAM,TEAM,DREAM:
1680 DATA LEAST,LEAD,LEAF,SPEAK,STREAM,CREEK:
1690 DATA KNEE,SEEK,NIECE,SECRET,MACHINE,POLICE:
1700 DATA FLIGHT,JET,TOP,SUCKS,SHOOTS,GAS:
1710 DATA YELLOW,AUNT,SNAIL,ODD,BLADES,PERSUADE:
1720 DATA LECTURE,FIGURE,CHUCKLE,TRAVEL,SLEEP,WHILE:
1730 DATA DEPEND,BERTH,PRIVATE,SCHOOL,SECTION,CUSHION:
1740 DATA MATTRESS,PILLOW,SKILLFULL,GARDENIA,TRAIN,CONVERTIBLE:
1750 DATA ROADSTER,CANVAS,ALASKA,FLAG,SOURDOUGH,BRILLIANT:
1760 DATA LYNCH,XYLOPHONE,WHICH,CZAR,JAMB,JAZZ:
1770 DATA QUIZ,FLY,WEPT,BRISK,ACRE,BANK:
1780 DATA LINK,DREW,STARRY,GRAVY,HARK,IRK:
1790 DATA LARK,MILK,NASTY,ORANGE,SINK,TRAWL:
1800 DATA UNCLE,VAST,WAND,YAWN,DIFFICULTY,CAMP:
1810 DATA COMPLICATE,DEDICATE,LAUGHTER,HEARTY,CLEVER,HARNESS:
1820 DATA PRIMITIVE,SLEPT,HARMONICA,HARP,PIANO,CISTERN:
1830 DATA COMMAND,OPPORTUNITY,LAP,CAN,WEPT,CREEP:
1840 DATA PITY,TEXTURE,RAGGED,WRING,PNEUMONIA,HEM:
1850 DATA MUMMY,DESPERATE,PATHETIC,FLING,SIMULTANEOUS,DIAMOND:
1860 DATA FANCY,QUICK,DUCK,LIE,TEASPOON,WARP:
1870 DATA VOWEL,LOCOMOTIVE,IT,FANCY,APOLOGY,CANNIBAL:
1880 DATA LOWLY,LLAMA,TERRITORY,KANGAROO,ROTATE,TRACK:
1890 DATA ALTER,LIVELY,CONGRATULATE,GENIUS,IDEA,BUSINESS:
1900 DATA GIRAFFE,MAMMAL,HIPPOPOTAMUS,CATSUP,CACKLE,VACUUM:
1910 DATA NECK,HANGMAN,LASER,FOOTBALL,TELEPHONE,ENVY:
S:
1900 DATA GIRAFFE,MAMMAL,HIPPOPOTAMUS,CATSUP,CACKLE,VACUUM:
1910 DATA NECK,HANGMAN,LASER,FOOTBALL,TELEPHONE,ENVY: