#include <windows.h>
#include <iostream>
#include <conio.h>
#include <cstdio>
#include <random>
#include <ctime>
#define KEY 4
#define LEN 256
#define DIS 16
using namespace std;
mt19937 rng(time(0));
const int TOT=LEN+DIS+5;
int note[TOT];
int pts;
int main()
{
for(int i=1; i<=LEN; i++)
{
note[i]=rng()%4;
}
for(int i=LEN-DIS; i>=-DIS; i--)
{
system("cls");
if(i!=LEN-DIS)
{
printf("%.2lf\%\n",100.0*(pts*1.0/(LEN-(i+DIS))));
}
if(i<=1)
{
for(int j=i; j<=1; j++)
{
printf("\n");
}
}
for(int j=max(1,i); j<=i+DIS; j++)
{
for(int k=1; k<=note[j]; k++)
{
printf(" ");
}
printf("__\n");
}
//printf("\n");
for(int j=1; j<=KEY; j++)
{
printf("__");
}
printf("\n");
char ch=_getch();
if((ch=='g' && note[i+DIS]==0) || (ch=='h' && note[i+DIS]==1) || (ch=='j' && note[i+DIS]==2) || (ch=='k' && note[i+DIS]==3))
{
pts++;
}
//cout<<i+DIS<<endl;
//cout<<ch<<" "<<note[i+DIS]<<" "<<pts<<endl;
//system("pause");
}
return 0;
}HSX
这是 2025年10月12日 存档的第 1 版,不是当前版本。查看当前版本