无毒无害保证!
灵感来HumanBenchmark
你别看他很无聊,其实他无聊透了 (bushi
#include <bits/stdc++.h>
#include <windows.h>
#define slp Sleep(1000)
#define case break;case
using namespace std;
int acc;
double mode;
string stdnum,unum;
int random(int n)
{
return rand()*rand()%n;
}
//easy=0.064,normal=0.039,difficult=0.018;
int time_inc(int t)
{
return 5+(t*(0.2+t*mode));
}
void SCC(int color)
{
HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, color);
}
int color_change(int t)
{
switch(t)
{
case 1: return 12; //red
case 2: return 14; //yellow
case 3: return 10; //green
case 4: return 9; //blue
case 5: return 13; //purple
}
}
void cwrite(int dig,int color)
{
stdnum.clear();
SCC(color);
for(int i=1; i<=dig; i++)
{
int x=random(10);
if(i==1 && x==0) while(x==0) x=random(10);
cout<<x;
stdnum+=char(x+'0');
}
cout<<endl;
SCC(15);
}
void init()
{
srand(time(0));
puts("欢迎使用 Number Memory Ability Test V1.0 !");
slp;
puts("本程序将依次显示一串数字,您需要在进度条结束前记住数字。");
slp;
puts("请选择测试难度:Easy-1 Normal-2 Difficult-3");
cin>>mode;
if(mode==1) mode=0.064;
if(mode==2) mode=0.039;
if(mode==3) mode=0.018;
puts("要开始测试请按[Enter]键!");
getchar();getchar();
system("cls");
puts("测试开始!");
slp;
system("cls");
}
void gamefail();
bool gamemain()
{
int color;
for(int i=1; i<=50; i++)
{
system("cls");
if(i%10==1) color=color_change(i/10+1);
int timer=time_inc(i);
string fenge(50,'=');
cout<<fenge<<endl<<endl;
cwrite(i,color);
cout<<endl<<fenge<<endl;
cout<<"Timer:"<<endl;
while(timer)
{
string line(timer,'/');
cout<<line;
Sleep(1000);
cout<<"\r";
timer--;
}
system("cls");
cout<<"请输入数字:";
cin>>unum;
if(unum!=stdnum) return 0;
acc++;
}
return 1;
}
void gamefail()
{
system("cls");
cout<<"测试结束!您记忆的数字位数:"<<acc<<endl<<endl;
slp;slp;
cout<<"正确输入:"<<stdnum<<endl;
cout<<"您的输入:"<<unum<<endl<<endl;
slp;
cout<<"欢迎下次使用!"<<endl;
slp;
cout<<"Created by XLGCA";
}
void winning()
{
system("cls");
cout<<"您竟然通关了本测试!!!"<<endl;
slp;slp;slp;slp;slp;
cout<<"您是地球人吗 (?.?)"<<endl;
slp;slp;slp;
cout<<"如果您没有使用 [Ctrl]+[C]......"<<endl;
slp;slp;slp;
cout<<"好吧......"<<endl<<endl;
slp;slp;slp;slp;
cout<<"Created by XLGCA";
}
int main()
{
init();
if(gamemain()) gamefail();
else winning();
return 0;
}