# dots # version 1.2 # by Neil "Fred" Picciotto #http://www.derf.net/derfware/cbaspad/dots/ # you may distribute this code, but # please keep this header with it. new #opt int # setup 10 cur = 1 : v = 64 20 dim fore(36) : dim side(25) 30 for i=0 to 35 : fore(i)=0 : next 40 for i=0 to 24 : side(i)=0 : next # draw the dots 100 for i=1 to 7 120 for j=1 to 6 130 x=0+20*i 140 y=10+20*j 150 grline x-1,y+1,x+1,y-1 160 grline x-1,y-1,x+1,y+1 190 grline y-1,x-1,y+1,x-1 200 grline y+1,x,y+1,x 210 grline y-1,x+1,y+1,x+1 220 grline y-1,x,y-1,x 230 next j 240 next i # draw the |'s 250 grline 20,30,20,130 260 grline 140,30,140,130 # draw the ='s 270 grline 30,19,130,19 275 grline 30,21,130,21 280 grline 30,139,130,139 285 grline 30,141,130,141 # main game loop 300 if (cur=1) then sound 440,18,v," t" 302 if (cur=2) then sound 440,18,v," m" 305 t1=fn 34 310 t2=fn 34 : if (t1=t2) then goto 310 315 q = 1 320 x=fn 48 : y=fn 49 330 if (x<20) and (y<80) then goto 600 340 if (x>140) and (y<90) then end 342 if (x<20) then v = ((v+64) mod 128) : goto 300 345 if (x>140) then goto 700 350 a=(x+y-50)/20 : b=(x-y+10)/20 360 if (x+y-50 < 0) then a=a-1 370 if (x-y+10 < 0) then b=b-1 380 c=10*a+25 : d=10*b-5 385 x=c+d : y=c-d 387 fs = (a+b) mod 2 390 lx = x : ly = y : lfs = fs 395 if (fs <> 0) then goto 500 # if it's a "fore" 400 row = (a-b)/2 : col = (a+b)/2 405 if (row<0) or (row>5) then goto 1000 407 if (col<0) or (col>5) then goto 1000 410 i = 6*row + col 415 bar = fore(i) + q 420 if (bar = 2) then goto 1000 430 fore(i)=bar 440 if (cur = 2) then goto 480 450 grline x+1,y,x+19,y,q 469 goto 600 480 grline x+9,y-8,x+9,y+8,q 490 grline x+11,y-8,x+11,y+8,q 499 goto 600 # if it's a "side" 500 row = (a-b-1)/2 : col = (a+b-1)/2 505 if (row<0) or (row>4) then goto 1000 507 if (col<0) or (col>4) then goto 1000 510 i = 5*row + col 515 bar = side(i) + q 520 if (bar = 2) then goto 1000 530 side(i)=bar 540 if (cur = 2) then goto 580 550 grline x+10,y-9,x+10,y+9,q 569 goto 600 580 grline x+2,y-1,x+18,y-1,q 590 grline x+2,y+1,x+18,y+1,q # switch and loop 600 if (q=-1) then goto 300 610 if (cur=1) then cur=2 : goto 300 620 cur=1 : goto 300 # undo 700 x = lx : y = ly : fs = lfs 710 q = -1 720 if (cur=1) then cur=2 : goto 395 730 cur=1 : goto 395 # error - low beep, then loop 1000 sound 220,350,v 1095 goto 300 # clear i=fn 42 #P grline 5,20,5,34 grline 5,20,13,20 grline 14,21,14,25 grline 13,26,5,26 #A grline 9,34,4,46 grline 9,34,14,46 grline 6,43,12,43 #S grline 14,50,9,48 grline 9,48,4,50 grline 4,50,4,52 grline 4,52,14,55 grline 14,55,14,58 grline 14,58,9,60 grline 9,60,4,58 #S grline 14,64,9,62 grline 9,62,4,64 grline 4,64,4,66 grline 4,66,14,69 grline 14,69,14,72 grline 14,72,9,74 grline 9,74,4,72 #S grline 14,87,9,85 grline 9,85,4,87 grline 4,87,4,89 grline 4,89,14,92 grline 14,92,14,95 grline 14,95,9,97 grline 9,97,4,95 #O grline 5,100,5,107 grline 6,108,12,108 grline 13,107,13,100 grline 12,99,6,99 #U grline 5,110,5,118 grline 6,119,12,119 grline 13,118,13,110 #N grline 5,121,5,130 grline 5,121,13,130 grline 13,121,13,130 #D grline 5,132,5,141 grline 4,132,12,132 grline 13,133,13,140 grline 4,141,12,141 #Q grline 144,29,149,23 grline 149,23,151,23 grline 151,23,156,29 grline 156,29,156,31 grline 156,31,151,37 grline 151,37,149,37 grline 149,37,144,31 grline 144,31,144,29 grline 150,31,156,37 #U grline 146,40,146,52 grline 147,53,153,53 grline 154,52,154,40 #I grline 149,56,151,56 grline 150,56,150,69 grline 149,69,151,69 #T grline 145,72,155,72 grline 150,72,150,85 #U grline 145,96,145,106 grline 146,107,154,107 grline 155,106,155,96 #N grline 146,109,146,118 grline 146,109,154,118 grline 154,109,154,118 #D grline 146,120,146,129 grline 145,120,153,120 grline 154,121,154,128 grline 145,129,153,129 #O grline 146,132,146,139 grline 147,140,153,140 grline 154,139,154,132 grline 153,131,147,131 run