8-Bit Software Online Conversion
:2.$.OctaGrm - Listing
10REM OCTAGRAM
20REM by M.Bobrowski 11'93
30:
40MODE 1:VDU 19,2,2;0;
50DIM X%(8),Y%(8),L$(8)
60PROCchars:PROCoctagram
70ON ERROR IF ERR=17 AND INKEY-1 THEN
130
80PROCinit:SOUND 1,-10,200,1
90M%=0:REPEAT:PROCinput:PROCmove:M%=M
%+1:UNTIL K$=" 12345678"
100CLS:PRINT"You have done it in ";M%'
"moves. ";:PROCtune
110COLOUR 2:PRINT"Again (Y/N) ? ";:REP
EAT:*FX15,1
120G$=GET$:UNTIL INSTR("YyNn",G$):IF I
NSTR("Yy",G$) THEN 80
130MODE 7:END
140:
150DEF PROCinit
160XX=RND(-TIME):K$="12345678":FOR J%=
1 TO 10
170A%=RND(8):REPEAT:B%=RND(8):UNTIL A%
<>B%
180IF A%>B% K$=LEFT$(K$,B%-1)+MID$(K$,
A%,1)+MID$(K$,B%+1,A%-B%-1)+MID$(K$,B%,1
)+MID$(K$,A%+1) ELSE K$=LEFT$(K$,A%-1)+M
ID$(K$,B%,1)+MID$(K$,A%+1,B%-A%-1)+MID$(
K$,A%,1)+MID$(K$,B%+1)
190NEXT:K$=" "+K$
200FOR I%=0 TO 8:PROCdisp(I%,I%,MID$(K
$,I%+1,1))
210NEXT:VDU 28,7,31,32,28,17,129,12,28
,8,30,31,29,17,128,12:ENDPROC
220:
230DEF PROCdisp(K%,J%,N$)
240VDU 5:MOVE X%(K%),Y%(K%):IF K%=0 OR
K% MOD2=1 GCOL 0,1 ELSE GCOL 0,2
250VDU 237:MOVE X%(J%),Y%(J%):GCOL 0,0
:PRINT N$:VDU 4:ENDPROC
260:
270DEF PROCinput
280REPEAT:CLS:COLOUR 2:PRINTTAB(6)"Mov
es : ";M%:COLOUR 3:PRINTTAB(5)"Your move
? ";:*FX15,1
290M$=GET$:N%=INSTR(K$,M$)-1:IF FNlink
SOUND 1,-10,200,1:UNTIL TRUE:L%=INSTR(K
$,M$) ELSE COLOUR 2:PRINTM$'TAB(5)"Illeg
al move ! ";:SOUND1,-10,10,10:XX=INKEY15
0:UNTIL FALSE
300ENDPROC
310:
320DEF FNlink:IF N%<0 OR N%>8 THEN =FA
LSE
330V%=INSTR(K$," ")-1:V$=STR$V%:=INSTR
(L$(N%),V$)
340:
350DEF PROCmove
360PROCdisp(N%,V%,M$)
370V%=V%+1:IF L%>V% K$=LEFT$(K$,V%-1)+
MID$(K$,L%,1)+MID$(K$,V%+1,L%-V%-1)+" "+
MID$(K$,L%+1) ELSE K$=LEFT$(K$,L%-1)+" "
+MID$(K$,L%+1,V%-L%-1)+MID$(K$,L%,1)+MID
$(K$,V%+1)
380ENDPROC
390:
400DEF PROCoctagram
410MOVE 256,576:FOR A=0 TO 6*PI STEP 3
*PI/4
420DRAW INT(640.5+384*COSA),INT(576.5+
384*SINA)
430NEXT:MOVE 640,192:DRAW 640,960
440VDU 5:FOR I%=0 TO 8:READ X%(I%),Y%(
I%),L$(I%):IF I%=0 OR I%MOD2=1 K%=1 ELSE
K%=2
450PROCcounter(X%(I%),Y%(I%),K%)
460NEXT:VDU 4
470ENDPROC
480:
490DATA 624,588,1357,624,972,046,896,8
60,57,1008,588,068,896,316,17,624,204,02
8,352,316,13,240,588,024,352,860,35
500:
510DEF PROCcounter(X%,Y%,K%)
520MOVE X%-32,Y%+32:GCOL 0,K%:PRINT W$
:MOVE X%-32,Y%+32:GCOL 0,3:PRINT Z$:MOVE
X%+4,Y%+36:PLOT 1,24,0:MOVE X%+64,Y%:PL
OT 1,0,-24:ENDPROC
530:
540DEF PROCchars
550VDU 23,224,1537;4104;8224;16448;23,
225,128;0;0;0;23,226,12480;1032;514;257;
23,227,32896;32896;32896;16512;23,228,0;
0;0;0;23,229,0;0;0;256;23,230,8256;4128;
1544;1;23,231,0;0;0;32640;23,232,513;102
6;12296;192;
560VDU 23,233,256;3847;7967;16191;23,2
34,65407;65535;65535;65535;23,235,49152;
63728;64764;65278;23,236,32639;32639;326
39;16255;23,237,65535;65535;65535;65535;
23,238,65535;65535;65535;65279;23,239,79
99;3871;263;0;
570VDU 23,240,65535;65535;65535;127;23
,241,64766;63740;49392;0;
580B$=CHR$10+CHR$8+CHR$8+CHR$8:W$=CHR$
233+CHR$234+CHR$235+B$+CHR$236+CHR$237+C
HR$238+B$+CHR$239+CHR$240+CHR$241:Z$=CHR
$224+CHR$225+CHR$226+B$+CHR$227+CHR$228+
CHR$229+B$+CHR$230+CHR$231+CHR$232:ENDPR
OC
590:
600DEF PROCtune
610RESTORE 630:FOR I%=1 TO 16:READ P%,
D%:SOUND 1,-10,P%,D%:SOUND 1,0,0,0:NEXT:
ENDPROC
620:
630DATA 89,8,93,6,93,10,97,6,97,10,101
,4,85,4,89,4,73,12,61,8,93,8,89,8,73,4,5
3,4,69,4,73,12