二次元音游人

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

4K音游

#include<bits/stdc++.h>
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#include<conio.h>
int main(){
    system("title 4K music game");
    system("color 6");
   
    srand(time(0));//删掉这行就是伪随机捏
    printf("\n\n\n\n\n\n\n\n          This game's rule is to use d f j k to catch X\n               plz input anything to start game....");
    while(1){
        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                        Game over,Your score is %d\n\n\n                      like hit %.2lf notes per second\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");
                break;
            }
            system("cls");
            f++;
        }
    }
    return 0;
}
posted @ 2023-03-26 15:35  超绝最可爱天使酱  阅读(465)  评论(2)    收藏  举报