🎨 change code format

This commit is contained in:
ValKmjolnir
2022-11-26 22:49:22 +08:00
parent 7c075a6071
commit 34e29e398a
20 changed files with 1965 additions and 2088 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ var compare=func(){
if(cmp(res,_md5(s))){
die("error: "~str(i));
}
print(" ",bar.bar((i-begin+1)/total)," (",i-begin+1,"/",total,")\t",res," byte: ",byte," time: ",timestamp.elapsedMSec()," \r");
print(" ",bar.bar((i-begin+1)/total)," (",i-begin+1,"/",total,")\t",res," byte: ",int(byte/1024),"k time: ",timestamp.elapsedMSec()," \r");
}
print("\n");
};
@@ -87,7 +87,7 @@ var filechecksum=func(){
if(cmp(res,_md5(f))){
die("error: "~files[i]);
}
print(" ",bar.bar((i+1)/total)," (",i+1,"/",total,")\t",res," byte: ",byte," time: ",timestamp.elapsedMSec()," \r");
print(" ",bar.bar((i+1)/total)," (",i+1,"/",total,")\t",res," byte: ",int(byte/1024),"k time: ",timestamp.elapsedMSec()," \r");
}
print("\n");
}
+7 -5
View File
@@ -13,8 +13,8 @@ var ppm=func(filename,width,height,RGB){
io.close(fd);
}
var width=1280;
var height=720;
var width=1920;
var height=1080;
var bar=(os.platform()=="windows")?
process_bar.bar(front:"sharp",back:"point",sep:"line",length:50):
process_bar.high_resolution_bar(50);
@@ -23,7 +23,7 @@ var f=func(i,j){
var (yDel,xDel)=(yMax-yMin,xMax-xMin);
var (y,x)=((i/height)*yDel+yMin,(j/width)*xDel+xMin);
var (x0,y0)=(x,y);
for(var iter=0;iter<25;iter+=1){
for(var iter=0;iter<64;iter+=1){
var (x1,y1)=((x0*x0)-(y0*y0)+x,2*x0*y0+y);
(x0,y0)=(x1,y1);
if((x0*x0)+(y0*y0)>4){
@@ -31,9 +31,11 @@ var f=func(i,j){
}
}
var progress=(i*width+j+1)/(width*height);
print(bar.bar(progress)," ",progress*100,"% \r");
if(progress*100-int(progress*100)==0){
print(bar.bar(progress)," ",progress*100,"% \r");
}
iter=iter==25?255:int(iter/25*255);
return iter~" "~iter~" "~iter~" ";
}
ppm("a.ppm",width,height,f);
println("\nfinished.");
println();