1000 ' 1010 ' ST PUZZLER 1020 ' (c) 1987 Antic Publishing 1030 ' Ver 120286 1040 ' Written by David Bohlke 1050 ' 1060 '---------------------------- 1070 MAIN: 1080 randomize 0 1090 gosub SETCOLOR 1100 TRUE=1: FALSE=0 1110 WRONG=0 1120 TIMER=0 1130 RIGHT=0 1140 fullw 2 1150 clearw 2 1160 for J=1 to 60 1170 X=rnd*84+210 1180 Y=rnd*70+90 1190 while abs( XA-YA )<300 1200 XA=rnd*3600 1210 YA=rnd*3600 1220 wend 1230 XR=rnd*9+7 1240 YR=rnd*9+7 1250 color 1,rnd*15+1,1,7,2 1260 pellipse X, Y, XR, YR, XA, YA 1270 next J 1280 color 1,1,1 1290 linef 220, 100, 283, 100 1300 linef 283, 100, 283, 147 1310 linef 283, 147, 220, 147 1320 linef 220, 147, 220, 100 1330 color 1,0,0 1340 for X=180 to 219 1350 linef X,60,X,180 1360 linef X+104,60,X+104,180 1370 next X 1380 for Y=70 to 99 1390 linef 160,Y,310,Y 1400 linef 160,Y+78,310,Y+78 1410 next Y 1420 gosub GRID 1430 color 12 1440 gotoxy 23,7 1450 print" ST Puzzler" 1460 for I =1 to 8 1470 for J=1 to 6 1480 B( I ,J )=0 1490 next J 1500 next I 1510 ' 1520 '------------------------- 1530 PUZZLE: 1540 gosub MAKE.SCORE 1550 M$=" Selecting piece SCORE " 1560 M$=M$+str$( SCORE )+" " 1570 gosub TITLE 1580 R=int( rnd*8 )+1 1590 C=int( rnd*6 )+1 1600 if B( R, C )=1 then goto PUZZLE 1610 NX=240 1620 NY=20 1630 gosub PLOTBIG 1640 gosub MAKE.SCORE 1650 M$=" Click to grid SCORE " 1660 M$=M$+str$( SCORE )+" " 1670 gosub TITLE 1680 ' 1690 MLOOP: 1700 gosub MOUSE 1710 if B<>1 then TIMER=TIMER+1: goto MLOOP 1720 A=int(( X-10 )/24)+1 1730 B=int(( Y-30 )/24)+1 1740 if A<1 or A>8 or B<1 or B>8 then goto MLOOP 1750 if A=R and B=C then goto GOT.ONE 1760 WRONG=WRONG+1 1770 gosub MAKE.SCORE 1780 M$=" Incorrect SCORE " 1790 M$=M$+str$( SCORE )+" " 1800 gosub TITLE 1810 sound 1, 8, 4, 2, 99 1820 sound 1, 0, 0, 0, 0 1830 goto PUZZLE 1840 ' 1850 '---------------------- 1860 GOT.ONE: 1870 RIGHT=RIGHT+1 1880 B( R, C )=1 1890 gosub MAKE.SCORE 1900 M$=" CORRECT "+str$( RIGHT ) 1910 M$=M$+" -"+str$( WRONG ) 1920 M$=M$+" SCORE "+str$( SCORE ) 1930 M$=M$+" " 1940 gosub TITLE 1950 NX=R*24-14 1960 NY=C*24-14 1970 gosub PLOTBIG 1980 if RIGHT<48 then goto PUZZLE 1990 ' 2000 gotoxy 2, 0 2010 color 15 2020 B.LOOP: 2030 gosub mouse 2040 if b<>1 then goto B.LOOP 2050 goto MAIN 2060 ' 2070 '-------------------------- 2080 GRID: 2090 color 1, 1, 1 2100 for X=10 to 202 step 24 2110 linef X,10,X,154 2120 linef 10,X,202,X 2130 next X 2140 return 2150 ' 2160 '-------------------------- 2170 PLOTBIG: 2180 A=R*8+212 2190 B=C*8+92 2200 for I=0 to 7 2210 for J=0 to 7 2220 X=I+A 2230 Y=B+J 2240 gosub LOCATE 2250 color 1,LC,LC 2260 X1=I*3+NX 2270 Y1=J*3+NY 2280 X2=I*3+NX+2 2290 linef X1,Y1,X2,Y1 2300 linef X1,Y1+1,X2,Y1+1 2310 linef X1,Y1+2,X2,Y1+2 2320 next J 2330 if NX<210 then sound 1,8,I+4,5,0 2340 if NX>=210 then sound 1,6,10-I,3,0 2350 next I 2360 sound 1,0,0,0,0 2370 return 2380 ' 2390 '----------------- 2400 MAKE.SCORE: 2410 SCORE=( RIGHT-WRONG )*100 2420 SCORE=SCORE-int( TIMER/10 ) 2430 return 2440 ' 2450 '----------------- 2460 TITLE: 2470 M$=M$+chr$( 0 ) 2480 A#=GB 2490 GINTIN=peek( A#+8 ) 2500 poke GINTIN,peek( SYSTAB+8 ) 2510 poke GINTIN+2,2 2520 V#=GINTIN+4 2530 poke V#,varptr( M$ ) 2540 gemsys( 105 ) 2550 return 2560 ' 2570 '------------------ 2580 MOUSE: 2590 poke CONTRL,124 2600 poke CONTRL+2,0 2610 poke CONTRL+6,0 2620 vdisys( 0 ) 2630 X=peek( PTSOUT ) 2640 Y=peek( PTSOUT+2 ) 2650 B=peek( INTOUT ) 2660 return 2670 ' 2680 '------------------ 2690 SETCOLOR: 2700 restore COLOR.DATUM 2710 for I=0 to 1 2720 read A 2730 R=int( A/100 ) 2740 G=int(( A-R*100 )/10 ) 2750 B=A-R*100-G*10 2760 poke CONTRL,14 2770 poke CONTRL+2,0 2780 poke CONTRL+6,4 2790 poke INTIN,I 2800 poke INTIN+2,R*140 2810 poke INTIN+4,G*140 2820 poke INTIN+6,B*140 2830 vdisys( 0 ) 2840 next I 2850 A#=GB 2860 GINTIN=peek( A#+8 ) 2870 poke GINTIN,3 2880 gemsys( 78 ) 2890 return 2900 ' 2910 COLOR.DATUM: 2920 data 030,777 2930 ' 2940 '----------------------- 2950 LOCATE: 2960 poke CONTRL,105 2970 poke CONTRL+2,1 2980 poke CONTRL+6,0 2990 poke PTSIN,X+1 3000 poke PTSIN+2,y+22 3010 vdisys( 0 ) 3020 LC=peek( INTOUT+2 ) 3030 return