8-Bit Software Online Conversion

Octagram. Brain Teaser - Listing

10REM Octagram Loader 20REM by M.Bobrowski 11'93 30: 40MODE 1:LOMEM=PAGE+&F00:B%=8+?&18:K% =PAGE+&844:VDU 19,0,1;0;19,1,0;0;23,224, 63600;63736;112;0; 50K%?5=B%:K%?24=B%:K%?34=B%:K%?42=B%: K%?50=B%+7:CALL K% 60PROCoctagram(160,624):PROCoctagram( 160,192) 70PROCarrow:PROCwindow 80PROCinstruct 90CHAIN"OCTAGRM" 100: 110DEF PROCoctagram(H%,V%) 120MOVE H%-96,V%:GCOL0,2:FOR A=0 TO 6* PI STEP 0.75*PI 130X%=H%+INT(COSA*96+0.5):Y%=V%+INT(SI NA*96+0.5):DRAW X%,Y% 140NEXT:MOVE H%,V%-96:DRAW H%,V%+96 150VDU5:FOR I%=1 TO 8 160READ X%,Y%,N$:MOVE H%+X%,V%+Y%:PRIN TN$ 170NEXT:GCOL0,3:MOVE H%-8,V%+8:VDU224, 4 180ENDPROC 190: 200DATA -128,12,1,-96,100,4,-12,132,7, 68,100,6,104,12,5,76,-67,2,-12,-108,8,-1 04,-67,3 210DATA -128,12,7,-96,100,8,-12,132,1, 68,100,2,104,12,3,72,-67,4,-12,-108,5,-1 00,-67,6 220: 230DEF PROCarrow 240GCOL 0,1:MOVE 176,460:MOVE 176,420: PLOT 85,144,460:PLOT 85,144,420 250MOVE 188,420:MOVE 160,360:PLOT 85,1 32,420:ENDPROC 260: 270DEF PROCwindow 280VDU 28,10,30,38,7:COLOUR 129:CLS 290GCOL 0,3:MOVE 320,32:DRAW 320,799:D RAW 1248,799:DRAW 1248,32:DRAW 320,32 300VDU 28,11,29,37,8:ENDPROC 310: 320DEF PROCinstruct 330PRINT "At the start of the game" 340PRINT'"you will see an octagram," 350PRINT'"or an eight-pointed star," 360PRINT'"with eight numbers randomly" 370PRINT "located at its points." 380PRINT'"Using an additional point" 390PRINT'"at the centre, move the" 400PRINT'"numbers to arrange them" 410PRINT'"clockwise, from 1 to 8," 420PRINT'"with '1' being at the top." 430PROCspace 440PRINT "The only allowed moves are" 450PRINT'"between points joined with" 460PRINT'"the straight line. Moreover" 470PRINT "you may move a number to a" 480PRINT'"new position (located at" 490PRINT'"the centre point or at the" 500PRINT'"periphery of octagram) only" 510PRINT "if this position is vacant." 520PROCspace 530PRINT "If all peripheral points" 540PRINT'"are occupied (as at the" 550PRINT'"start of the game) you can" 560PRINT'"move a number to the centre" 570PRINT "and keep it there till it" 580PRINT'"is needed while operating" 590PRINT'"other numbers." 600PROCspace 610PRINT"To move a number press the" 620PRINT'"corresponding numeric key." 630PRINT''" Use ESCAPE to restart," 640PRINT'" ESCAPE + SHIFT to exit." 650COLOUR2:PRINT''" Now press SPACE to start "; 660REPEAT UNTIL GET=32 670ENDPROC 680: 690DEF PROCspace 700COLOUR2:PRINT''" Press space to co ntinue"; 710REPEAT UNTIL GET=32:CLS:COLOUR3:END PROC