home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
17 Bit Software 3: The Continuation
/
17-Bit_The_Continuation_Disc.iso
/
files
/
nz14.dms
/
nz14.adf
/
Quarters.Game
< prev
next >
Wrap
Text File
|
1993-12-03
|
6KB
|
272 lines
'QUARTERS
'By Jerry Lancaster
'This program is based on a listing published in
'Computing with the Amstrad CPC'
'September 1987
'Converted to the Amiga by Rex Moir
CLEAR,25000:CLEAR,50000&
DEFINT a-z
DIM dom(70),sc(2),gs(4),ts(4),dx(2),dy(2),d(130)
dx(1)=35:dy(1)=20:dx(2)=275:dy(2)=20
SCREEN 1,320,256,3,1
WINDOW 2,,(0,0)-(311,242),0,1
PALETTE 0,.1,.7,.7
PALETTE 1,1,0,0
PALETTE 2,0,.8,.4
PALETTE 3,.1,.25,.9
PALETTE 4,1,.8,0
PALETTE 5,.9,.9,.9
PALETTE 6,.1,.1,.5
PALETTE 7,.6,0,.6
COLOR 7,0
Title:
LINE (1,1)-(310,249),,b
LINE (1,1)-(310,249)
LINE (1,249)-(310,1)
PAINT(150,3),1,7
PAINT(150,240),2,7
PAINT(10,120),3,7
PAINT(300,120),4,7
LOCATE 5,16:PRINT "QUARTERS"
LOCATE 26,16:PRINT "QUARTERS"
LOCATE 16,3:PRINT "QUARTERS"
LOCATE 16,30:PRINT "QUARTERS"
Dominoes:
RESTORE DomData
FOR i=1 TO 70:READ dom(i):NEXT
FOR i=1 TO 70:s=INT(RND*70)+1:z=dom(i):dom(i)=dom(s):dom(s)=z:NEXT
DomData:
DATA 1432,2222,3333,4444,1112,1113,1114
DATA 2221,2223,2224,3331,3332,3334,1342
DATA 4441,4442,4443,1122,1133,1144,1423
DATA 2233,2244,3344,1212,1313,1414,1111
DATA 2323,2424,3434,1123,1132,1124,4142
DATA 1142,1134,1143,2213,2231,2214,4143
DATA 2241,2234,2243,3314,3341,3324,4243
DATA 3342,3312,3321,4412,4421,4413,1234
DATA 4431,4423,4432,1213,1214,1314,1243
DATA 2123,2124,2324,3132,3134,3234,1324
Choices:
WINDOW 3,,(93,75)-(218,166),0,1:WINDOW OUTPUT 3
PRINT :PRINT
PRINT :PRINT "1 - One Player "
PRINT :PRINT "2 - Two Players"
PRINT :PRINT "3 - Against"
PRINT " the Computer"
PRINT :PRINT "4 - Instructions"
WHILE (ch$<"1" OR ch$>"4"):ch$=INKEY$:WEND
c=VAL(ch$):ch$=""
WINDOW CLOSE 3
CLS
IF c=4 THEN GOSUB Instructions:GOTO Choices
DrawBoard:
LINE (30,15)-(70,45),,b
IF c>1 THEN LINE (270,15)-(310,45),,b
LINE (50,60)-(290,240),,b
FOR i=80 TO 220 STEP 20
LINE (50,i)-(290,i)
NEXT
FOR i=80 TO 260 STEP 30
LINE (i,60)-(i,240)
NEXT
COLOR 5,6
LINE (10,82)-STEP(18,18),,b:PAINT (12,85),6,5
LOCATE 12,3:PRINT "R"
LINE (10,122)-STEP(18,18),,b:PAINT (12,125),6,5
LOCATE 17,3:PRINT "D"
LINE (10,162)-STEP(18,18),,b:PAINT (12,165),6,5
LOCATE 22,3:PRINT "S"
LINE (10,202)-STEP(18,18),,b:PAINT (12,205),6,5
LOCATE 27,3:PRINT "Q"
Play:
p=1:q=2:u=0:sc(1)=0:sc(2)=0:COLOR 7,0:GOSUB PrintScore
WHILE u<70
GOSUB NewDom
x=dx(p):y=dy(p)
GOSUB PrintDom
IF p=2 AND c=3 THEN
GOSUB CompMove
ELSE
GOSUB Move
END IF
GOSUB PrintScore
IF c<>1 THEN SWAP p,q
WEND
EndGame:
WINDOW 3,,(51,59)-(289,239),0,1:WINDOW OUTPUT 3
LOCATE 5,12:PRINT "GAME OVER"
IF c=1 THEN
IF sc(1)>hs THEN hs=sc(1)
LOCATE 9,7:PRINT "HIGHEST SCORE IS ";hs
LOCATE 11,7:PRINT "YOUR SCORE WAS ";sc(1)
ELSE
IF sc(1)>sc(2) THEN gs(1)=gs(1)+1
IF sc(2)>sc(1) THEN gs(2)=gs(2)+1
ts(1)=ts(1)+sc(1)
ts(2)=ts(2)+sc(2)
FOR i=1 TO 2
LOCATE 8+i*2,3:PRINT "PLAYER ";i;"HAS WON";gs(i);"GAMES"
LOCATE 9+i*2,3:PRINT "SCORING ";ts(i);" TOTAL POINTS"
PRINT
NEXT
END IF
LOCATE 16,8:PRINT "CLICK LEFT MOUSE"
LOCATE 17,8:PRINT "FOR ANOTHER GAME"
WHILE MOUSE(0)<>0:WEND
WHILE MOUSE(0)=0:WEND
WINDOW CLOSE 3
CLS:GOTO Dominoes
NewDom:
u=u+1:n=dom(u)
SplitCode:
n4=n MOD 10:n3=(INT(n/10))MOD 10:n2=(INT(n/100))MOD 10
n1=INT(n/1000)
RETURN
PrintDom:
LINE (x,y)-(x+30,y+20),,b
LINE (x,y)-(x+30,y+20)
LINE (x,y+20)-(x+30,y)
PAINT(x+1,y+10),n1,7
PAINT(x+15,y+1),n2,7
PAINT(x+25,y+10),n3,7
PAINT(x+15,y+15),n4,7
RETURN
DelDom:
m=n:n=0
GOSUB SplitCode
x=dx(p):y=dy(p)
GOSUB PrintDom:n=m:RETURN
RotDom:
n=(n MOD 1000)*10 + n/1000
GOSUB SplitCode
RETURN
CheckValid:
sum=0
IF POINT (x-1,y+10)=0 OR POINT (x-1,y+10)=n1 THEN sum=sum+1
IF POINT (x+15,y-1)=0 OR POINT (x+15,y-1)=n2 THEN sum=sum+1
IF POINT (x+31,y+10)=0 OR POINT (x+31,y+10)=n3 THEN sum=sum+1
IF POINT (x+15,y+21)=0 OR POINT (x+15,y+21)=n4 THEN sum=sum+1
RETURN
UpdateScore:
score=0
IF POINT (x-1,y+10)=n1 THEN score=score+1
IF POINT (x+15,y-1)=n2 THEN score=score+1
IF POINT (x+31,y+10)=n3 THEN score=score+1
IF POINT (x+15,y+21)=n4 THEN score=score+1
IF score=0 THEN RETURN
score=2*score-1
FOR a=1 TO score:SOUND 130.81*a,a,90:NEXT a
sc(p)=sc(p)+score
RETURN
PrintScore:
v=(u+1)/2:w=u/2
IF c=1 THEN v=u:w=u:sc(2)=sc(1)
LOCATE 3,15:PRINT v;" TURNS ";w
LOCATE 5,15:PRINT sc(1);" SCORE ";sc(2)
RETURN
Move:
WHILE MOUSE(0)>-1:WEND
x=MOUSE(3):y=MOUSE(4)
IF y<60 THEN Move
IF x<50 THEN Options
WHILE MOUSE(0)<0:WEND
x=INT((MOUSE(5)-20)/30)*30+20
y=INT((MOUSE(6)-40)/20)*20+40
full=POINT(x+1,y+1):IF full THEN Move
GOSUB CheckValid
IF sum=4 THEN
GET (dx(p),dy(p))-(dx(p)+30,dy(p)+20),d
PUT (x,y),d,PSET
GOSUB UpdateScore
GOSUB DelDom
ELSE
SOUND 493.88,3,90:SOUND 440,2,90:SOUND 392,1,90
GOTO Move
END IF
RETURN
CompMove:
x=20:y=60
valid=0:WHILE valid<>1
NextDom:
x=x+30
IF x>260 THEN y=y+20:x=50
IF y>220 THEN valid=1:SOUND 493.88,3,90:SOUND 440,2,90:SOUND 392,1,90:RETURN
full=POINT(x+1,y+1):IF full THEN NextDom
rot=0:WHILE rot<4
GOSUB CheckValid
IF sum<4 THEN
GOSUB RotDom:rot=rot+1
ELSE
rot=4:valid=1
END IF
WEND
WEND
GOSUB PrintDom
GOSUB UpdateScore
cc=x:cy=y:GOSUB DelDom:x=cx:y=cy
RETURN
Options:
IF x<10 OR x>28 GOTO Move
y=INT(y-2)/20
IF y=4 THEN GOSUB RotDom:x=dx(p):y=dy(p):GOSUB PrintDom:GOTO Move
IF y=6 THEN DelDom
IF y=8 THEN CLS:hs=0:gs(1)=0:gs(2)=0:ts(1)=0:ts(2)=0:GOTO Title
IF y=10 THEN WINDOW CLOSE 2:SCREEN CLOSE 1:STOP
GOTO Move
Instructions:
PRINT
PRINT " QUARTERS is played on a 9 X 8 grid."
PRINT
PRINT " The tile to be played is displayed"
PRINT " above the board and can be rotated"
PRINT " by clicking in the R box."
PRINT
PRINT " To place the tile, click in the"
PRINT " desired location."
PRINT
PRINT " If it is impossible to play"
PRINT " click in the D box."
PRINT
PRINT " Click in the S box to start a new"
PRINT " game and click Q to finish."
PRINT
PRINT " You score every time you place a"
PRINT " on the board, gaining more points"
PRINT " if you match more than one edge"
PRINT " with neighbouring tiles."
PRINT
PRINT " There are three ways to play:"
PRINT " - solo,"
PRINT " - against another person, or"
PRINT " - against the computer."
PRINT
PRINT " The game ends when all 70 tiles"
PRINT " have been used."
PRINT
PRINT " Click Mouse to continue."
WHILE MOUSE(0)=0:WEND
CLS
RETURN