home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
17 Bit Software 1: Collection A
/
17Bit_Collection_A.iso
/
files
/
133.dms
/
133.adf
/
Á
/
Slider
< prev
next >
Wrap
Text File
|
1988-07-25
|
4KB
|
83 lines
'****************************
'* Slider game by Don Moore *
'* P.O. Box 1405 * Last Rev: Oct 16, 1986
'* Coconut Grove, Fl 33133 *
'****************************
'CLS : SCREEN 2,320,200,1,1 'hide houskeeping
DIM a%(46),b%(46,100),c%(10*46),r(100) ' ***************
LINE(24,22)-(46,32),1,bf:LINE(26,23)-(44,31),3,bf '
GET(24,22)-(46,32),a% :LOCATE 4 : COLOR 2,0 '
RANDOMIZE TIMER '
n = INT(RND(1)*8)+3 : m = n * n 'change n to change matrix size '
FOR i = 1 TO m '*********** '
find: t = INT( RND(1) * m + 1 ) ' mix up ' setup graphics
IF r(t) THEN find ELSE r(t) = i ' numbers ' and make
NEXT '*********** ' gameboard
b= r(m) 'blank space '
FOR i = 1 TO m-1 '*********** '
LINE(24,22)-(46,33),0,bf ' '
PRINT PTAB(20-(i<10)*4);i; 'make tiles '
PUT(24,22),a% ' '
GET(24,22)-(46,32),b%(0,r(i)) ' '
NEXT '*********** '
'
WINDOW 1,"N-Slider",(0,0)-(26*n-4,12*n-2),26,-1 '
'
CLS '
'
FOR i = 0 TO n-1 ' ************** '
FOR k = 0 TO n-1 ' '
PUT(26*i,12*k),b%(0,i+1+k*n) ' draw gameboard '
NEXT ' '
NEXT ' ************** '**************
SCREEN CLOSE 2 ' show board, housekeeping done
WHILE 1 '*** main ***
WHILE MOUSE(0) <> 0
x = INT(MOUSE(3)/26) :y = INT(MOUSE(4)/12)
c = (x*ABS(x<n)+n*y*ABS(y<n)+1)*ABS(x<n)*ABS(y<n) ' c = mousechoice
IF c > 0 THEN ' within bounds?
cr = INT((c - 1) / n) :cc = c - cr * n -1 ' choicerow & col
br = INT((b - 1) / n) :bc = b - br * n -1 ' blankrow & col
ON ABS((br=cr)+(bc=cc)*2)+1 GOTO illegal,leftright,updown,illegal
leftright: ON ABS((bc>cc)+(bc<cc)*2) GOTO right,left
updown: ON ABS((br>cr)+(br<cr)*2) GOTO down,up
right: GET(cc*26,cr*12)-((bc-1)*26+24,cr*12+10),c%:PUT(cc*26,cr*12),c%
FOR i = 1 TO 26 STEP 8: PUT(cc*26+i,cr*12),c%: PUT(cc*26+i,cr*12),c%:NEXT
PUT(cc*26+i-7,cr*12),c% :GOTO done
left: GET((bc+1)*26,cr*12)-(cc*26+24,cr*12+10),c%:PUT((bc+1)*26,cr*12),c%
FOR i = 26 TO 1 STEP -8:PUT(bc*26+i,cr*12),c%:PUT(bc*26+i,cr*12),c%:NEXT
:PUT(bc*26,cr*12),c% :GOTO done
down: GET(cc*26,cr*12)-(cc*26+24,(br-1)*12+10),c%:PUT(cc*26,cr*12),c%
FOR i = 1 TO 12 STEP 4: PUT(cc*26,cr*12+i),c% : PUT(cc*26,cr*12+i),c%:NEXT
PUT(cc*26,cr*12+i-1),c% :GOTO done
up: GET(cc*26,(br+1)*12)-(cc*26+24,cr*12+10),c%:PUT(cc*26,(br+1)*12),c%
FOR i = 12 TO 1 STEP -4:PUT(cc*26,br*12+i),c%:PUT(cc*26,br*12+i),c%:NEXT
PUT(cc*26,br*12),c%
done: b = c 'choice becomes the blank
illegal: 'a good place to bail out
END IF
WEND
WEND