ÎÌÌÌÌwwwlffflwwwlÌÌÌlÌÀÌlÌÀÌlÌÀÌÌÌìîwwÌîffÀîwgÀîÌlÀÌÀlÀÀÀlÀÀÀlÀÀÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÌ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌ̬ÀÀÀ¬ÀÀÀ¬ÀÀlÌÌÌlffflflflfÆÌlfff|wwwÌÀÌÎÌÌÎÌlÌffÀìlfÀîffÀîffÀîwwÌîÀìîÌÌîî¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî >¿?ÌÌìÌÌîÎÌìÎìîÌÌìÎÌîîîîîîîîîîîîîîîîîîÎÌìÌÌîÌìîÌÌÎÌÌîîÎÌÌÎìîîîîîîîîîîîîîîÌîîÌîîîîîîîîîîîîîîÎÌîÎÌîÌîìÌîìÎÌìÎìîÌÌìîÌîÌÌìÎÌîîîÌîîÌîìÌìîÎìîîÎìÌÎìîîîîîîîîîîîîîîîîîÌìîÎìÎìÎÎìîÎìîîîÎìîÎìîîÌÌîÎÌîÎÌìÌîìÌîÎÌÌîÌÌîîîîîîîîîîÌîìÌîìÌîìÌììîÌîÎìîÌîîÎÌîîÎìÌÎìîîÌÌîÌîìÎÌîîîîîÌîÌììîîîîîîîîîîîîîîîîîÎÌîÎìÎìÎÎìÌÎÌìîîÎÌìîîîîÌîìÌÎìÌìîÌîìÌîîÌîÎÌîîîîîîîîîîîÌîîÌîìÌîìÌÌìîÌîîîîÌÌîÌÎîîÌîÌììîîÌîîÌÌîîÌìÎìîÎìîÌîìîîîîîîîîîîîîîîîîîîÌìÎìÎÌÌÎìÎÎìîîîîîÌÎìîîÌîîÌìîîÌìÌîìÌîîÌîîÎÌîîîîîîîîîîÌîìÌîìÌîìÌÎìîÌîÎìîîÎìÌÌììÎìÌîìîîÌîîÌîîÌÌîÎìîÌîîÎÌîîîîîîîîîîîîîîîîîîÌÌîÎìÎìÎîÌÌÎÌÌîîÎÌìÎìîîÌîîÎÌîÌÌîÎÌîÎÌîÎÌÎÌìîîîîîîîîîîÎÌîÎÌîÎÌîÌîìîÌîÎìîÌÌîîÎîÎÌîÎÌîîîÀ ÀÌÌÀÌÌÀÌ ÌÌÌÌÌÌÀ ÀÀÌ À À ÌÀ ÀÌ ÀÌ Ì ÌÌÌÌÀ À À ÌÀÌ À À À ÀÌÌ À ÌÌÀ ÌÌ À ÀÌ À ÀÀ ÀÀ ÌÀÌÀÌÀ ÀÌ ÀÌ Ì Ì À À ÌÀÌÌÌÀ Ì ÌÌ À ÌÀ Ì À ÀÀ ÀÌÀÌÀÌÀ À À ÌÀÌÌÀ À ÀÀ ÀÌÀ À Ì ÌÌ ÀÌÀ Ì ÀÌ À Ì ÀÌ ÀÌ ÀÌÌÀÌÌÀ Ì Ì ÌÌÌÌÀ ÀÌÌÌÀ ÌÌÌÀ ÌÌ Ì ÌÌÀ ÌÌÌ ÌÌÀÌ ÌÌÀÌÌÌ Ì ÌÀÌÌ ÌÌÌ ÀÌÌÀÌ ÌÌÌÌ ÌÌ ÌÌÌÌÌÀÌ ÀÌÀÌÀÌÌ Ì ÌÌÀ ÌÌ ÌÌÌ ÀÌÌ Ì Ì Ì À À ÌÀÌÀ ÌÀ ÌÌ Ì ÌÌ À ÌÌÌÀÌÌ Ì Ì Ì ÌÀ À À À ÌÌ À Ì ÀÌÀÌÀÌÌ À À ÌÌÀÀÌÀÌ@DDDDDD@DDDDDD@D@DD@DD@@DDDDDààîîàîîîààîîàîîàààààîD@@@@@@D@@@@@@@@DD@@@Dààààîîàîààààààààààîàîà@D@@@@D@DD@@@@@@DDD@@DDDDàîààîàîàîàîààààààîîîàD@@DD@@@@D@@@@@D@@@@D@@@@ààîàîàààààààààààààîîàDD@@@DD@DD@DDD@@@DD@DDDD@DD@DDààààîààîîîàîîîààî`ffffff`fff`f`f`ffffff`fffffffffffffffffff``ffffffffff`fffffff`fffff`fffffffffffffff```f``fffffffffff`f`fffff`fff`fffpppppÝ Ð p pÝ }wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww p ÝpppppppÀ À p pÌ p ÀÌÀ pÐÌÜÌÀÀp RUUUUUUUUUUU%UUUÀ pÝ }'%wwwwwwwwwwwwrwwUUuwwÇwÇwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww PUÅ À pÝ ÝUU pPRUp UUpUUÀ ÀÌpUUÀÀÀpUU ÀÌp UUUÀÀÀpUÅ\ÀÌÀ ÀÌpUU%ÀÀÀpRUU ÀÌÀ ÌÀ ÀÌp UUÀÀÀÀÀÀpÝÐ PU%ÀÌÀ ÀÌ À ÌÌÌÀp RUUUU ÀÀÀÀÀ ÌÌÀ ÀÌ|Ð }wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww'wwwwURUwwwwwÇÌÇÌwwwwwwwÇÌÇ|wwwwwwwÇwÇwwwwwwÇwÇwwwwwww|||wwwwwÌw||  UU  ÀÀ ÀÌ|ÝÝUURUUUURUUUU%UUUUURUUUUUÌ Ì Ì Ì À| %  UUUUU Ì ÌÌ | UUUU%UUU%UUUURUUUU pR UUUURUUU%  pppppppÐ }wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww ÝÝ ÝÐ ÐÐ ÝÐÐÝÝ Ð ÐÐ Ð Ý ÝÝ*-- title: CrapMark -- author: archargelod -- desc: benchmark to compare performance of machines -- license: GPLv2 -- version: 0.4 -- script: lua w=240 h=136 local Circle={} function Circle:new(x,y,r,col) local self={ x=0, y=0, r=8,col=5 } self.x = x or self.x self.y = y or self.y self.r = r or self.r self.dir={x=1-math.random(0,1)*2,y=1-math.random(0,1)*2} self.col=math.random(1,15) function self:draw() circ(self.x,self.y,self.r,self.col) end function self:update() self.x=self.x+self.dir.x self.y=self.y+self.dir.y if self.x+self.r>w then self.dir.x=-1-math.random()/2 end if self.x-self.r<0 then self.dir.x= 1+math.random()/2 end if self.y+self.r>h then self.dir.y=-1-math.random()/2 end if self.y-self.r<0 then self.dir.y= 1+math.random()/2 end end return self end local Pixel={} function Pixel:new(x,y,col) local self={ x=0, y=0, col=5 } self.x = x or self.x self.y = y or self.y self.dir={x=1-math.random()*2,y=1-math.random()*2} self.col=math.random(1,15) function self:draw() pix(self.x,self.y,self.col) end function self:update() self.x=self.x+self.dir.x self.y=self.y+self.dir.y if self.x>w then self.dir.x=self.dir.x*-1 end if self.x<0 then self.dir.x=self.dir.x*-1 end if self.y>h then self.dir.y=self.dir.y*-1 end if self.y<0 then self.dir.y=self.dir.y*-1 end end return self end local Rectangle={} function Rectangle:new(x,y,s,col) local self={ x=0, y=0, s=16, col=5 } self.x = x or self.x self.y = y or self.y self.dir={x=1-math.random()*2,y=1-math.random()*2} self.col=math.random(1,15) function self:draw() rect(self.x,self.y,self.s,self.s,self.col) end function self:update() self.x=self.x+self.dir.x self.y=self.y+self.dir.y if self.x+self.s>w then self.dir.x=self.dir.x*-1 end if self.x<0 then self.dir.x=self.dir.x*-1 end if self.y+self.s>h then self.dir.y=self.dir.y*-1 end if self.y<0 then self.dir.y=self.dir.y*-1 end end return self end local Sprite={} function Sprite:new(id,x,y,col,s) local self={ id=1, x=0, y=0, s=2, col=14 } self.x = x or self.x self.y = y or self.y self.col=col or self.col self.dir={x=1-math.random()*2,y=1-math.random()*2} self.ss=self.s*8 function self:draw() spr(self.id,self.x,self.y,self.col,1,0,0,self.s,self.s) end function self:update() self.x=self.x+self.dir.x self.y=self.y+self.dir.y if self.x+self.ss>w then self.dir.x=self.dir.x*-1 end if self.x<0 then self.dir.x=self.dir.x*-1 end if self.y+self.ss>h then self.dir.y=self.dir.y*-1 end if self.y<0 then self.dir.y=self.dir.y*-1 end end return self end ms=0 t_old=time() fps=60 count=0 hist={} history={{},{},{},{}} circles={} sprites={} pixels={} rectangles={} index=1 i_max=5 i_names={"1: pixels","2: circles","3: rectangles","4: sprites","5: results"} show_index=1 s_i_max=4 overall=0 poke(0x3FF8,15) function TIC() cls(0) if count==0 then ms=0 t_old=time() fps_history(60) end if index==1 then t_pixels() elseif index==2 then t_circles() elseif index==3 then t_rectangles() elseif index==4 then t_sprites() elseif index==5 then get_overall() show_results() end get_fps() if count>19999 or fps<20 then fps_history(fps) next() end rect(0,0,w,5,14) print("FPS:"..fps,0,0,12,true) print("COUNT:"..count,w-64,0,12,true) print("STAGE "..i_names[index],w/2-50,0,12) end function get_fps() if time()-t_old<=1000 then ms=ms+1 else fps=ms fps_history(fps) ms=0 t_old=time() end end function t_pixels() for i,item in pairs(pixels) do item:update() item:draw() end count=#pixels for i=1,10 do table.insert(pixels,Pixel:new()) end end function t_sprites() for i,item in pairs(sprites) do item:update() item:draw() end count=#sprites for i=1,10 do table.insert(sprites,Sprite:new()) end end function t_circles() for i,item in pairs(circles) do item:update() item:draw() end count=#circles for i=1,10 do table.insert(circles,Circle:new()) end end function t_rectangles() for i,item in pairs(rectangles) do item:update() item:draw() end count=#rectangles for i=1,10 do table.insert(rectangles,Rectangle:new()) end end function fps_history(val) table.insert(hist,{f=val,c=count}) end function show_fps(tbl) ox=10 oy=6 count=tbl[#tbl].c local c_string=tostring(count) local col=7 local col_num=13 print(90,0,h-47-oy,col_num,false,1,true) rect(7,h-45-oy,w,1,col) print(60,0,h-32-oy,col_num,false,1,true) rect(7,h-30-oy,w,1,col) print(30,0,h-17-oy,col_num,false,1,true) rect(7,h-15-oy,w,1,col) print(0 ,4,h-1 -oy,col_num,false,1,true) rect(7,h-oy,w,1,col) rect(ox,h-58+oy,1,50,col) print(0,ox-1,h-5,col_num,false,1,true) rect(w-1,h-58+oy,1,50,col) print(count,w-(4*#c_string),h-5,col_num,false,1,true) for i,val in ipairs(tbl) do if i>1 then line(ox+tbl[i-1].c*230/count,h-tbl[i-1].f/2-oy, ox+val.c*230/count,h-val.f/2-oy,5) end circ(ox+val.c*230/count,h-val.f/2-oy,1,2) if i%2==0 then print(val.f,ox+val.c*230/count-8,h-val.f/2-oy-6,12,false,1,true) end end end function next() if index>4 then return end circles={} sprites={} pixels={} rectangles={} for i,val in ipairs(hist) do table.insert(history[index],val) end hist={} if index<5 then index=((index+i_max)%i_max)+1 fps=60 count=0 end end function show_results() if btnp(2) then show_index=show_index-1 end if btnp(3) then show_index=show_index+1 end if show_index>s_i_max then show_index=1 end if show_index<1 then show_index=s_i_max end local score=history[show_index][#history[show_index]].f/20*history[show_index][#history[show_index]].c local s_string=tostring(score) print("press LEFT/RIGHT "..i_names[show_index],31,8,12) print("FPS: "..history[show_index][#history[show_index]].f,4,20,12) print("COUNT: "..history[show_index][#history[show_index]].c,4,28,12) print("STAGE SCORE: "..score,4,36,4) print("(FPS / 20 * COUNT)",76+#s_string*6,36,14) print("OVERALL SCORE: "..overall,4,44,6) show_fps(history[show_index]) end function get_overall() for i=1,4 do overall=overall+history[i][#history[i]].f/20*history[i][#history[i]].c end overall=math.floor(overall/4) end