🎨 improve code format

delete option -v, --version, -l, --lex
This commit is contained in:
ValKmjolnir
2022-10-30 01:26:26 +08:00
parent b0f080070a
commit feea901e4d
14 changed files with 381 additions and 324 deletions

View File

@@ -46,6 +46,7 @@ var testfile=[
"class.nas",
"coroutine.nas",
"diff.nas",
"donuts.nas",
"exception.nas",
"fib.nas",
"filesystem.nas",

51
test/donuts.nas Normal file
View File

@@ -0,0 +1,51 @@
var mod=func(n,a){
return n-int(n/a)*a;
}
var main=func(run_time){
var (sin,cos)=(math.sin,math.cos);
var (A,B)=(0,0);
var (z,b)=([],[]);
setsize(z,1760);
setsize(b,1760);
print("\e[2J");
for(var run=0;run<run_time;run+=1){
forindex(var i;b)
b[i]=32;
forindex(var i;z)
z[i]=0;
for(var j=0;j<6.28;j+=0.07){
for(var i=0;i<6.28;i+=0.02){
var (c,d,e,f,g)=(sin(i),cos(j),sin(A),sin(j),cos(A));
var h=d+2;
var D=1/(c*h*e+f*g+5);
var (l,m,n)=(cos(i),cos(B),sin(B));
var t=c*h*g-f*e;
var x=int(40+30*D*(l*h*m-t*n));
var y=int(12+15*D*(l*h*n+t*m));
var o=int(x+80*y);
var N=int(8*((f*e-c*d*g)*m-c*d*e-f*g-l*d*n));
if(22>y and y>0 and x>0 and 80>x and D>z[o]){
z[o]=D;
b[o]=".,-~:;=!*#$@"[N>0?N:0];
}
}
}
print("\e[H");
var screen="";
for(var k=0;k<1761;k+=1) {
screen~=(mod(k,80)?chr(b[k]):chr(10));
A+=0.00004;
B+=0.00002;
}
print(screen);
}
}
var frames=5e2;
var ts=maketimestamp();
ts.stamp();
main(frames);
println(int(frames/(ts.elapsedMSec()/1000))," fps");

View File

@@ -46,6 +46,7 @@ var filechecksum=func(){
"./test/bp.nas", "./test/calc.nas",
"./test/choice.nas", "./test/class.nas",
"./test/coroutine.nas", "./test/diff.nas",
"./test/donuts.nas",
"./test/exception.nas", "./test/fib.nas",
"./test/filesystem.nas", "./test/hexdump.nas",
"./test/httptest.nas", "./test/json.nas",

View File

@@ -1,7 +1,7 @@
# wave collapse function 2022/4/10
# by ValKmjolnir
srand();
var interval=1/120;
var interval=1/160;
var table=[
# c ,w,a,s,d
["═",0,1,0,1],