start tok64 d64-hDVTRr 5 SYS 12307 10 GOSUB490 20 po$="{home*2}{down*30}" 30 DIMa(16),b(16):tb=0:POKE53280,1:POKE53281,1 40 PRINT"{clear}{down}{black}{reverse on}"TAB(tb)"{cm a}{sh asterisk*4}{cm r}{sh asterisk*4}{cm r}{sh asterisk*4}{cm r}{sh asterisk*4}{cm s}" 50 FORi=1TO4:FORj=1TO3:PRINTTAB(tb);"{black}{reverse on}B{027}{space*4}{black}B{027}{space*4}{black}B{027}{space*4}{black}B{027}{space*4}{black}B":NEXTj 60 IFi<4THENPRINTTAB(tb);"{black}{reverse on}{cm q}{sh asterisk*4}{sh +}{sh asterisk*4}{sh +}{sh asterisk*4}{sh +}{sh asterisk*4}{cm w}" 70 NEXTi:PRINTTAB(tb);"{black}{reverse on}{cm z}{sh asterisk*4}{cm e}{sh asterisk*4}{cm e}{sh asterisk*4}{cm e}{sh asterisk*4}{cm w}" 80 PRINT"{blue}{down}{space*18}8{down}{left*2}4{sh +}6{down}{left*2}2{home} 90 FORi=1TO16:a(i)=i:NEXTi 100 FORi=15TO2STEP-1:j=RND(1)*i+1:t=a(j):a(j)=a(i):a(i)=t:NEXTi 110 FORi=1TO16:b(i)=a(i):IFb(i)=16THENbs=i 120 NEXTi 130 c=0:FORi=1TO16 140 IFa(i)<>iTHENt=a(i):a(i)=a(t):a(t)=t:c=c+1:GOTO140 150 NEXTi 160 IF(cAND1)=0THEN200 170 i=INT(RND(1)*16)+1:IFb(i)=16THEN170 180 j=INT(RND(1)*16)+1:IFb(j)=16ORi=jTHEN170 190 t=b(i):b(i)=b(j):b(j)=t 200 PRINT"{home}":PRINT"{down*2}"; 210 FORi=1TO16STEP4:FORj=0TO3:PRINTTAB(tb+j*5+2); 220 IFb(i+j)<16THENPRINT"{reverse on}{027}"RIGHT$(STR$(b(i+j)),2); 230 NEXTj:n=0:PRINT"{down*3}{blue}":NEXTi:PRINTLEFT$(po$,22);n;"drag" 240 GETz$:IFz$=""THEN240 250 IFz$="s"THEN480 260 IFz$<"2"ORz$>"8"THEN240 270 IFVAL(z$)AND1THEN240 280 ONVAL(z$)/2GOTO350,330,310,290 290 t=bs+4:IFt>16THEN240 300 GOTO360 310 t=bs-1:IF(3ANDt)=0THEN240 320 GOTO360 330 t=bs+1:IF(3ANDbs)=0THEN240 340 GOTO360 350 t=bs-4:IFt<1THEN240 360 b(bs)=b(t):b(t)=16 370 i=INT((bs-1)/4):j=bs-i*4 380 PRINT"{027}{reverse on}"LEFT$(po$,i*4+5):PRINT"{up}{reverse on}"TAB(tb+j*5-3)RIGHT$(STR$(b(bs)),2) 390 i=INT((t-1)/4):j=t-i*4 400 PRINT"{reverse on}"LEFT$(po$,i*4+5):PRINT"{up}{reverse on}"TAB(tb+j*5-3)"{space*2}" 410 bs=t:n=n+1:PRINT"{blue}"LEFT$(po$,22);STR$(n);" drag" 420 PRINT"{space*2}":IFbs<16THEN240 430 FORi=1TO16:IFb(i)<>iTHEN240 440 NEXTi:PRINT"{clear}{blue}"LEFT$(po$,20);"congratulations":PRINT"{down}"n"moves" 450 PRINT"{down}another go ?"; 460 GETi$:IFi$=""THEN460 470 IFi$="y"THENRUN 480 POKE53280,3:POKE53281,1:PRINT"{clear}{blue}";:END 490 POKE53280,2:POKE53281,21 500 PRINT"{clear}{yellow}***{space*3}vic 15{space*4}*** 510 PRINT"{down}din uppgift [r att 520 PRINT"flytta de numrerade 530 PRINT"fyrkanterna s] att 540 PRINT"de kommer i ordning. 550 PRINT"r[tt ordning [r: 560 PRINT" 1{space*2}2{space*2}3{space*2}4 570 PRINT" 5{space*2}6{space*2}7{space*2}8 580 PRINT" 9{space*2}10 11 12 590 PRINT" 13 14 15 600 PRINT"{down}du kan endast flytta 610 PRINT"en fyrkant till en 620 PRINT"n[rst]ende ledig ruta. 630 PRINT"anv[nd angivna tangenter 640 PRINT"f{pound}r r[tt riktning. 650 PRINT"{down}lycka till 660 PRINT"{space*5}{reverse on}tryck valfri tangent 670 GETa$:IFa$=""THEN670 680 PRINT"{clear}":POKE53272,21:RETURN stop tok64 (bastext 1.0)