🚀 update test file

This commit is contained in:
ValKmjolnir 2022-09-20 21:51:52 +08:00
parent 791de656c3
commit dc3770094a
2 changed files with 61 additions and 55 deletions

View File

@ -2,32 +2,32 @@ import.stl.padding;
var char_ttf=[
[" "," "," "," "," "," "],
[" ████╗"," ██╔██║"," ██╔╝██║"," ███████║","██╔═══██║","╚═╝ ╚═╝"],
[" █████╗ ","██╔══██╗","███████║","██╔══██║","██║ ██║","╚═╝ ╚═╝"],
["██████╗ ","██╔══██╗","██████╔╝","██╔══██╗","██████╔╝","╚═════╝ "],
[" ██████╗","██╔════╝","██║ ","██║ ","╚██████╗"," ╚═════╝"],
["██████╗ ","██╔══██╗","██║ ██║","██║ ██║","██████╔╝","╚═════╝ "],
["███████╗","██╔════╝","█████╗ ","██╔══╝ ","███████╗","╚══════╝"],
["███████╗","██╔════╝","█████╗ ","██╔══╝ ","██║ ","╚═╝ "],
[" █████╗ ","██╔═══╝ ","██║ ██╗ ","██║ ╚██╗","╚█████╔╝"," ╚════╝ "],
[" ██████╗ ","██╔════╝ ","██║ ███╗","██║ ██║","╚██████╔╝"," ╚═════╝ "],
["██╗ ██╗","██║ ██║","███████║","██╔══██║","██║ ██║","╚═╝ ╚═╝"],
[" ██████╗"," ██╔═╝"," ██║ "," ██║ "," ██████╗"," ╚═════╝"],
["██╗","██║","██║","██║","██║","╚═╝"],
[" ██╗"," ██║"," ██║","██ ██║","╚█████╔╝"," ╚════╝ "],
["██╗ ██╗","██║ ██╔╝","█████╔╝ ","██╔═██╗ ","██║ ██╗","╚═╝ ╚═╝"],
["██╗ ","██║ ","██║ ","██║ ","███████╗","╚══════╝"],
["██╗ ██╗","███╗ ███║","████████║","██╔██╔██║","██║╚═╝██║","╚═╝ ╚═╝"],
["██╗ ██╗","███╗ ██║","█████╗██║","██╔█████║","██║ ╚███║","╚═╝ ╚══╝"],
["███╗ ███╗","████╗ ████║","██╔████╔██║","██║╚██╔╝██║","██║ ╚═╝ ██║","╚═╝ ╚═╝"],
["███╗ ██╗","████╗ ██║","██╔██╗ ██║","██║╚██╗██║","██║ ╚████║","╚═╝ ╚═══╝"],
[" ██████╗ ","██╔═══██╗","██║ ██║","██║ ██║","╚██████╔╝"," ╚═════╝ "],
["██████╗ ","██╔══██╗","██████╔╝","██╔═══╝ ","██║ ","╚═╝ "],
[" ██████╗ ","██╔═══██╗","██║ ██║","██║ ██╔╝","╚████╔██╗"," ╚═══╝╚═╝"],
[" ██████╗ ","██╔═══██╗","██║ ██║","██║▄▄ ██║","╚██████╔╝"," ╚══▀▀═╝ "],
["██████╗ ","██╔══██╗","██████╔╝","██╔══██╗","██║ ██║","╚═╝ ╚═╝"],
["███████╗","██╔════╝","███████╗","╚════██║","███████║","╚══════╝"],
["████████╗","╚══██╔══╝"," ██║ "," ██║ "," ██║ "," ╚═╝ "],
["██╗ ██╗","██║ ██║","██║ ██║","██║ ██║","╚██████╔╝"," ╚═════╝ "],
["██╗ ██╗","██║ ██║","██║ ██║","╚██╗ ██╔╝"," ╚████╔╝ "," ╚═══╝ "],
["██╗ ██╗","██║██╗██║","████████║","███╔═███║","██╔╝ ╚██║","╚═╝ ╚═╝"],
["██╗ ██╗","██║ ██║","██║ █╗ ██║","██║███╗██║","╚███╔███╔╝"," ╚══╝╚══╝ "],
["██╗ ██╗","╚██╗██╔╝"," ╚███╔╝ "," ██╔██╗ ","██╔╝╚██╗","╚═╝ ╚═╝"],
["██╗ ██╗","╚██╗ ██╔╝"," ╚████╔╝ "," ╚██╔╝ "," ██║ "," ╚═╝ "],
["████████╗","╚════██╔╝"," ██╔═╝ "," ██╔═╝ ","████████╗","╚═══════╝"],
["███████╗","╚══███╔╝"," ███╔╝ "," ███╔╝ ","███████╗","╚══════╝"],
];
var trans_ttf=func(string){
var str=["","","","","",""];
@ -47,7 +47,7 @@ var trans_ttf=func(string){
println(i);
return;
}
var curve1=func(line=6){
var curve1=func(line=4){
var table=["╚","═","╝","╔","║","╗"];
rand(100);
var s="";
@ -58,7 +58,7 @@ var curve1=func(line=6){
}
print(s);
}
var curve2=func(line=3){
var curve2=func(line=2){
var shadow=["░","▒","▓","█","▀","▄","▐","▌"];
rand(100);
var s="";
@ -69,7 +69,7 @@ var curve2=func(line=3){
}
print(s);
}
var curve3=func(line=3){
var curve3=func(line=2){
var arr=[
0,1,2,3,4,5,6,7,8,
0,1,2,3,4,5,6,7,8,
@ -91,7 +91,7 @@ var curve3=func(line=3){
}
return;
}
var curve4=func(line=6){
var curve4=func(line=4){
var shadow=["m░\e[0m","m▒\e[0m","m▓\e[0m","m█\e[0m","m▀\e[0m","m▄\e[0m","m▐\e[0m","m▌\e[0m"];
var front=[
"30","31","32","33","34","35","36","37",
@ -108,7 +108,7 @@ var curve4=func(line=6){
print('\n');
}
}
var curve5=func(line=6){
var curve5=func(line=4){
var vec=["▀▄─","▄▀─","▀─▄","▄─▀"];
for(var (y,p)=(0,0);y!=line;y+=1){
for(var x=0;x!=15;x+=1)
@ -139,7 +139,6 @@ var ansi_escape_sequence=func(){
# enable unicode
if(os.platform()=="windows")
system("chcp 65001");
trans_ttf("just for test");
trans_ttf(" ValKmjolnir ");
curve1();
curve2();

View File

@ -1,49 +1,56 @@
import.stl.sort;
var argv=runtime.argv();
if(size(argv)<1){
println("no input files.");
exit(-1);
}
var all_exists=1;
foreach(var f;argv){
if(!io.exists(f)){
println("cannot open file <",f,">");
all_exists=0;
var to_lower=func(s){
var tmp="";
for(var i=0;i<size(s);i+=1){
var c=s[i];
if('a'[0]<=c and c<='z'[0])
tmp~=chr(c);
elsif('A'[0]<=c and c<='Z'[0])
tmp~=chr(c-'A'[0]+'a'[0]);
else
tmp~=chr(c);
}
return tmp;
}
if(!all_exists){
exit(-1);
}
var to_lower=func(c){
if('a'[0]<=c[0] and c[0]<='z'[0])
return c;
elsif('A'[0]<=c[0] and c[0]<='Z'[0])
return chr(c[0]-'A'[0]+'a'[0]);
return c;
}
var file_content="";
foreach(var f;argv)
file_content~=io.fin(f)~" ";
var token={};
var len=size(file_content);
var s="";
for(var i=0;i<len;i+=1){
var n=file_content[i];
var c=chr(n);
if(('a'[0]<=n and n<='z'[0]) or ('A'[0]<=n and n<='Z'[0]) or n=='\''[0] or n=='-'[0]){
s~=to_lower(c);
}elsif(size(s)){
if(s[0]!="-"[0] and s[0]!="'"[0] and s[-1]!="-"[0] and s[-1]!="'"[0])
token[s]+=1;
s="";
var spliter=func(content){
var token={};
var len=size(content);
var s="";
for(var i=0;i<len;i+=1){
var n=content[i];
var c=chr(n);
if(('a'[0]<=n and n<='z'[0]) or ('A'[0]<=n and n<='Z'[0]) or n=='\''[0] or n=='-'[0]){
s~=c;
}elsif(size(s)){
if(s[0]!="-"[0] and s[0]!="'"[0] and s[-1]!="-"[0] and s[-1]!="'"[0])
token[to_lower(s)]+=1;
s="";
}
}
return token;
}
var vec=keys(token);
sort(vec,func(a,b){return cmp(a,b)<=0;});
println(vec);
func(argv){
if(size(argv)<1){
println("no input files.");
exit(-1);
}
var all_exists=1;
foreach(var f;argv){
if(!io.exists(f)){
println("cannot open file <",f,">");
all_exists=0;
}
}
if(!all_exists){
exit(-1);
}
var file_content="";
foreach(var f;argv)
file_content~=io.fin(f)~" ";
var vec=keys(spliter(file_content));
sort(vec,func(a,b){return cmp(a,b)<=0;});
println(vec);
}(runtime.argv());