二次元音游人

这是一股照亮混沌的令和时代互联网的一道光,给在电子的海洋里冲浪的阿宅们带来笑容

4K音游

#include<bits/stdc++.h>
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#include<conio.h>
int main(){
    system("title 4K音游");
    system("color 6");
    srand(time(0));//删掉这行就是伪随机捏
    printf("\n\n\n\n\n\n\n\n           这个游戏的规则是用d f j k 接住字母X\n               按下任意键开始游戏....");
    char p;
    p = _getch();
    if (p)
        system("cls");
    int a[1000];
    char b[10][7];
    double st=clock();
    for (int i = 0; i < 1000; i++)
    {
        a[i] = rand() % 7;
        if (a[i] % 2 == 0)
            continue;
        else
            i--;
    }
    for (int i = 0; i < 10; i++)
    {
        if (i % 2 == 1)
        {
            for (int j = 0; j < 7; j++)
            {
                if (j == a[i * 2])
                    b[i][j] = 'X';
                else
                    b[i][j] = ' ';
            }
        }
        else
        {
            for (int j = 0; j < 7; j++)
            {
                b[i][j] = ' ';
            }
        }
    }
    char c;
    int f = 5;
    while (1)
    {
        printf("\n\n\n                    --------\n");
        for (int i = 0; i < 10; i++)
        {
            printf("                    |");
            for (int j = 0; j < 7; j++)
            {
                printf("%c", b[i][j]);
            }
            printf("|\n");
        }
        printf("                    --------");
        c = _getch();
        if (c == 'd' && b[9][0] == 'X')
        {
            for (int i = 9; i > 1; i -= 2)
            {
                for (int j = 0; j < 7; j++)
                    b[i][j] = b[i - 2][j];
            }
            for (int j = 0; j < 7; j++)
            {
                if (j == a[f])
                    b[1][j] = 'X';
                else
                    b[1][j] = ' ';
            }
        }
        else if (c == 'f' && b[9][2] == 'X')
        {
            for (int i = 9; i > 1; i -= 2)
            {
                for (int j = 0; j < 7; j++)
                    b[i][j] = b[i - 2][j];
            }
            for (int j = 0; j < 7; j++)
            {
                if (j == a[f])
                    b[1][j] = 'X';
                else
                    b[1][j] = ' ';
            }
        }
        else if (c == 'j' && b[9][4] == 'X')
        {
            for (int i = 9; i > 1; i -= 2)
            {
                for (int j = 0; j < 7; j++)
                    b[i][j] = b[i - 2][j];
            }
            for (int j = 0; j < 7; j++)
            {
                if (j == a[f])
                    b[1][j] = 'X';
                else
                    b[1][j] = ' ';
            }
        }
        else if (c == 'k' && b[9][6] == 'X')
        {
            for (int i = 9; i > 1; i -= 2)
            {
                for (int j = 0; j < 7; j++)
                    b[i][j] = b[i - 2][j];
            }
            for (int j = 0; j < 7; j++)
            {
                if (j == a[f])
                    b[1][j] = 'X';
                else
                    b[1][j] = ' ';
            }
        }
        else{
            double ed=clock();
            double ans=(ed-st)/1000;
            system("cls");
            printf("\n\n\n\n\n\n\n                        游戏结束,你的得分是 %d\n\n\n                      相当于每秒打 %.2lf 个键\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", (f - 5),(double)(f-5)/ans);
            system("pause");system("pause");system("pause");system("pause");system("pause");system("pause");system("pause");system("pause");system("pause");
            break;
        }
        system("cls");
        f++;
    }
    return 0;
}

 

 
posted @ 2023-03-26 14:24  超绝最可爱天使酱  阅读(72)  评论(0)    收藏  举报