use graph,math,ui; limit=65536; krokx=15; kroky=30; pocx=45; pocetpreskocit=10; sirka=graph.size()[0]; vyska=graph.size()[1]; function VypisNezname(od,do1,pocetpreskocit) if do1-od+1 > pocetpreskocit then print str(od)+'-'+str(do1); else print od; print do1; end; end; function ZjistiNeznamyZnak(pole,pozice) for y=len(pole)-1 to 0 by -1 do for x=len(pole[y])-1 to 0 by -1 do if (y >= pozice and y <= pozice+8 and (x = 2 or x = 8)) or (x >= 2 and x <= 8 and (y = pozice or y = pozice+8)) then if pole[y][x] = 16777215 then return false; end; else if pole[y][x] # 16777215 then return false; end; end; end; end; return true; end; function ZjistiPrazdnyZnak(pole) for y=len(pole)-1 to 0 by -1 do for x=len(pole[y])-1 to 0 by -1 do if pole[y][x] # 16777215 then return false; end; end; end; return true; end; function VypisStav(text) graph.pen(graph.white); graph.rect(0,.vyska-30,.sirka,30); graph.pen(graph.black); graph.text(.sirka-graph.size(text)[0]-10,.vyska-10,text); graph.show(); end; //cls(); graph.font(['Monospace',14,false,false]); uspech=true; znak=0; graph.brush(graph.white); while true do vypsane=[]; for pozy=20 to .vyska-30 by kroky do append(vypsane,[]); for pozx=pocx to .sirka-30 by krokx do graph.text(pozx,pozy,char([znak])); pixely=graph.get(pozx,pozy-20,11,30); uspechted=true; for i=1 to 21 do if pixely[i][2] # 16777215 then if ZjistiNeznamyZnak(pixely,i) then uspechted=false; end; break; end; end; if i > 21 then if ZjistiPrazdnyZnak(pixely) then uspechted=false; end; end; if uspechted then append(vypsane[len(vypsane)-1],znak); if pozx = pocx then graph.text(3,pozy,str(znak)); end; if uspech # true then // VypisNezname(uspech,znak-1,pocetpreskocit); uspech=true; end; else graph.pen(graph.white); graph.rect(pozx,pozy-20,11,30); graph.pen(graph.black); pozx-=krokx; if uspech # false then uspech=znak; end; end; if (znak%7) = 0 then VypisStav(str(znak)); end; znak++; if znak = limit then break; end; end; if znak = limit then break; end; end; if znak = limit and uspech # true then //VypisNezname(uspech,znak-1,pocetpreskocit); end; VypisStav('Zmáčkni něco / Press a key'); while true do ui.ptr(false); ui.keys(false); vstup=ui.cmd(); if not isarray(vstup) then break; end; if vstup[2] = 1 then //stisknuti pozx=math.floor((vstup[0]-pocx)/krokx); pozy=math.floor(vstup[1]/kroky); if pozx >= 0 and pozy >= 0 and pozy < len(vypsane) and pozx < len(vypsane[pozy]) then print vypsane[pozy][pozx]+': '+char([vypsane[pozy][pozx]]); graph.hide(); sleep(1000); graph.show(); end; end; end; graph.clear(); if znak = limit then break; end; end; graph.hide();