1 sf(1):getw%=screenwidth(0):geth%=screenheight(0):a100=100:a10=10:a9=9:a5=5

2 cls:gs 3000
3 rem 35 it #,42 it *
5 text%=0:ax%=400:ay%=-100
6 DIM A$(8):tipe0%=0:tipe1%=0:tipe2%=0:time%=0

9 a%=0:dim lvwin%(900):dim lvtime%(900):dim s1%(405):dim s2%(405):dim s3%(25):dim a1%(81):dim a2%(81):dim sud%(81)
10 for g%=0 to 4:gl str$(g%),"Menu/"+str$(g%+1)+".png":next g%:gl "sudoku","sudoku.png"
11 gl "a","cursor0.png":sg "a","a":sm "a",0,-99:kolv%=-1:for g%=0 to 899:lvwin%(g%)=0:lvtime%(g%)=3599000:next g%:for g%=0 to 80:a1%(g%)=0:a2%(g%)=0:sud%(g%)=0:next g%
12 for g%=0 to 404:s1%(g%)=0:s2%(g%)=0:next g%:for g%=0 to 24:s3%(g%)=-2:next g%
13 for g%=0 to 3:gl "min"+str$(g%),"Mini/"+str$(g%)+".png":next g%:gl "lv","lvsel.png":gl "winer","winer.png": gl "nos","nosave.png":gl "yess","yessave.png"
15 if readdir$("lv")<>"" then goto 18
16 gosub 9900
17 gt 1000

18 gosub 9910

29 goto 1000
30 goto 1001
31 goto 1001

80 goto 110
105 close #0:cls:ds str$(err(0)),0,90:ds "Ãîëîâîëîìêà",0,0:ds "íå çàãðóæåíà!",0,20:ds "Íå íàéäåí",0,50:ds "ôàéë :o(",0,70:re:SL 2000:GT 30

110 trap 105:open #0,"/Maps/map"+str$(world%)+"/file"+str$(lv%/10)+".txt","input"
111 if mod(lv%,10)>0 th for g%=0 to 80+(mod(lv%,10)-1)*81:get #0,b%:next g%
115 for g%=0 to 80
120 get #0,b%
130 a2%(g%)=1:a1%(g%)=b%-48:if a1%(g%)=0 th a2%(g%)=0
139 next g%:close #0

150 rem èíèöèàëèçàöèéààà:

200 rem go to new game
210 gt 1200

650 rem check
660 gt%=0:for g%=0 to 8
665 if a1%(g%*9)+a1%(g%*9+1)+a1%(g%*9+2)+a1%(g%*9+3)+a1%(g%*9+4)+a1%(g%*9+5)+a1%(g%*9+6)+a1%(g%*9+7)+a1%(g%*9+8)<>45 then gt%=1
667 if a1%(0+g%)+a1%(9+g%)+a1%(18+g%)+a1%(27+g%)+a1%(36+g%)+a1%(45+g%)+a1%(54+g%)+a1%(63+g%)+a1%(72+g%)<>45 th gt%=1
670 next g%
673 for h%=0 to 2:for g%=0 to 2:if a1%(h%*27+g%*3)+a1%(h%*27+g%*3+1)+a1%(h%*27+g%*3+2)+a1%(h%*27+g%*3+9)+a1%(h%*27+g%*3+10)+a1%(h%*27+g%*3+11)+a1%(h%*27+g%*3+18)+a1%(h%*27+g%*3+19)+a1%(h%*27+g%*3+20)<>45 th gt%=1
680 next g%:next h%

689 if gt%=1 th gt 1240


690 sc 200,255,200:fr 0,0,getw%,geth%:sc 0,0,0:dg "min0",0,geth%-25:sm "a",0,-99
695 ds "ÏÎÇÄÐÀÂËßÞ!!!",getw%/2-stw("ÏÎÇÄÐÀÂËßÞ!!!")/2,0:ds "ÂÑÅ ÂÅÐÍÎ!",getw%/2-STW("ÂÑÅ ÂÅÐÍÎ!")/2,sth("Z")
696 if world%>-1 th gt 710

698 re:gs 9900:sl 200
699 if inkey(0)=42 th sl%=15:gt 1001
700 sl 35:gt 699
710 lvwin%(world%*100+lv%)=lvwin%(world%*100+lv%)+1
720 if lvtime%(world%*100+lv%)>time% th sc 0,0,200:ds "ÐÅÊÎÐÄ ÂÐÅÌÅÍÈ!",getw%/2-stw("ÐÅÊÎÐÄ ÂÐÅÌÅÍÈ!")/2,sth("Z")*2:sc 0,200,200:lvtime%(world%*100+lv%)=time%
725 gt 698



900 cur%=0
905 dim te$(4):dim hey%(4):te$(0)="Î èãðå":te$(1)="Î óïðàâëåíèè":te$(2)="Êàê èãðàòü":te$(3)="Ïðî÷åå":sc 200,255,200:fr 0,0,getw%,geth%
906 for g%=0 to 3:sc 180,230,180:dr getw%/a10,(geth%-105)/a5+g%*(20+(geth%-105)/a5),getw%-getw%/a5-1,19
908 hey%(g%)=(geth%-105)/a5+g%*(20+(geth%-105)/a5):sc 0,0,210:ds te$(g%),getw%/2-stw(te$(g%))/2,hey%(g%):next g%:dg "min0",0,geth%-25:dg "min1",getw%/2-12,geth%-25
910 if up(0) and sl%<0 and cur%>0 th cur%=cur%-1:sl%=7
915 if down(0) and sl%<0 and cur%<3 th cur%=cur%+1:sl%=7
917 if inkey(0)=42 and sl%<0 th sl%=15:gt 1001
918 if fire(0) and sl%<0 th sl%=15:gt 940
920 if ax%<>getw%/2 th ax%=ax%+((getw%/2)-ax%)/a100*40
923 if ay%<>hey%(cur%)+10 th ay%=ay%+((hey%(cur%)+10)-ay%)/a100*40
926 sm "a",ax%,ay%:sl%=sl%-1:re:gt 910

940 if cur%=0 th gt 945
941 if cur%=1 th gt 950
942 if cur%=2 th gt 955
943 if cur%=3 th gt 960
944 end
945 tet$="Ãîëîâîëîìêà ñóäîêó äë$ ìîáèëüíûõ òåëåôîíîâ>>Àâòîð: Grizzler>grizz0@mail.ru>>R183744810716>Z240206789500>E174067514214>U130580497254>B884043522425"
946 gs 1400:title$="Î èãðå":gs 1500:gt 905
950 tet$="Â èãðå ÷òîáû ïåðåìåñòèòü êóðñîð, íóæíî íàæàòü êíîïêó 2,4,6 èëè 8>>×òîáû ïåðåéòè â ïðåäûäóùåå ìåíþ íóæíî íàæàòü êíîïêó *>>×òîáû ïåðåéòè â ñëåäóùåå ìåíþ íåîáõîäèìî íàæàòü êíîïêó 5>>"
951 tet$=tet$+"×òîáû óäàëèòü íåíóæíîå ñîõðàíåíèå, èëè öèôðó íàæìèòå êíîïêó 0>>×òîáû ïðîéòè óðîâåíü íóæíî çàïóñòèòü ïðîâåðêó ãîëîâîëîìêè - êíîïêîé #>>×òîáû ïðèáàâèòü èëè îòí$òü èç âûáðàííîé öèôðû(âíèçó) åäèíèöó, íóæíî íàæàòü êíîïêó 7 èëè 9"
954 gs 1400:title$="Óïðàâëåíèå":gs 1500:gt 905
955 tet$="×òîáû ðåøèòü ãîëîâîëîìêó, íóæíî çàïîëíèòü ïóñòûå êëåòêè öèôðàìè îò 1 äî 9 òàê ÷òîáû:>â ëþáîì ñòîëáöå>â ëþáîé ñòðîêå>â ëþáîì áëîêå 3õ3>íå áûëî îäèíàêîâûõ öèôð."
959 gs 1400:title$="Êàê èãðàòü":gs 1500:gt 905
960 tet$="ÑÏÀÑÈÁÎ>ÇÀ>ÈÃÐÓ!!!"
964 gs 1400:title$="Ïðî÷åå":gs 1500:gt 905

1000 chf%=0
1001 sc 200,255,200:fr 0,0,getw%,geth%:sc 0,0,0:dim menuy%(5)
1002 sl%=7:menuy%(0)=30:for g%=1 to 4:menuy%(g%)=menuy%(g%-1)+20+(geth%-30-20*5)/5:next g%:for g%=0 to 4:dg str$(g%),(getw%-120)/2,menuy%(g%):next g%:dg "sudoku",getw%/2-gw("sudoku")/2,0:dg "min0",0,geth%-25:dg "min1",getw%/2-12,geth%-25

1004 mup%=0:if up(0) th mup%=1
1005 mdown%=0:if down(0) th mdown%=1
1007 if mup%=1 and sl%<0 th if chf%>0 th chf%=chf%-1:sl%=7
1008 if mdown%=1 and sl%<0 th if chf%<4 th chf%=chf%+1:sl%=7
1010 if mdown%=1 and sl%<0 th if chf%=4 th chf%=0:sl%=7
1011 if mup%=1 and sl%<0 th if chf%=0 th chf%=4:sl%=7
1012 if sl%<0 and fire(0) th sl%=15:gt 1020
1014 if sl%<0 and inkey(0)=42 th gt 1865
1015 if ax%<>getw%/2-5 th ax%=ax%+((getw%/2-5)-ax%)/a100*40
1016 if ay%<>menuy%(chf%)+8 th ay%=ay%+((menuy%(chf%)+8)-ay%)/a100*40
1017 sm "a",ax%,ay%:re:sl%=sl%-1:gt 1004
1020 if chf%=0 th gt 5000
1021 if chf%=1 th gt 2600
1022 if chf%=2 then gt 1600
1023 if chf%=3 then gt 4500
1024 if chf%=4 then gt 900

1030 goto 1000




1200 box%=10:numb%=1:time%=0
1205 mil%=milliseconds(0):dim sudx%(9):dim sudy%(9)
1206 if getw%>=geth%-25 th i%=(getw%-(geth%-25+geth%/a100*10))/2:dr%=(geth%-geth%/a100*10-25)/a9:for g%=0 to 8:sudx%(g%)=getw%/a100*10+g%*dr%+i%:sudy%(g%)=geth%/a100*10+g%*dr%:next g%:gt 1210
1207 dr%=(getw%-getw%/a100*20)/a9:for g%=0 to 8:sudx%(g%)=getw%/a100*10+g%*dr%:sudy%(g%)=geth%/a100*10+g%*dr%:next g%

1210 sc 150,170,150:fr 0,0,getw%,geth%:sc 230,255,230:fr sudx%(0),sudy%(0),dr%*9,dr%*9
1211 sc 205,230,205:for g%=0 to 8:dl sudx%(g%),sudy%(0),sudx%(g%),sudy%(8)+dr%:dl sudx%(0),sudy%(g%),sudx%(8)+dr%,sudy%(g%):next g%:sc 0,0,0:for h%=0 to 2:for g%=0 to 2:dr sudx%(g%*3),sudy%(h%*3),dr%*3,dr%*3:next g%:next h%
1215 dg "min0",0,geth%-25:dg "min1",getw%/2-35,geth%-25:dg "min2",getw%/2+10,geth%-25:dg "min3",getw%-25,geth%-25
1220 gg "game",0,0,getw%,geth%:gs 1300


1240 if up(0) and sl%<0 th if box%/9>0 th box%=box%-9:sl%=7
1241 if up(0) and sl%<0 th if box%/9<1 th box%=80-8+mod(box%,9):sl%=7
1244 if down(0) and sl%<0 th if box%/9<8 th box%=box%+9:sl%=7
1245 if down(0) and sl%<0 th if box%/9>7 th box%=mod(box%,9):sl%=7
1248 if left(0) and sl%<0 th if mod(box%,9)>0 th box%=box%-1:sl%=7
1249 if left(0) and sl%<0 th if mod(box%,9)<1 th box%=box%+8:sl%=7
1252 if right(0) and sl%<0 th if mod(box%,9)<8 th box%=box%+1:sl%=7
1253 if right(0) and sl%<0 th if mod(box%,9)>7 th box%=box%-8:sl%=7
1260 if inkey(0)=55 and sl%<0 th if numb%>1 th numb%=numb%-1:sl%=7:gs 1300
1261 if inkey(0)=55 and sl%<0 th if numb%<2 th numb%=9:sl%=7:gs 1300
1262 if inkey(0)=57 and sl%<0 th if numb%<9 th numb%=numb%+1:sl%=7:gs 1300
1263 if inkey(0)=57 and sl%<0 th if numb%>8 th numb%=1:sl%=7:gs 1300
1270 if fire(0) and sl%<0 th if a2%(box%)=0 and a1%(box%)=0 th a1%(box%)=numb%:sl%=7:gs 1300
1272 if inkey(0)=48 and sl%<0 th if a2%(box%)=0 and a1%(box%)>0 th a1%(box%)=0:sl%=7:gs 1300
1273 if inkey(0)=42 and sl%<0 th sl%=15:gt 1700
1274 if inkey(0)=35 and sl%<0 th sl%=10:gt 660
1275 if ax%<>sudx%(mod( box%,9))+dr%/2 th ax%=ax%+((sudx%(mod(box%,9))+ dr%/2)-ax%)/a100*40
1278 if ay%<>sudy%(box%/9)+dr%/2 th ay%=ay%+((sudy%(box%/9)+dr% /2)-ay%)/a100*40

1290 sl%=sl%-1:sm "a",ax%,ay%:re:time%=time%+(milliseconds(0)-mil%):mil%=milliseconds(0):gt 1240
1300 dg "game",0,0:for h%=0 to 8:for g%=0 to 8:if a1%(h%*9+g%)<1 th gt 1315
1310 dg "f"+str$(text%)+"f"+str$(a2%(h%*9+g%))+"f"+str$(a1%(h%*9+g%)),sudx%(g%)+dr%/2-gwid%(text%)/2,sudy%(h%)+dr%/2-ghei%(text%)/2
1315 next g%:next h%:dg "f5f0f"+str$(numb%),getw%/2-gwid%(5)/2,geth%-ghei%(5)
1320 ret

1400 dim te$(100):for g%=0 to 99:te$(g%)="":next g%:mate%=0:for g%=0 to len(tet$)-1:gg$=mid$(tet$,g%+1,1)
1410 if gg$="$" th gg$=chr$(1103)
1420 if gg$=">" th mate%=mate%+1:gt 1450
1430 if stw(te$(mate%)+gg$)>getw% th mate%=mate%+1
1440 te$(mate%)=te$(mate%)+gg$ 
1450 next g%:ret

1500 maup%=(geth%-(31+sth(title$)))/(sth("Z")+0):may%=0-maup%/2
1501 sc 200,255,200:fr 0,0,getw%,geth%:dg "min0",0,geth%-25
1503 sc 0,0,0:for h%=-1 to 1:for g%=-1 to 1:ds title$,getw%/2-stw(title$)/2+g%,3+h%:next g%:next h%:sc 255,255,255:ds title$,getw%/2-stw(title$)/2,3
1510 g%=may%:sc 0,50,0
1515 if g%<0 or g%>mate% th gt 1530
1520 ds te$(g%),getw%/2-stw(te$(g%))/2,6+sth("Z")+(g%-may%)*sth("Z")
1530 g%=g%+1:if g%>may%+maup% th gt 1540
1535 gt 1515

1540 if up(0) and sl%<0 th if may%>0-maup% th may%=may%-1:sl%=3:gt 1501
1545 if down(0) and sl%<0 th if may%<mate% th may%=may%+1:sl%=3:gt 1501
1550 if inkey(0)=42 and sl%<0 th sl%=15:ret
1555 
1560 sm "a",-900,0:re:sl%=sl%-1:gt 1540


1600 cur%=0
1601 sc 200,255,200:fr 0,0,getw%,geth%
1602 if s3%(cur%*5)=-1 th sc 140,140,180:ds "ñëó÷àéíà"+chr$(1103)+" èãðà",0,0:ds "âðåì"+chr$(1103)+" èãðû: "+str$(s3%(cur%*5+2)/60000)+":"+str$(mod(s3%(cur%*5+2),60000)/1000),0,sth("z")
1603 if s3%(cur%*5)>-1 th sc 140,140,180:ds "êàðòà: "+str$(s3%(cur%*5)+1)+"; óð: "+str$(s3%(cur%*5+1)+1),0,0:ds "âðåì"+chr$(1103)+" èãðû: "+str$(s3%(cur%*5+2)/60000)+":"+str$(mod(s3%(cur%*5+2),60000)/1000),0,sth("z")

1605 dim gg%(5):for g%=0 to 4
1610 gg%(g%)=((getw%-(getw%/a10*5))/6)+g%*(((getw%-(getw%/a10*5))/6)+getw%/a10):dr%=getw%/a10

1620 sc 160,215,160:dr gg%(g%)+1,geth%/2-dr%/2+1,dr%-1,dr%-1:dg "f0f0f"+str$(g%+1),gg%(g%)+dr%/2-gwid%(0)/2,geth%/2-ghei%(0)/2
1622 sc 0,0,0:dr gg%(g%),geth%/2-dr%/2,dr%-1,dr%-1

1625 if s3%(g%*5)=-2 th sc 255,0,0:dl gg%(g%)-2,geth%/2-dr%/2-2,gg%(g%)+dr%+2,geth%/2-dr%/2+dr%+2
1626 next g%:dg "min0",0,geth%-25:dg "min1",getw%/2-26,geth%-25:dg "min2",getw%/2+1,geth%-25
1630 h%=0:if inkey(0)=42 and sl%<0 th sl%=15:gt 1001
1632 if fire(0) and sl%<0 th if s3%(cur%*5)>-2 th for g%=0 to 80:a1%(g%)=s1%(cur%*81+g%):a2%(g%)=s2%(cur%*81+g%):next g%:world%=s3%(cur%*5):lv%=s3%(cur%*5+1):time%=s3%(cur%*5+2):box%=s3%(cur%*5+3):numb%=s3%(cur%*5+4):sl%=15:gt 1205
1633 if inkey(0)=48 and sl%<0 th if s3%(cur%*5)>-2 th for g%=0 to 80:s1%(cur%*81+g%)=0:s2%(cur%*81+g%)=0:next g%:s3%(cur%*5)=-2:s3%(cur%*5+1)=-2:s3%(cur%*5+2)=-2:s3%(cur%*5+3)=-2:s3%(cur%*5+4)=-2:sl%=15:h%=1

1635 if left(0) and sl%<0 th cur%=cur%-1:h%=1:sl%=7
1640 if right(0) and sl%<0 th cur%=cur%+1:h%=1:sl%=7
1645 if cur%<0 th cur%=4
1650 if cur%>4 th cur%=0
1655 if ay%<>geth%/2 th ay%=ay%+(geth%/2-ay%)/a100*40
1660 if ax%<>gg%(cur%)+dr%/2 th ax%=ax%+((gg%(cur%)+dr%/2)-ax%)/a100*40
1665 sm "a",ax%,ay%:sl%=sl%-1:re:if h%=1 th gt 1601
1670 gt 1630


1700 g%=0:h%=getw%/2-getw%/a100*5-25
1710 sc 200,255,200:fr 0,0,getw%,geth%:sc 100,155,100
1715 ds "Âðåì"+chr$(1103)+" èãðû: "+str$(time%/60000)+" ìèí. "+str$(mod(time%,60000)/1000)+" ñåê."+str$(mod(time%,1000))+" ìñ.",0,geth%-25-sth("A")/a100*150

1720 if g%<0 th dg "yess",getw%/2+(h%/a100)*(100-abs(g%))-25,3:dg "f0f0f6",getw%/2+(h%/a100)*(100-abs(g%))-21,50-ghei%(0)-1:dg "nos",getw%/2-(h%/a100)*(100-abs(g%))-25,3:dg "f0f0f4",getw%/2-(h%/a100)*(100-abs(g%))-21,50-ghei%(0)-1
1725 if g%>=0 th dg "nos",getw%/2-(h%/a100)*(100-abs(g%))-25,3:dg "f0f0f4",getw%/2-(h%/a100)*(100-abs(g%))-21,50-ghei%(0)-1:dg "yess",getw%/2+(h%/a100)*(100-abs(g%))-25,3:dg "f0f0f6",getw%/2+(h%/a100)*(100-abs(g%))-21,50-ghei%(0)-1
1730 dg "min0",0,geth%-25

1740 if right(0) th gs 1761
1745 if left(0) th gs 1765
1746 if inkey(0)=42 and sl%<0 th sl%=15:mil%=milliseconds(0):gs 1300:goto 1240 
1747 if not left(0) and not right(0) th i%=getw%/2
1748 if g%<0 th g%=g%+3
1749 if g%>0 th g%=g%-3

1750 if g%>100 th sl%=15:gt 1770
1752 if g%<-100 th sl%=15:gt 1001

1754 if ay%<>28 th ay%=ay%+(28-ay%)/a100*40
1755 if ax%<>i% th ax%=ax%+(i%-ax%)/a100*40
1760 sl%=sl%-1:sm "a",ax%,ay%:re:gt 1710
1761 if g%<0 th g%=abs(g%)
1762 g%=g%+6
1763 i%=getw%/2+(h%/a100)*(100-abs(g%))
1764 ret
1765 if g%>0 th g%=0-g%
1766 g%=g%-6
1767 i%=getw%/2-(h%/a100)*(100-abs(g%))
1768 ret

1770 cur%=0:g%=0:h%=0:i%=0
1780 sc 200,255,200:fr 0,0,getw%,geth%
1782 if s3%(cur%*5)=-1 th sc 140,140,180:ds "ñëó÷àéíà"+chr$(1103)+" èãðà",0,0:ds "âðåì"+chr$(1103)+" èãðû: "+str$(s3%(cur%*5+2)/60000)+":"+str$(mod(s3%(cur%*5+2),60000)/1000),0,sth("z")
1783 if s3%(cur%*5)>-1 th sc 140,140,180:ds "êàðòà: "+str$(s3%(cur%*5)+1)+"; óð: "+str$(s3%(cur%*5+1)+1),0,0:ds "âðåì"+chr$(1103)+" èãðû: "+str$(s3%(cur%*5+2)/60000)+":"+str$(mod(s3%(cur%*5+2),60000)/1000),0,sth("z")

1785 dim gg%(5):for g%=0 to 4
1790 gg%(g%)=((getw%-(getw%/a10*5))/6)+g%*(((getw%-(getw%/a10*5))/6)+getw%/a10):dr%=getw%/a10
1795 sc 160,215,160:dr gg%(g%)+1,geth%-26-dr%+1,dr%-1,dr%-1:dg "f0f0f"+str$(g%+1),gg%(g%)+dr%/2-gwid%(0)/2,geth%-26-dr%/2-ghei%(0)/2
1800 sc 0,0,0:dr gg%(g%),geth%-26-dr%,dr%-1,dr%-1
1805 if s3%(g%*5)=-2 th sc 255,0,0:dl gg%(g%)-2,geth%-26-dr%-2,gg%(g%)+dr%+2,geth%-26+1
1808 next g%:dg "min0",0,geth%-25:dg "min1",getw%/2-12,geth%-25
1810 h%=0:if inkey(0)=42 and sl%<0 th sl%=15:gt 1700
1815 if left(0) and sl%<0 th cur%=cur%-1:sl%=7:h%=1
1820 if right(0) and sl%<0 th cur%=cur%+1:sl%=7:h%=1
1825 if cur%<0 th cur%=4:h%=1
1830 if cur%>4 th cur%=0:h%=1
1835 if fire(0) and sl%<0 th sl%=15:gt 1861
1840 if ay%<>geth%-26-dr%/2 th ay%=ay%+((geth%-26-dr%/2)-ay%)/a100*40
1845 if ax%<>gg%(cur%)+dr%/2 th ax%=ax%+((gg%(cur%)+dr%/2)-ax%)/a100*40
1846 if h%=1 th gt 1780
1850 sm "a",ax%,ay%:sl%=sl%-1:re:gt 1810
1861 for g%=0 to 80:s1%(cur%*81+g%)=a1%(g%):s2%(cur%*81+g%)=a2%(g%):next g%
1862 s3%(cur%*5)=world%:s3%(cur%*5+1)=lv%:s3%(cur%*5+2)=time%:s3%(cur%*5+3)=box%:s3%(cur%*5+4)=numb%:gs 9900:gt 1001


1865 for i%=2 to 0 step -1:sc 70,70,70:frr 0,geth%/2+(geth%/2)/3*i%,getw%,geth%/2+10,10,10:sc 255,255,255
1866 ds "Íàæìèòå * åùå ðàç",getw%/2-stw("Íàæìèòå * åùå ðàç")/2,geth%/2+3+(geth%/2)/3*i%
1867 ds "÷òîáû âûéòè",getw%/2-stw("÷òîáû âûéòè")/2,geth%/2+3+sth("Z")+(geth%/2)/3*i%:re:next i%
1868 g%=0:re
1870 if inkey(0)<>0 th if not inkey(0)=42 th sl%=7:gt 1001
1871 if inkey(0)=42 and g%=1 th end
1872 if not inkey(0)=42 and g%=0 th g%=1
1875 sl 30:gt 1870



2600 world%=4
2602 sc 200,255,200:fr 0,0,getw%,geth%:sc 0,0,200
2605 dim m0x%(9):dim m0y%(9):for h%=0 to 2:for g%=0 to 2:m0x%(h%*3+g%)=((getw%/4)+g%*(getw%/4))-10:m0y%(h%*3+g%)=geth%/a100*20+(20+(geth%/a100*60-60)/3)*h%
2606 gg%=0:for i%=0 to 99:if lvwin%((h%*3+g%)*100+i%)>0 th gg%=gg%+1
2607 next i%:sc 0,0,255:fr m0x%(h%*3+g%),m0y%(h%*3+g%),19,gg%/a100*19:sc 80,160,80:drawrect m0x%(h%*3+g%),m0y%(h%*3+g% ),19,19
2610 dg "f0f0f"+str$(h%*3+g%+1),m0x%(h%*3+g%)+7,m0y%(h%*3+g%)+4
2620 next g%:next h%:dg "min1",getw%/2-12,geth%-25:dg "min0",0,geth%-25
2630 if fire(0) and sl%<0 th sl%=15:gt 2700
2635 if left(0) and sl%<0 th if mod(world%,3)>0 th world%=world%-1:sl%=6
2637 if right(0) and sl%<0 th if mod(world%,3)<2 th world%=world%+1:sl%=6
2638 if up(0) and sl%<0 th if world%/3>0 th world%=world%-3:sl%=6
2639 if down(0) and sl%<0 th if world%/3<2 th world%=world%+3:sl%=6
2642 if inkey(0)=42 and sl%<0 th sl%=15:gt 1001
2650 if ax%<>m0x%(mod(world%,3)+world%/3*3)+8 th ax%=ax%+((m0x%(mod(world%,3)+cur%/3*3)+8)-ax%)/a100*40
2652 if ay%<>m0y%(mod(world%,3)+world%/3*3)+9 th ay%=ay%+((m0y%(mod(world%,3)+world%/3*3)+9)-ay%)/a100*40


2660 sm "a",ax%,ay%:re:sl%=sl%-1:gt 2630


2700 sqip%=0:lv%=0:maxx0%=(getw%/2)/80+1:maxy0%=(geth%/2)/50+1:mex%=0:mey%=0:dim pix%(100):dim piy%(100)
2701 for h%=0 to 9:for g%=0 to 9:pix%(h%*10+g%)=getw%/2-35+(g%*80):piy%(h%*10+g%)=geth%/2-20+(h%*50):next g%:next h%:sqip%=0:gt 2730

2702 sc 200,255,200:fr 0,0,getw%,geth%:sc 0,0,0
2705 for h%=lv%/10-maxy0% to lv%/10+maxy0%:for g%=mod(lv%,10)-maxx0% to mod(lv%,10)+maxx0%
2708  if h%<0 or h%>9 or g%<0 or g%>9 th gt 2720
2710 hh%=piy%(h%*10)-lv%/10*50+mey%:gg%=pix%(h%*10+g%)-mod(lv%,10)*80+mex%

2715 dg "lv",gg%,hh%:if sqip%=0 th sc 200,0,0:ds str$(h%*10+g%+1),gg%+40,hh%
2716 if lvwin%(world%*100+h%*10+g%)=0 th sc 0,0,0:dl gg%,hh%,gg%+70,hh%+40:gt 2720
2717 if sqip%=0 th sc 180,80,0:ds str$(lvtime%(world%*100+h%*10+g%)/60000)+":"+str$(mod(lvtime%(world%*100+h%*10+g%),60000)/1000),gg%+15,hh%+20

2720 next g%:next h%:dg "min0",0,geth%-25:dg "min1",getw%/2-12,geth%-25
2721 if lvwin%(world%*100+lv%)>0 th gt 2723
2722 gt 2725

2723 g$="x "+str$(lvwin%(world%*100+lv%)):sc 98,98,98:fr getw%/2-stw(g$)/2-11,1,stw(g$)+22,20:dg "winer",getw%/2-stw(g$)/2-10,1:sc 0,255,255:ds g$,getw%/2-stw(g$)/2+10,1
2725 ret

2730 if sl%<0 th mey%=0:mex%=0
2738 if left(0) and sl%<0 th if mod(lv%,10)>0 th mex%=-80:lv%=lv%-1:sl%=6
2740 if right(0) and sl%<0 th if mod(lv%,10)<9 th mex%=80:lv%=lv%+1:sl%=6
2743 if up(0) and sl%<0 th if lv%/10>0 th mey%=-50:lv%=lv%-10:sl%=6
2746 if down(0) and sl%<0 th if lv%/10<9 th mey%=50:lv%=lv%+10:sl%=6
2747 if fire(0) and sl%<0 th sl%=15:gt 110

2749 if inkey(0)=42 and sl%<0 th sl%=15:gt 2602
2756 if mex%<>0 th mex%=mex%+(0-mex%)/a100*60
2757 if mey%<>0 th mey%=mey%+(0-mey%)/a100*60


2760 sl%=sl%-1:if sl%>0 th sqip%=1:gs 2702
2761 if sl%=0 th sqip%=0:gs 2702
2765 if ax%<>getw%/2 th ax%=ax%+(getw%/2-ax%)/a100*40
2766 if ay%<>geth%/2 th ay%=ay%+(geth%/2-ay%)/a100*40

2770 sm "a",ax%,ay%:re:gt 2730


2799


3000 dim gwid%(6):dim ghei%(6):dim setc%(6):setc%(0)=80:setc%(1)=80:setc%(2)=80:setc%(3)=0:setc%(4)=0:setc%(5)=255
3003 for g%=0 to 5:gl "f"+str$(g%),"font"+str$(g%)+".png":gwid%(g%)=gelwidth("f"+str$(g%))/11:ghei%(g%)=gelheight("f"+str$(g%))
3005 
3010 for h%=0 to 1:sc setc%(h%*3),setc%(h%*3+1),setc%(h%*3+2):for i%=0 to 10:fr 0,0,getw%,ghei%(g%)+1:dg "f"+str$(g%),0-i%*gwid%(g%),0
3015 
3016 gelgrab "f"+str$(g%)+"f"+str$(h%)+"f"+str$(i%),0,0,gwid%(g%),ghei%(g%)
3018 cag "f"+str$(g%)+"f"+str$(h%)+"f"+str$(i%),1,1,0,0
3020 next i%:next h%


3050 next g%:ret
3060 
3070 


4500 cur%=0
4505 sc 200,255,200:fr 0,0,getw%,geth%:sc 0,0,0
4510 h%=0:ds "Øðèôò",getw%/2-stw("Øðèôò")/2,geth%/2-sth("Z")
4520 dg "f"+str$(text%)+"f"+str$(1)+"f"+str$(text%+1),getw%/2-gwid%(text%)/2,geth%/2:dg "min0",0,geth%-25
4525 if cur%=0 th g%=getw%/2+gwid%(text%)/2:h%=geth%/2+ghei%(text%)/2
4530 if inkey(0)=42 and sl%<0 th sl%=15:gs 9900:gt 1001
4540 if right(0) and sl%<0 and cur%=0 th sl%=7:gs 4570
4542 if left(0) and sl%<0 and cur%=0 th sl%=7:gs 4580

4545 if up(0) and sl%<0 and cur%>0 th cur%=cur%-1:sl%=7
4550 if down(0) and sl%<0 and cur%<0 th cur%=cur%+1:sl%=7
4555 if ay%<>h% th ay%=ay%+(h%-ay%)/a100*40
4557 if ax%<>g% th ax%=ax%+(g%-ax%)/a100*40
4560 sm "a",ax%,ay%:re:sl%=sl%-1:gt 4505

4570 text%=text%+1
4575 if text%>5 th text%=0
4577 ret
4580 text%=text%-1
4585 if text%<0 th text%=5
4587 ret



5000 for g%=0 to 80:a1%(g%)=0:a2%(g%)=0:next g%:gen1%=0:for g%=0 to 8:gen1%=g%+1:if gen1%>9 th gen1%=gen1%-9
5002 a1%(g%)=gen1%
5004 next g%

5005 gen1%=0:for g%=0 to 8:gen1%=g%+1+3:if gen1%>9 th gen1%=gen1%-9
5006 a1%(g%+9)=gen1%
5007 next g%

5010 gen1%=0:for g%=0 to 8:gen1%=g%+1+6:if gen1%>9 th gen1%=gen1%-9
5011 a1%(g%+18)=gen1%
5012 next g%

5015 gen1%=0:for g%=0 to 8:gen1%=g%+1+8:if gen1%>9 th gen1%=gen1%-9
5016 a1%(g%+27)=gen1%
5017 next g%

5020 gen1%=0:for g%=0 to 8:gen1%=g%+1+2:if gen1%>9 th gen1%=gen1%-9
5021 a1%(g%+36)=gen1%
5022 next g%

5025 gen1%=0:for g%=0 to 8:gen1%=g%+1+5:if gen1%>9 th gen1%=gen1%-9
5026 a1%(g%+45)=gen1%
5027 next g%

5030 gen1%=0:for g%=0 to 8:gen1%=g%+1+7:if gen1%>9 th gen1%=gen1%-9
5031 a1%(g%+54)=gen1%
5032 next g%

5035 gen1%=0:for g%=0 to 8:gen1%=g%+1+1:if gen1%>9 th gen1%=gen1%-9
5036 a1%(g%+63)=gen1%
5037 next g%

5040 gen1%=0:for g%=0 to 8:gen1%=g%+1+4:if gen1%>9 th gen1%=gen1%-9
5041 a1%(g%+72)=gen1%
5042 next g%

5050 for i%=0 to 19
5051 gen3%=rand(1,10):gen4%=rand(1,10):if gen3%=gen4% th gt 5051
5053 for g%=0 to 8:for h%=0 to 8
5055 if a1%(g%*9+h%)=gen3% th a1%(g%*9+h%)=gen4%:gt 5057
5056 if a1%(g%*9+h%)=gen4% th a1%(g%*9+h%)=gen3%
5057 next h%:next g%:next i%

5060 dim gena%(9):gt 5061+rand(0,6)
5061 gena%(0)=2:gena%(1)=3:gena%(2)=4:gena%(3)=3:gena%(4)=4:gena%(5)=4:gena%(6)=3:gena%(7)=3:gena%(8)=2:gt 5070
5062 gena%(0)=3:gena%(1)=7:gena%(2)=4:gena%(3)=3:gena%(4)=2:gena%(5)=3:gena%(6)=3:gena%(7)=4:gena%(8)=4:gt 5070
5063 gena%(0)=1:gena%(1)=5:gena%(2)=4:gena%(3)=5:gena%(4)=3:gena%(5)=7:gena%(6)=3:gena%(7)=4:gena%(8)=4:gt 5070
5064 gena%(0)=4:gena%(1)=6:gena%(2)=5:gena%(3)=4:gena%(4)=4:gena%(5)=4:gena%(6)=3:gena%(7)=3:gena%(8)=3:gt 5070
5065 gena%(0)=3:gena%(1)=4:gena%(2)=1:gena%(3)=4:gena%(4)=4:gena%(5)=5:gena%(6)=4:gena%(7)=5:gena%(8)=3:gt 5070
5066 gena%(0)=4:gena%(1)=5:gena%(2)=4:gena%(3)=4:gena%(4)=3:gena%(5)=4:gena%(6)=4:gena%(7)=3:gena%(8)=3


5070 for g%=1 to 9
5071 i%=rand(0,9):if 9-gena%(i%)<1 th gt 5080
5072 ii%=rand(0,9):for h%=0 to 8
5073 if a1%(ii%*9+h%)=g% then a1%(ii%*9+h%)=0:gena%(i%)=gena%(i%)+1:h%=99:next h%:gt 5085
5074 next h%:gt 5072
5080 for h%=0 to 8:if 9-gena%(h%)<1 th next h%:gt 5100
5081 i%=h%:h%=99:next h%:gt 5072

5085 if 9-gena%(i%)<1 th next g%:gt 5100
5086 gt 5072




5100 for g%=0 to 80:a2%(g%)=0:if a1%(g%)>0 th a2%(g%)=1
5110 next g%:world%=-1:lv%=0:gt 1200



9900 trap 9909
9901 open #5,"lv","output":pr #5,text%
9905 for g%=0 to 899:pr #5,lvwin%(g%):pr #5,lvtime%(g%):next g%
9907 for g%=0 to 404:pr #5,s1%(g%):pr #5,s2%(g%):next g%:for g%=0 to 24:pr #5,s3%(g%):next g%
9909 close #5:return

9910 trap 9909
9911 open #5,"lv","input":in #5,text%
9915 for g%=0 to 899:in #5,lvwin%(g%):in #5,lvtime%(g%):next g%
9917 for g%=0 to 404:in #5,s1%(g%):in #5,s2%(g%):next g%:for g%=0 to 24:in #5,s3%(g%):next g%
9919 close #5:return

9996 rem èãðà:Sudoku
9997 rem àâòîð:GRIZZLER
9998 rem äàòà:26.08.13
9999 rem repak:17.04.14