# FLIPER # Freeware # By Alex Garza (02/16/97) # e-mail: agarza@mail.giga.com # Please wait while program is # being loded... new # initialize 10 dim a(36) 20 for i=0 to 35 : a(i)=1 : next i 40 input "Solvable in how many moves?",m 50 if m<1 or m>100 then 40 60 for i=1 to m 70 j=rnd(36) 80 gosub 900 90 next i 95 p=0 #main loop # draw grid 100 o=fn 42 110 for i=20 to 140 step 20 120 grline i,20,i,140 130 grline 20,i,140,i 140 next i #draw Xs 200 for i=0 to 35 210 if a(i) then 260 220 x=(i mod 6)*20+20 230 y=i/6*20+20 240 grline x+3,y+3,x+17,y+17 250 grline x+17,y+3,x+3,y+17 260 next i #read pen 300 t1=fn 34 310 t2=fn 34 320 if (t1=t2) then goto 310 325 sound 1000,100,2,"t" 330 x=peek(0x1c4,2)/20 340 y=peek(0x1c6,2)/20 350 j=x+6*(y-1)-1 # validate pen entry 360 if x<1 or x>6 then 800 370 if y<1 or y>6 then 800 380 gosub 900 # did I win? 610 p=p+1 620 for i=0 to 35 630 if a(i)=0 then 100 640 next i 650 sound 1000,80,64,"tt" 660 sound 400,80,64,"tt" 670 ? "You won! In",p,"moves." 680 input "Play Again? (y/n)",n$ 690 if not n$="n" then 10 700 end #Error 800 sound 440,18,64,"S" 810 goto 300 #Flip 900 a(j)=(a(j)-1)*(-1) 910 z=j mod 6 920 if z=5 then 940 930 a(j+1)=(a(j+1)-1)*(-1) 940 if z=0 then 960 950 a(j-1)=(a(j-1)-1)*(-1) 960 if j>5 then a(j-6)=(a(j-6)-1)*(-1) 970 if j<30 then a(j+6)=(a(j+6)-1)*(-1) 980 return run