mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2024-12-21 16:30:19 +00:00
168 lines
7.1 KiB
Plaintext
168 lines
7.1 KiB
Plaintext
|
1 TEXT : HOME : PRINT "THIS GAME IS PLAYED ENTIRELY WITH"
|
||
|
2 FLASH : PRINT "3";: NORMAL : PRINT "-LETTER WORDS. ALL LETTERS IN A WORD"
|
||
|
3 PRINT "MUST BE UNIQUE (FOR EXAMPLE, 'POP' IS"
|
||
|
4 PRINT "*NOT* A VALID WORD).": PRINT
|
||
|
5 PRINT "TO BEGIN THE GAME, BOTH YOU AND I WILL"
|
||
|
6 PRINT "CHOOSE A SECRET WORD. THE FIRST PLAYER"
|
||
|
7 PRINT "TO GUESS THE OTHER'S WORD WINS.": PRINT
|
||
|
8 PRINT "AFTER EACH GUESS, THE ASKER IS TOLD"
|
||
|
9 PRINT "HOW MANY LETTERS WERE CORRECT. THE"
|
||
|
10 PRINT "POSITION OF THE LETTERS DOES *NOT*"
|
||
|
11 PRINT "MATTER (FOR EXAMPLE, IF THE WORD WAS"
|
||
|
12 PRINT "'OWN' A GUESS OF 'WHO' WOULD HAVE 2"
|
||
|
13 PRINT "HITS.": PRINT
|
||
|
95 INPUT "READY? ";Q$
|
||
|
99 M1 = 0:M2 = 0
|
||
|
100 REM : JOT
|
||
|
110 REM : COPYRIGHT 1980 BY PHIL FELDMAN AND TOM RUGG
|
||
|
150 M = 25:N = 406
|
||
|
160 DIM A$(N)
|
||
|
170 DIM G1$(M),G2$(M),H1(M),H2(M)
|
||
|
200 G1 = 0:G2 = 0
|
||
|
210 L = N:Q = PEEK (78) + 256 * PEEK (79):Q = RND ( - Q)
|
||
|
250 TEXT : HOME : PRINT TAB(17);"J O T": PRINT
|
||
|
260 PRINT "JUST A MOMENT PLEASE .....": GOSUB 3000:Q = INT(RND (1) * N) + 1: PRINT
|
||
|
270 PRINT "THANKS, NOW LET'S EACH THINK": PRINT "OF OUR SECRET WORD"
|
||
|
280 PRINT : PRINT "(THIS TAKES ME A WHILE ...)"
|
||
|
290 GOSUB 2200:M$ = A$(Q): PRINT : PRINT "OK, ";
|
||
|
300 INPUT "DO YOU WANT TO GO FIRST? ";Q$
|
||
|
310 Q$ = LEFT$ (Q$,1): IF Q$ = "N" THEN 600
|
||
|
320 IF Q$ = "Y" THEN 500
|
||
|
330 PRINT : PRINT "YES OR NO PLEASE": PRINT : GOTO 300
|
||
|
500 M2 = M2 + 1: IF M2 = 1 THEN PRINT : PRINT "TYPE S FOR LIST OF PREVIOUS GUESSES."
|
||
|
502 PRINT : INPUT "YOUR GUESS (OR S)? ";P$: IF P$ = "S" THEN GOSUB 1000: GOTO 500
|
||
|
510 IF P$ = "Q" THEN 1200
|
||
|
520 IF P$ = M$ THEN G1 = G1 + 1:G1$(G1) = P$:H1(G1) = 9: GOTO 3400
|
||
|
530 GOSUB 1800: IF F = 0 THEN PRINT "THAT'S NOT A LEGAL WORD -- TRY AGAIN": GOTO 500
|
||
|
540 Q$ = M$: GOSUB 2600:Q$ = P$: GOSUB 1500
|
||
|
550 PRINT "# OF HITS IS ";Q
|
||
|
560 G1 = G1 + 1:G1$(G1) = Q$:H1(G1) = Q
|
||
|
570 IF G1 = M THEN 3600
|
||
|
600 Q$ = A$(L):G2 = G2 + 1:G2$(G2) = Q$
|
||
|
610 PRINT : PRINT "MY GUESS IS -- ";Q$
|
||
|
615 M1 = M1 + 1: IF M1 = 1 THEN PRINT : PRINT "IF I AM RIGHT, TYPE R."
|
||
|
620 INPUT "HOW DID I DO (0-3 OR R)? ";P$
|
||
|
630 P$ = LEFT$ (P$,1)
|
||
|
640 IF P$ = "R" THEN H2(G2) = 9: GOTO 3200
|
||
|
650 P = VAL (P$): IF P > 3 OR (P = 0 AND P$ < > "0") THEN PRINT "BAD ANSWER": GOTO 610
|
||
|
660 IF L > 100 THEN PRINT : PRINT "I'M THINKING ..."
|
||
|
670 H2(G2) = P: GOSUB 800
|
||
|
680 GOTO 500
|
||
|
800 Q$ = G2$(G2):H = H2(G2):J = 0: GOSUB 2600:L = L - 1: IF L < 1 THEN 900
|
||
|
810 J = J + 1: IF J > L THEN 870
|
||
|
820 Q$ = A$(J): GOSUB 1500
|
||
|
830 IF Q = H THEN 810
|
||
|
840 A = J:B = L: GOSUB 2400:L = L - 1
|
||
|
850 IF L < 1 THEN 900
|
||
|
860 IF L > = J THEN 820
|
||
|
870 RETURN
|
||
|
900 PRINT : PRINT "SOMETHING'S WRONG !!"
|
||
|
910 PRINT : INPUT "WHAT'S YOUR SECRET WORD? ";P$: GOSUB 1800
|
||
|
920 IF F = 0 THEN PRINT : PRINT "ILLEGAL WORD -- I NEVER HAD A CHANCE": GOTO 1200
|
||
|
930 PRINT : PRINT "YOU GAVE A BAD ANSWER SOMEWHERE --"
|
||
|
940 PRINT "CHECK THE SUMMARY": GOSUB 1000
|
||
|
950 GOTO 1200
|
||
|
1000 PRINT :Q = G1: IF G2 > G1 THEN Q = G2
|
||
|
1010 IF Q = 0 THEN PRINT "NO GUESSES YET": RETURN
|
||
|
1020 PRINT TAB(1);: FOR J = 1 TO 37: PRINT "-";: NEXT : PRINT "-"
|
||
|
1030 PRINT TAB(1);: INVERSE : PRINT "YOUR GUESSES";: NORMAL
|
||
|
1040 PRINT " SUMMARY ";: INVERSE
|
||
|
1050 PRINT "MY GUESSES";: NORMAL : PRINT " "
|
||
|
1060 PRINT "WORD HITS"; TAB(29);"WORD HITS"
|
||
|
1070 FOR J = 1 TO Q:K = 1: IF J > 9 THEN K = 0
|
||
|
1080 IF J > G1 THEN PRINT TAB(19 + K);J; TAB(30);G2$(J); TAB(36);H2(J): GOTO 1110
|
||
|
1090 IF J > G2 THEN PRINT TAB(2);G1$(J); TAB(9);H1(J); TAB(19 + K);J: GOTO 1110
|
||
|
1100 PRINT TAB(2);G1$(J); TAB(9);H1(J); TAB(19 + K);J; TAB(30);G2$(J); TAB(36);H2(J)
|
||
|
1110 NEXT : RETURN
|
||
|
1200 PRINT : INPUT "HOW ABOUT ANOTHER GAME? ";Q$
|
||
|
1210 Q$ = LEFT$ (Q$,1): IF Q$ = "Y" THEN 200
|
||
|
1220 IF Q$ = "N" THEN END
|
||
|
1230 PRINT : PRINT "YES OR NO PLEASE": GOTO 1200
|
||
|
1500 P$ = LEFT$ (Q$,1):Q = 0: GOSUB 1600
|
||
|
1510 P$ = MID$ (Q$,2,1): GOSUB 1600
|
||
|
1520 P$ = RIGHT$ (Q$,1): GOSUB 1600: RETURN
|
||
|
1600 IF P$ = M1$ OR P$ = M2$ OR P$ = M3$ THEN Q = Q + 1
|
||
|
1610 RETURN
|
||
|
1800 F = 0
|
||
|
1810 FOR J = 1 TO N
|
||
|
1820 IF A$(J) = P$ THEN F = 1: RETURN
|
||
|
1830 NEXT : RETURN
|
||
|
2200 FOR A = N TO 100 STEP - 1:B = INT ( RND (1) * A) + 1
|
||
|
2210 GOSUB 2400: NEXT
|
||
|
2220 PRINT : PRINT "I'VE ALMOST GOT IT ..."
|
||
|
2230 FOR A = 99 TO 2 STEP - 1:B = INT ( RND (1) * A) + 1
|
||
|
2240 GOSUB 2400: NEXT : RETURN
|
||
|
2400 Q$ = A$(B):A$(B) = A$(A):A$(A) = Q$: RETURN
|
||
|
2600 M1$ = LEFT$ (Q$,1):M2$ = MID$ (Q$,2,1)
|
||
|
2610 M3$ = RIGHT$ (Q$,1): RETURN
|
||
|
3000 RESTORE : FOR P = 1 TO N: READ A$(P): NEXT : RETURN
|
||
|
3200 PRINT : PRINT "IT SURE FEELS GOOD"
|
||
|
3210 PRINT : PRINT "MY WORD WAS -- ";M$
|
||
|
3220 GOTO 1200
|
||
|
3400 PRINT : PRINT "CONGRATULATIONS - THAT WAS IT": PRINT
|
||
|
3410 INPUT "WHAT WAS YOUR WORD? ";P$: GOSUB 1800:J = 1
|
||
|
3420 IF F = 0 THEN PRINT : PRINT "ILLEGAL WORD - I HAD NO CHANCE": GOTO 1200
|
||
|
3430 IF A$(J) = P$ THEN PRINT : PRINT "NICE WORD": GOTO 1200
|
||
|
3440 J = J + 1: IF J < = L THEN 3430
|
||
|
3450 PRINT : PRINT "YOU MADE AN ERROR SOMEWHERE": PRINT "-- CHECK THE SUMMARY"
|
||
|
3460 GOSUB 1000: GOTO 1200
|
||
|
3600 PRINT : PRINT "SORRY, I'M OUT OF MEMORY": PRINT
|
||
|
3610 PRINT "MY WORD WAS - ";M$: GOTO 1200
|
||
|
5000 DATA ACE,ACT,ADE,ADO,ADS,AFT,AGE
|
||
|
5010 DATA AGO,AID,AIL,AIM,AIR,ALE,ALP
|
||
|
5020 DATA AND,ANT,ANY,APE,APT,ARC,ARE
|
||
|
5030 DATA ARK,ARM,ART,ASH,ASK,ASP,ATE
|
||
|
5040 DATA AWE,AWL,AXE,AYE,BAD,BAG,BAN
|
||
|
5050 DATA BAR,BAT,BAY,BED,BEG,BET,BID
|
||
|
5060 DATA BIG,BIN,BIT,BOA,BOG,BOW,BOX
|
||
|
5070 DATA BOY,BUD,BUG,BUM,BUN,BUS,BUT
|
||
|
5080 DATA BUY,BYE,CAB,CAD,CAM,CAN,CAP
|
||
|
5090 DATA CAR,CAT,COB,COD,COG,CON,COP
|
||
|
5100 DATA COT,COW,COY,CRY,CUB,CUD,CUE
|
||
|
5110 DATA CUP,CUR,CUT,DAB,DAM,DAY,DEN
|
||
|
5120 DATA DEW,DIE,DIG,DIM,DIN,DIP,DOE
|
||
|
5130 DATA DOG,DON,DOT,DRY,DUB,DUE,DUG
|
||
|
5140 DATA DYE,DUO,EAR,EAT,EGO,ELK,ELM
|
||
|
5150 DATA END,ELF,ERA,FAD,FAG,FAN,FAR
|
||
|
5160 DATA FAT,FED,FEW,FIG,FIN,FIR,FIT
|
||
|
5170 DATA FIX,FLY,FOE,FOG,FOR,FOX,FRY
|
||
|
5180 DATA FUN,FUR,GAP,GAS,GAY,GEM,GET
|
||
|
5190 DATA GIN,GNU,GOB,GOD,GOT,GUM,GUN
|
||
|
5200 DATA GUT,GUY,GYP,HAD,HAG,HAM,HAS
|
||
|
5210 DATA HAT,HAY,HEN,HEX,HID,HIM,HIP
|
||
|
5220 DATA HIS,HIT,HER,HEM,HOE,HOG,HOP
|
||
|
5230 DATA HOT,HOW,HUB,HUE,HUG,HUM,HUT
|
||
|
5240 DATA ICE,ICY,ILK,INK,IMP,ION,IRE
|
||
|
5250 DATA IRK,ITS,IVY,JAB,JAR,JAW,JAY
|
||
|
5260 DATA JOB,JOG,JOT,JOY,JUG,JAG,JAM
|
||
|
5270 DATA JET,JIB,JIG,JUT,KEG,KEY,KID
|
||
|
5280 DATA KIN,KIT,LAB,LAD,LAG,LAP,LAW
|
||
|
5290 DATA LAY,LAX,LED,LEG,LET,LID,LIE
|
||
|
5300 DATA LIP,LIT,LOB,LOG,LOP,LOT,LOW
|
||
|
5310 DATA LYE,MAD,MAN,MAP,MAR,MAT,MAY
|
||
|
5320 DATA MEN,MET,MID,MOB,MOP,MOW,MUD
|
||
|
5330 DATA MIX,MUG,NAB,NAG,NAP,NAY,NET
|
||
|
5340 DATA NEW,NIL,NIP,NOD,NOT,NOR,NOW
|
||
|
5350 DATA NUT,OAF,OAK,OAR,OAT,ODE,OIL
|
||
|
5360 DATA OLD,ONE,OPT,ORE,OUR,OUT,OVA
|
||
|
5370 DATA OWE,OWL,OWN,PAD,PAL,PAN,PAR
|
||
|
5380 DATA PAT,PAW,PAY,PEA,PEG,PEN,PET
|
||
|
5390 DATA PEW,PIE,PIG,PIT,PLY,POD,POT
|
||
|
5400 DATA POX,PER,PIN,PRO,PRY,PUB,PUN
|
||
|
5410 DATA PUS,PUT,RAG,RAM,RAN,RAP,RAT
|
||
|
5420 DATA RAW,RAY,RED,RIB,RID,REV,RIG
|
||
|
5430 DATA RIM,RIP,ROB,ROD,ROE,ROT,ROW
|
||
|
5440 DATA RUB,RUE,RUG,RUM,RUN,RUT,RYE
|
||
|
5450 DATA SAD,SAG,SAP,SAT,SAW,SAY,SET
|
||
|
5460 DATA SEW,SEX,SHY,SEA,SIN,SHE,SIP
|
||
|
5470 DATA SIR,SIT,SIX,SKI,SKY,SLY,SOB
|
||
|
5480 DATA SOD,SON,SOW,SOY,SPA,SPY,STY
|
||
|
5490 DATA SUE,SUM,SUN,TAB,TAD,TAG,TAN
|
||
|
5500 DATA TAP,TAX,TAR,TEA,TEN,THE,THY
|
||
|
5510 DATA TIC,TIE,TIN,TIP,TOE,TON,TOP
|
||
|
5520 DATA TOW,TOY,TRY,TUB,TUG,TWO,URN
|
||
|
5530 DATA USE,UPS,VAN,VAT,VEX,VIA,VIE
|
||
|
5540 DATA VIM,VOW,YAK,YAM,YEN,YES,YET
|
||
|
5550 DATA YOU,WAD,WAG,WAN,WAR,WAS,WAX
|
||
|
5560 DATA WAY,WEB,WED,WET,WHO,WHY,WIG
|
||
|
5570 DATA WIN,WIT,WOE,WON,WRY,ZIP,FIB
|