BASIC2\ANAGRAM.BAS ·
BAS ·
4.3 KB ·
1988-05-02 ·
from PCPlus_Issue-27_Dec-1988
OPTION RUN
DRIVE "a"
CD \BASIC2
REM **** thats where I keep anagram.dat ****
REM **** You may have to change drive/cd statement for your pc ****
CLOSE
OPEN #4 WINDOW 4
WINDOW #4 SIZE 20,4
WINDOW #4 PLACE 455;15
CLOSE #4
CLOSE WINDOW 3
CLOSE WINDOW 4
DIM a(16)
LABEL welcome
CLS #1
WINDOW #1 TITLE " WELCOME TO ANAGRAMMATICAL By Phil Aikman"
WINDOW #1 FULL ON
WINDOW #1 OPEN
win=0:lose=0:tstart=0:ttot=0:mins=0:secs=0
RANDOMIZE
PRINT #1,EFFECTS(01), AT (1;3),COLOUR (11),FONT (3),POINTS (36)," ANAGRAMMATICAL"
BOX #1, 750;3500,7000,300 COLOUR 11 FILL ONLY WITH 17
PRINT #1,COLOUR (8);AT (4;8);" I will present you with a series of anagrams. You will see a score of how you are doing. It is a race to 10 for you or me. I usually win !!!"
PRINT #1,COLOUR (8);AT (12;12);"Just press the space bar to bring on the next word"
PRINT #1,COLOUR (15);AT (20;16);"Press space bar to start game"
PRINT #1,COLOUR (8);AT (16;13);" or enter 'STOP' as your guess to stop game"
PRINT #1,COLOUR (2),AT (1;19),"NOTE:You must have the file ANAGRAM.DAT in the same directory as this program"
LABEL wait1:IF INKEY$="" THEN GOTO wait1
CLOSE WINDOW 1
CLS #1
CLS #2
WINDOW #2 OPEN
WINDOW #2 TITLE " *ANAGRAMMATICAL**ANAGRAMMATICAL**ANAGRAMMATICAL* By Phil Aikman"
WINDOW #2 FULL ON
OPEN #6 OLD RANDOM "ANAGRAM.DAT" LENGTH 16
REM **** Did it stop here with 'file not found' message ? ****
REM **** If so: change the drive/cd statements at the start of program ****
REM **** to reflect where Basic2 can find ANAGRAM.DAT. ****
REM **** Press HOME key to go to start of programm. ****
REM PS: did you know you can't open an old random file if it's read only.
LABEL starthere
IF win=10 THEN GOTO winend
IF lose=10 THEN GOTO loseend
GOSUB getword
GOSUB mixword
CLS #2
PRINT #2,COLOUR (2);AT (20;2);"WIN = ";win;COLOUR (4)" LOSE = ";lose
LOCATE #2,1;5
PRINT #2,COLOUR (8);" My word is = ";COLOUR (1);mixword$
tstart= INT(TIME/100)
PRINT #2
PRINT #2,COLOUR (8);" Enter your guess ";
SET #2,COLOUR (15)
LINE INPUT #2,guess$
SET #2,COLOUR (1)
ttot=INT(TIME/100)-tstart
IF guess$="stop" OR guess$="STOP" THEN GOTO exit
guess$=LOWER$(guess$)
PRINT #2
IF word$=guess$ THEN GOTO win
PRINT #2
PRINT #2,COLOUR (4); " I am sorry, the word was ";word$
lose=lose+1
LABEL wait:IF INKEY$="" THEN GOTO wait
GOTO starthere
LABEL getword
c=RND*585: REM **** number of words in ANAGRAM.DAT
IF c>585 THEN GOTO exit
POSITION #6, AT c
GET #6,word$
RETURN
LABEL mixword
FOR n=1 TO 16:LET a(n)=0:NEXT n
mixword$=""
tempword$=""
FOR n=1 TO 16
IF MID$(word$,n,1)=" " THEN GOTO skip
tempword$=tempword$+MID$(word$,n,1)
LABEL skip
NEXT n
word$=tempword$
x=LEN(tempword$)
FOR n=1 TO x
LABEL y
y=INT(RND*x)+1
IF a(y)=1 THEN GOTO y
a(y)=1
mixword$=mixword$+MID$(tempword$,y,1)
NEXT n
RETURN
LABEL win
PRINT #2,COLOUR (2);" Hooray - you got it right!"
win=win+1
mins=INT(ttot / 60)
secs=ttot MOD 60
LOCATE #2,4;14
PRINT #2,COLOUR (10);"It took you ";mins;" minutes and ";secs;" seconds"
GOTO wait
LABEL winend
CLS #2
SET #2,COLOUR (2)
LOCATE #2,10;10
PRINT #2, " CONGRATULATIONS ! - YOU BEAT ME"
LOCATE #2,10;15
PRINT #2, " YOUR SCORE WAS ";win;" RIGHT AND ";lose;" WRONG"
LABEL here :IF INKEY$="" THEN GOTO here
SET #2,COLOUR (1)
GOTO exit
LABEL loseend
CLS #2
SET #2,COLOUR (4)
LOCATE #2,10;10
PRINT #2, " BAD LUCK - I BEAT YOU"
LOCATE #2,10;15
PRINT #2, " YOUR SCORE WAS ";win;" RIGHT AND ";lose;" WRONG"
LABEL there :IF INKEY$="" THEN GOTO there
SET #2,COLOUR (1)
GOTO exit
LABEL exit
CLS #2
CLOSE
PRINT #2, COLOUR (8);AT (4;10);"Do you want to play ";COLOUR (15);"ANOTHER ";COLOUR (8);"game ? (press y/n key)"
LABEL waitin:in$=INKEY$
IF in$="" THEN GOTO waitin
CLS #2:CLS #1
PRINT CHR$(7)
in$=LOWER$(in$)
IF in$="y" THEN GOTO welcome
CLS #2:CLS #1
WINDOW #1 CLOSE
WINDOW #2 CLOSE
CLOSE
STOP