[Games] 4K Freaser -demo
version demo0.3
#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
using namespace std;
int a[11][5],ct,et,st=0;
void csct(int x,int color){
if(x!=0){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),color);
cout<<" ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0x0F);
}
else{
cout<<" ";
}
}
void sc(){
system("cls");
for(int i=1;i<=10;++i){
for(int j=1;j<=4;++j){
csct(a[i][j],0xB0);
// cout<<a[i][j]<<" ";
}
cout<<endl;
}
cout<<"X C N M"<<endl;
}
void down(){
for(int i=10;i>=2;--i){
for(int j=1;j<=4;++j){
a[i][j]=a[i-1][j];
}
}
int x=rand()%4+1;
for(int i=1;i<=4;++i){
if(i==x){
a[1][i]=1;
}
else{
a[1][i]=0;
}
}
sc();
}
bool check(int p){
if(a[10][p]==1){
down();
return true;
}
else{
down();
return false;
}
}
int main(){
srand(time(NULL));
for(int i=1;i<=10;++i){
down();
}
sc();
while(1){
if(kbhit()){
if(st==0){
st=time(NULL);
}
int a=getch(),m=0;
if(a==48){
break;
}
else if(a==120){
m=1;
}
else if(a==99){
m=2;
}
else if(a==110){
m=3;
}
else if(a==109){
m=4;
}
else{
continue;
}
if(check(m)==false){
et++;
cout<<m<<" error. ("<<et<<")"<<endl;
}
else{
ct++;
}
cout<<"Correct rate ";
printf("%.3f\n",(double)ct*100/(et+ct));
cout<<"Speed ";
printf("%.3f clicks/s\n",((double)ct/(time(NULL)-st)));
cout<<"%"<<endl;
}
}
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· 使用C#创建一个MCP客户端
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· Windows编程----内核对象竟然如此简单?