无限挖掘

· · 个人记录


#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<time.h>
#define KEY_DOWN(VK_NONAME)((GetAsyncKeyState(VK_NONAME)&0x8000)?1:0)
using namespace std;
int m[10001][21];
struct node {
    int xx, yy, Zhong, rr, mr;
} B[100001];
int K, X, Y, tX, tY, tY2, tT, Er, T, Yb, Zb, Win, Blood, Score, Kb;
int cs_b = 10, cs_s = 20, sh_b = 1, sh_s = 10, hf_b = 1, hf_s = 20, sd = 50, fy = 3;
int cs_b1 = 10, cs_s1 = 20, sh_b1 = 1, sh_s1 = 10, hf_b1 = 1, hf_s1 = 20, sd1 = 50, fy1 = 3;
int qwe;

void Color(int a) {
    if (a == 0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
    if (a == 1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE);
    if (a == 2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
    if (a == 3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE);
    if (a == 4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
    if (a == 5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);
    if (a == 6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
    if (a == 7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN);
    if (a == 8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
    if (a == 9) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_INTENSITY | BACKGROUND_RED);
    if (a == 10) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE | BACKGROUND_INTENSITY | BACKGROUND_BLUE);
}
void SetPos(int x, int y) {
    COORD pos;
    pos.X = y * 2 - 1, pos.Y = x + 1;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
void ShowCursor() {
    CONSOLE_CURSOR_INFO cur = {1, 1};
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cur);
}
void HideCursor() {
    CONSOLE_CURSOR_INFO cur = {1, 0};
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cur);
}
int safein1(int a, int b, int q) {
    char aa[10];
    int x, i;
ww:
    SetPos(15, 6);
    Color(6);
    ShowCursor();
    x = 0, i = 0;
    memset(aa, 0, sizeof(aa));

    for (i = 1; i <= 4; i++) {
        while (!((aa[i] >= '0' && aa[i] <= '9') || aa[i] == 'y' || aa[i] == 13) )
            aa[i] = _getch();
        if (aa[i] != 'y' && aa[i] != 13)
            cout << aa[i];
        if (aa[i] == 13 ) {
            i -= 2;
            int k = 0;
            for (int y = i; y >= 0; y--)
                x += (aa[++k] - 48) * pow(10, y);
            if (x >= a && x <= b) {
                SetPos(15, 6) ;
                cout << "      ";
                HideCursor();
                return x;
            } else
                goto qq;
        } else if (aa[i] == 'y') {
            HideCursor();
            SetPos(15, 6);
            cout << "    ";
            return q;
        }
    }
qq:
    SetPos(16, 6);
    Color(9);
    cout << "error!";
    Sleep(800);
    Color(4);
    SetPos(16, 6);
    cout << "      ";
    SetPos(15, 6);
    cout << "    ";
    goto ww;
}
void Zha(int x, int y) {
    Zb++;
    int k1 = rand() % 2 + 2, k2 = rand() % 3 + 2, r = rand() % 6;
    if (r == 0) B[Zb].xx = x - K, B[Zb].yy = y, B[Zb].Zhong = 1, B[Zb].rr = 0, B[Zb].mr = k1 * 2;
    if (r == 1) B[Zb].xx = x - K, B[Zb].yy = y, B[Zb].Zhong = 2;
    if (r == 2) B[Zb].xx = x - K, B[Zb].yy = y, B[Zb].Zhong = 3, B[Zb].rr = k2, B[Zb].mr = k1;
    if (r == 3) B[Zb].xx = x - K, B[Zb].yy = y, B[Zb].Zhong = 4;
    if (r == 4) B[Zb].xx = x - K, B[Zb].yy = y, B[Zb].Zhong = 5, B[Zb].rr = 1, B[Zb].mr = k2 * 2;
    if (r == 5) B[Zb].xx = x - K, B[Zb].yy = y, B[Zb].Zhong = rand() % 2 + 6, B[Zb].rr = k1 + 1, B[Zb].mr = k2 + 3;
}
void Cout(int i, int j, int a) {
    int R = rand() % 500, jk = 0;
    if (i - K >= 0 && i - K <= 1 && j >= 2 && j <= 6) return;
    if (a != 4) {
        if (m[i][j] == 0 && (a == 0 || a == 3)) SetPos(i - K, j), Color(7), cout << "■";
        if (m[i][j] == 1 && a == 5) SetPos(i - K, j), Color(0), cout << "  "; //空气
        if (m[i][j] == 2) SetPos(i - K, j), Color(8), cout << "■";
        if (m[i][j] >= 3 && m[i][j] < 6) SetPos(i - K, j), Color(5), cout << "█", m[i][j]++;
        if (m[i][j] == 6 && a != 5) SetPos(i - K, j), cout << "  ", m[i][j] = 1;
        if (m[i][j] == 7) SetPos(i - K, j), Color(9), cout << "~ ";
        if (m[i][j] == 8) SetPos(i - K, j), Color(10), cout << "~ ";
        if (m[i][j] == 9) SetPos(i - K, j), Color(3), cout << "◆";
        if ((m[i][j] == 1 || m[i][j] == 8) && m[i - 1][j] >= 10 && m[i - 1][j] <= 30 && a != 5) {
            int M = m[i][j];    //炸弹下落
            m[i][j] = m[i - 1][j], m[i - 1][j] = M;
            if (M == 1) SetPos(i - K - 1, j), cout << "  ";
        }
        if (m[i][j] == 1 && m[i - 1][j] == 9 && a != 5) {
            m[i][j] = 9, m[i - 1][j] = 1, SetPos(i - K - 1, j), Color(0), cout << "  ";    //宝石下落
            jk = 1;
        }
        if (m[i][j] >= 10 && m[i][j] <= 30) {
            m[i][j]++;    //炸弹计时
            if (m[i][j] % 3 == 0) Color(4);
            else Color(5);
            SetPos(i - K, j), cout << "●";
        }
        if (m[i][j] == 1 && m[i - 1][j] == 7 && a != 5) {
            m[i][j] = 7, m[i - 1][j] = 1, SetPos(i - K - 1, j), Color(0), cout << "  ";    //岩浆下落
            jk = 1;
        }
        if (m[i][j] == 0 && m[i - 1][j] == 7 && R <= 2) m[i][j] = m[i - 1][j], m[i - 1][j] = 1, SetPos(i - K - 1, j), cout << "  "; //岩浆融解
        if (m[i][j] == 7 && R > 2 && R <= 5) {
            int r = rand() % 3 - 1;    //岩浆扩散
            if (m[i][j + r] == 1) m[i][j + r] = m[i][j];
            if (m[i][j + r] == 8) m[i][j + r] = 2;
        }
        if (R < 50 && R >= 20 && m[i + 1][j + 1] == 1 && m[i + 1][j] == 8 && m[i][j] == 8) m[i + 1][j + 1] = 8, m[i][j] = 1, SetPos(i - K, j), Color(0), cout << "  ";
        if (R < 80 && R >= 50 && m[i + 1][j - 1] == 1 && m[i + 1][j] == 8 && m[i][j] == 8) m[i + 1][j - 1] = 8, m[i][j] = 1, SetPos(i - K, j), Color(0), cout << "  "; //岩浆平面
        if (m[i][j] == 1 && m[i - 1][j] == 8 && a != 5) {
            m[i][j] = 8, m[i - 1][j] = 1, SetPos(i - K - 1, j), Color(0), cout << "  ";    //水下落
            jk = 1;
        }
        if (m[i + 1][j + 1] == 1 && m[i + 1][j] == 8 && m[i][j] == 8) m[i + 1][j + 1] = 8, m[i][j] = 1, SetPos(i - K, j), Color(0), cout << "  ";
        if (m[i + 1][j - 1] == 1 && m[i + 1][j] == 8 && m[i][j] == 8) m[i + 1][j - 1] = 8, m[i][j] = 1, SetPos(i - K, j), Color(0), cout << "  "; //水平面
        if ((m[i + 1][j] == 8 && m[i][j] == 7) || (m[i + 1][j] == 7 && m[i][j] == 8)) m[i][j] = 2, m[i - 1][j] = 1, SetPos(i - K - 1, j), Color(0), cout << "  "; //变石头
        if (m[i][j] == 0 && m[i - 1][j] == 8 && R > 5 && R <= 7) m[i][j] = m[i - 1][j], m[i - 1][j] = 1, SetPos(i - K - 1, j), cout << "  "; //水融解
        if (m[i][j] == 8 && R > 7 && R <= 9) {
            int r = rand() % 3 - 1;    //水扩散
            if (m[i][j + r] == 1) m[i][j + r] = m[i][j];
            if (m[i][j + r] == 7) m[i][j + r] = 2;
        }
        if (m[i][j] == 31) SetPos(i - K, j), cout << "  ", Zha(i, j);
    } else if (a != 5) {
        if (m[i][j] >= 3 && m[i][j] < 6) m[i][j]++;
        if (m[i][j] == 6) m[i][j] = 1;
        if ((m[i][j] == 1 || (m[i][j] >= 3 && m[i][j] <= 6)) && m[i - 1][j] >= 10 && m[i - 1][j] <= 30) m[i][j] = m[i - 1][j], m[i - 1][j] = 1; //炸弹下落
        if (m[i][j] >= 10 && m[i][j] <= 30) m[i][j]++; //炸弹计时
        if (m[i][j] == 1 && m[i - 1][j] == 9) m[i][j] = 9, m[i - 1][j] = 1; //宝石下落
        if (m[i][j] == 1 && m[i - 1][j] == 7) m[i][j] = 7, m[i - 1][j] = 1; //岩浆下落
        if (m[i][j] == 1 && m[i - 1][j] == 8) m[i][j] = 8, m[i - 1][j] = 1; //水下落
    }
    if (jk == 1) jk = 0, Cout(i, j, 5);
    Color(0);
}
void Map(int a);
void Wo() {
    SetPos(X - K, Y), cout << "  "; //清除上一次残影
    if (m[X][Y] == 9) Blood += hf_b, Score += hf_s, m[X][Y] = 1, system("color 2F"), Sleep(50), system("color 0F"), Map(3);
    if (tX != 0 && (m[X - 1][Y] == 1 || m[X - 1][Y] == 7 || m[X - 1][Y] == 8 || m[X - 1][Y] == 9 || (m[X - 1][Y] >= 3 && m[X - 1][Y] <= 6))) tX--, X -= 2; //上跳
    if (m[X + 1][Y] == 1 || (m[X + 1][Y] >= 3 && m[X + 1][Y] <= 6) || m[X + 1][Y] == 7 || m[X + 1][Y] == 8 || m[X + 1][Y] == 9) X++; //掉落
    if (m[X + 1][Y] == 0 || m[X + 1][Y] == 2 || (m[X + 1][Y] >= 3 && m[X + 1][Y] <= 6)) tX = Er = 0; //跳跃次数清零
    if (m[X - 1][Y] == 0 || m[X - 1][Y] == 2 || (m[X - 1][Y] >= 10 && m[X - 1][Y] <= 31)) tX = Er = 0; //跳跃次数清零
    if (X <= K) tX = Er = 0, X = K;
    if (X >= K + 28) X = K + 28, Kb = 1; //高度上下限
    if (m[X][Y] == 7) m[X - 1][Y] = m[X - 2][Y] = 1, tX += 8;
    if (m[X][Y] != 1 && m[X][Y] != 8 && m[X][Y] != 9) Blood -= sh_b, Score -= sh_s, m[X][Y] = 1, system("color 4F"), Sleep(50), system("color 0F"), Map(3);
    if (Blood <= 0) Win = -1;
    SetPos(X - K, Y), Color(1), cout << "●";
}
void Map(int a) {
    SetPos(0, 2);
    cout << "Blood: " << Blood << "  ";
    SetPos(1, 2);
    cout << "Score: " << Score << "  ";
    if (a == 3) system("cls");
    for (int i = K + 28; i >= K; i--)for (int j = 1; j <= 20; j++) Cout(i, j, a);
    for (int i = K + 33; i > K + 28; i--)for (int j = 1; j <= 20; j++) Cout(i, j, 4);
    if (a != 3) Wo();
}
void CircleBomb(int x, int y, int s, int ms) {
    if (s == ms) return;
    for (int i = x - s; i <= x + s; i++)
        for (int j = y - s; j <= y + s; j++) {
            float k = (i - x) * (i - x) + (j - y) * (j - y) - s * s;
            if (k <= s && k >= -s && j > 0 && j <= 20 && m[i + K][j] != 2 && m[i + K][j] != 9) m[i + K][j] = 3;
        }
    Zb++;
    B[Zb].xx = x, B[Zb].yy = y, B[Zb].Zhong = 1, B[Zb].rr = s + 1, B[Zb].mr = ms;
    Sleep(30);
}
void LineBomb(int i, int j) {
    for (int k = 0; j + k <= 20; k++) if (m[i + K][j + k] != 2 && m[i + K][j + k] != 9) m[i + K][j + k] = 3;
    for (int k = 0; j + k <= 20; k++) if (m[i + K + 1][j + k] != 2 && m[i + K + 1][j + k] != 9) m[i + K + 1][j + k] = 3;
    for (int k = 0; j - k > 0; k++) if (m[i + K][j - k] != 2 && m[i + K][j - k] != 9) m[i + K][j - k] = 3;
    for (int k = 0; j - k > 0; k++) if (m[i + K + 1][j - k] != 2 && m[i + K + 1][j - k] != 9) m[i + K + 1][j - k] = 3;
}
void ZuanBomb(int i, int j) {
    int k;
    for (k = 0; m[i + K + k][j] != 2 && k <= 7; k++) if (m[i + K + k][j] != 9) m[i + K + k][j] = 3;
    int k1 = rand() % 2 + 2;
    Zb++;
    B[Zb].xx = i + k, B[Zb].yy = j, B[Zb].Zhong = 1, B[Zb].rr = 0, B[Zb].mr = k1 * 3 / 2;
}
void TrigleBomb(int i, int j, int r, int mr) {
    if (r == mr) return;
    if (r == 1) m[i + K][j] = 3, i++;
    for (int k = max(0, j - r); k <= min(20, j + r); k++) if (m[i + K][k] != 2 && m[i + K][k] != 9) m[i + K][k] = 3;
    Zb++;
    B[Zb].xx = i + 1, B[Zb].yy = j, B[Zb].Zhong = 5, B[Zb].rr = r + 1, B[Zb].mr = mr;
}
void GunBomb(int i, int j, int r, int mr) {
    if (mr <= 0) return;
    Zb++;
    B[Zb].xx = i, B[Zb].yy = j + 2, B[Zb].Zhong = 6, B[Zb].rr = r, B[Zb].mr = mr - 1;
    Zb++;
    B[Zb].xx = i, B[Zb].yy = j, B[Zb].Zhong = 1, B[Zb].rr = r - 1, B[Zb].mr = r;
}
void GunBomb2(int i, int j, int r, int mr) {
    if (mr <= 0) return;
    Zb++;
    B[Zb].xx = i, B[Zb].yy = j - 2, B[Zb].Zhong = 7, B[Zb].rr = r, B[Zb].mr = mr - 1;
    Zb++;
    B[Zb].xx = i, B[Zb].yy = j, B[Zb].Zhong = 1, B[Zb].rr = r - 1, B[Zb].mr = r;
}
void ThreeBomb(int x, int y, int s, int ms) {
    for (int i = 1; i <= 3; i++) {
        int Xx = rand() % (2 * s + 1) - s, Yy = rand() % (2 * s + 1) - s;
        Zb++;
        B[Zb].xx = Xx + x, B[Zb].yy = Yy + y, B[Zb].Zhong = 1, B[Zb].rr = 0, B[Zb].mr = ms + rand() % 3 - 1;
    }
}
void Sheng(int a) {
    K++;
    for (int i = 1; i <= 20; i++) {
        int R = rand() % max(80 - (K / 10), 30);
        int Rr = rand() % 200;
        if (R <= 3) m[K + 28][i] = 2;
        else if (R <= 6) m[K + 28][i] = 7;
        else if (R <= 9) m[K + 28][i] = 8;
        if (Rr == 0) m[K + 28][i] = 9;
    }
    if (a != 1) system("cls"), Map(0);
}
void jia2() {
    system("cls");
    SetPos(0, 2);
    Color(1), cout << "●", Color(7), cout << "   ■ ", Color(8), cout << "   ■ ", Color(4), cout << "   ●    ", Color(9), cout << "~ ", Color(0), cout << "   ", Color(10), cout << "~ ", Color(3), cout << "   ◆";
    SetPos(2, 2);
    Color(0), cout << "你  泥土  石块  炸弹  岩浆  水  宝石";
    SetPos(4, 1), cout << "  ↑           空格放炸弹...";
    SetPos(5, 1), cout << "←  →移动 ";
    SetPos(6, 1), cout << "  ↓           可二段跳。";
    SetPos(8, 1), cout << "炸弹种类随机,计时3秒爆炸。";
    SetPos(10, 1), cout << "(一共有7种炸弹,有几率组合一起爆炸)";
    SetPos(12, 1), cout << "岩浆和水有几率向左右扩散...";
    SetPos(14, 1), cout << "它们相融会产生石块...";
    SetPos(16, 1), cout << "岩浆和爆炸波会使你减血,减分...";
    SetPos(18, 1), cout << "岩浆还会使你上跳,宝石可以加血,加分...";
    SetPos(20, 1), cout << "画面每隔一段时间会下降...";
    SetPos(22, 1), cout << "当你抵达画面底部时,画面会随你一起下降...";
    SetPos(24, 1), cout << "当你被抵在画面顶部时,会持续减血。";
    SetPos(26, 1), cout << "每隔一段时间分数会增加...";
    SetPos(28, 1);
    Color(1);
    cout << "按 y 返回!";
    char tt;
    while (tt != 'y') tt = _getch();
}
void jia1() {
    system("cls");
    SetPos(1, 1), Color(8), cout << "  项目            值            取值范围";
    Color(6);
    SetPos(2, 1), cout << "1.初分数:                      0到100  ";
    SetPos(2, 10), cout << cs_s;
    SetPos(3, 1), cout << "2.初血量:                      1到100  ";
    SetPos(3, 10), cout << cs_b;
    SetPos(4, 1), cout << "3.伤害减血:                     1到5    ";
    SetPos(4, 10), cout << sh_b;
    SetPos(5, 1), cout << "4.伤害减分:                    0到10   ";
    SetPos(5, 10), cout << sh_s;
    SetPos(6, 1), cout << "5.宝石加血:                    0到10   ";
    SetPos(6, 10), cout << hf_b;
    SetPos(7, 1), cout << "6.宝石加分:                    0到100  ";
    SetPos(7, 10), cout << hf_s;
    SetPos(8, 1), cout << "7.加分速度:                    1到50   ";
    SetPos(8, 10), cout << sd;
    SetPos(9, 1), cout << "8.炸弹价格:                    0到10   ";
    SetPos(9, 10), cout << fy;
    SetPos(10, 1), cout << "9.全部初始化";
    SetPos(12, 1), cout << "输入y返回";
    char tt = 'q';
er:
    Sleep(100);
    tt = 'q';
    while (tt != '1' && tt != '2' && tt != '3' && tt != '4' && tt != '5' && \
            tt != '6' && tt != '7' && tt != '8' && tt != '9' && tt != 'y' ) tt = _getch();
    SetPos(14, 1) ;
    Color(4);
    if (tt != '9' && tt != 'y') cout << "   请输入修改值(按'y'取消,回车键确定) ";

    switch (tt) {
        case '1':
            Color(9);
            SetPos(2, 1), cout << "1.初分数:                      0到100  ";
            SetPos(2, 10), cout << cs_s;
            cs_s = safein1(0, 100, cs_s);
            Color(6);
            SetPos(2, 1), cout << "1.初分数:                      0到100  ";
            SetPos(2, 10), cout << cs_s;
            SetPos(14, 1);
            cout << "                                     ";
            goto er;
        case '2':
            Color(9);
            SetPos(3, 1), cout << "2.初血量:                      1到100  ";
            SetPos(3, 10), cout << cs_b;
            cs_b = safein1(0, 100, cs_b);
            Color(6);
            SetPos(3, 1), cout << "2.初血量:                      1到100  ";
            SetPos(3, 10), cout << cs_b;
            SetPos(14, 1);
            cout << "                                     ";
            goto er;
        case '3':
            Color(9);
            SetPos(4, 1), cout << "3.伤害减血:                     1到5    ";
            SetPos(4, 10), cout << sh_b;
            sh_b = safein1(1, 5, sh_b);
            Color(6);
            SetPos(4, 1), cout << "3.伤害减血:                     1到5    ";
            SetPos(4, 10), cout << sh_b;
            SetPos(14, 1);
            cout << "                                     ";
            goto er;
        case '4':
            Color(9);
            SetPos(5, 1), cout << "4.伤害减分:                    0到10   ";
            SetPos(5, 10), cout << sh_s;
            sh_s = safein1(0, 10, sh_s);
            Color(6);
            SetPos(5, 1), cout << "4.伤害减分:                    0到10   ";
            SetPos(5, 10), cout << sh_s;
            SetPos(14, 1);
            cout << "                                     ";
            goto er;
        case '5':
            Color(9);
            SetPos(6, 1), cout << "5.宝石加血:                    0到10   ";
            SetPos(6, 10), cout << hf_b;
            hf_b = safein1(0, 10, hf_b);
            Color(6);
            SetPos(6, 1), cout << "5.宝石加血:                    0到10   ";
            SetPos(6, 10), cout << hf_b;
            SetPos(14, 1);
            cout << "                                     ";
            goto er;
        case '6':
            Color(9);
            SetPos(7, 1), cout << "6.宝石加分:                    0到100  ";
            SetPos(7, 10), cout << hf_s;
            hf_s = safein1(0, 100, hf_s);
            Color(6);
            SetPos(7, 1), cout << "6.宝石加分:                    0到100  ";
            SetPos(7, 10), cout << hf_s;
            SetPos(14, 1);
            cout << "                                     ";
            goto er;
        case '7':
            Color(9);
            SetPos(8, 1), cout << "7.加分速度:                    1到50   ";
            SetPos(8, 10), cout << sd;
            sd = safein1(1, 50, sd);
            Color(6);
            SetPos(8, 1), cout << "7.加分速度:                    1到50   ";
            SetPos(8, 10), cout << sd;
            SetPos(14, 1);
            cout << "                                     ";
            goto er;
        case '8':
            Color(9);
            SetPos(9, 1), cout << "8.炸弹价格:                    0到10   ";
            SetPos(9, 10), cout << fy;
            fy = safein1(0, 10, fy);
            Color(6);
            SetPos(9, 1), cout << "8.炸弹价格:                    0到10   ";
            SetPos(9, 10), cout << fy;
            SetPos(14, 1);
            cout << "                                     ";
            goto er;
        case '9':
            cs_b = 10, cs_s = 20, sh_b = 1, sd = 50;
            sh_s = 10, hf_b = 1, hf_s = 20, fy = 3;
            Color(6);
            SetPos(2, 10), cout << cs_s;
            SetPos(3, 10), cout << cs_b;
            SetPos(4, 10), cout << sh_b;
            SetPos(5, 10), cout << sh_s;
            SetPos(6, 10), cout << hf_b;
            SetPos(7, 10), cout << hf_s;
            SetPos(8, 10), cout << sd;
            SetPos(9, 10), cout << fy;
            goto er;
        case 'y':
            return;
            break;
    }
}
void Jiao() {
    qwe = 1;
    system("cls");
    SetPos(17, 9);
    Color(5);
    printf("1: 设置");
    SetPos(18, 9);
    printf("2: 说明");
    SetPos(19, 9);
    printf("3: 返回");
    char tt;
    while (tt != '1' && tt != '2' && tt != '3')  tt = _getch();
    if (tt == '2') {
        jia2();
    } else if (tt == '1') {
        jia1();
    } else return;
}
int Start() {
    Color(0);
    system("cls");
    SetPos(2, 5);
    Color(8), cout << "C++无限挖掘小游戏";
    SetPos(3, 3);
    Color(7), cout << "   改编自——csdn作者:\n        圣诞节快乐,劳伦斯";
    SetPos(7, 1);
    Color(7), cout << "网址:\nhttps://blog.csdn.net/zhaoniuniu0309?type=blog";
    SetPos(22, 2);
    Color(1);
    cout << "按 y 确定! ";
    SetPos(22, 10);
    Color(9);
    cout << "    开始游戏!    ";
    SetPos(24, 10);
    Color(0);
    cout << "    游戏设置!    ";
    SetPos(27, 1);
    Color(3);
    Color(0);
    char tt;
    int Ee = 0;
    while (tt != 'y') {
        tt = _getch();
        if (tt == 72 && Ee != 0) Ee--;
        if (tt == 80 && Ee != 2) Ee++;
        SetPos(22, 10);
        if (Ee == 0) Color(9);
        else Color(0);
        cout << "    开始游戏!    ";
        SetPos(24, 10);
        if (Ee == 1) Color(9);
        else Color(0);
        cout << "    游戏设置!    ";
    }
    system("color 0F");
    system("cls");
    Color(0);
    return Ee;
}
int main() {
    system("title 无限挖掘");
    cout << "Laoding......";
qqq:
    system("mode con cols=42 lines=31");

    CONSOLE_CURSOR_INFO cursor_info = {1, 0};
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
    srand((unsigned)time(NULL));
    int i = Start();
    if (i == 1) {
        Jiao();
        Color(4);
        system("cls");
        goto qqq;
    }

    system("cls");
    Blood = cs_b;
    Score = cs_s;
    K = -5, T = Win =  0;
    X = Y = 2;
    memset(m, 0, sizeof(m));
    memset(B, 0, sizeof(B));
    for (int i = 5; i <= 15; i++) for (int j = 1; j <= 20; j++) m[i][j] = 1;
    for (int i = 1; i <= 10; i++) Sheng(1);
    Map(0);
    while (Win == 0 ) {
        T++;
        Kb = 0;
        if (GetAsyncKeyState(VK_UP) & 0x8000 && tT == 0 && Er < 2) tT++, tX += 4, Er++;
        if ((GetAsyncKeyState(VK_UP) & 0x8000) ? 0 : 1) tT = 0;
        if (GetAsyncKeyState(VK_LEFT) & 0x8000 && Y > 1 && (m[X][Y - 1] == 1 || m[X][Y - 1] == 7 || m[X][Y - 1] == 8 || m[X][Y - 1] == 9) && (tY == 0 || tY >= 2)) SetPos(X - K, Y), cout << "  ", Y--;
        if (GetAsyncKeyState(VK_RIGHT) & 0x8000 && Y < 20 && (m[X][Y + 1] == 1 || m[X][Y + 1] == 7 || m[X][Y + 1] == 8 || m[X][Y + 1] == 9) && (tY2 == 0 || tY2 >= 2)) SetPos(X - K, Y), cout << "  ", Y++;
        if ((GetAsyncKeyState(VK_LEFT) & 0x8000) ? 0 : 1) tY = 0;
        if ((GetAsyncKeyState(VK_RIGHT) & 0x8000) ? 0 : 1) tY2 = 0;
        if ((GetAsyncKeyState(VK_LEFT) & 0x8000) ? 1 : 0) tY++;
        if ((GetAsyncKeyState(VK_RIGHT) & 0x8000) ? 1 : 0) tY2++;
        if (kbhit()) {//释放炸弹函数
            char e = _getch();
            if (e == ' ' && m[X - 1][Y] != 0 && m[X - 1][Y] != 2 && (m[X + 1][Y] <= 10 || m[X + 1][Y] >= 31) && Kb == 0 && Score >= fy) m[X][Y] = 10, X--, Score -= fy;
        }
        int zb = Zb;
        for (int i = zb - 10; i <= zb; i++) {
            if (B[i].Zhong == 1) CircleBomb(B[i].xx, B[i].yy, B[i].rr, B[i].mr), B[i].Zhong = 0;
            if (B[i].Zhong == 2) LineBomb(B[i].xx, B[i].yy), B[i].Zhong = 0;
            if (B[i].Zhong == 3) ThreeBomb(B[i].xx, B[i].yy, B[i].rr, B[i].mr), B[i].Zhong = 0;
            if (B[i].Zhong == 4) ZuanBomb(B[i].xx, B[i].yy), B[i].Zhong = 0;
            if (B[i].Zhong == 5) TrigleBomb(B[i].xx, B[i].yy, B[i].rr, B[i].mr), B[i].Zhong = 0;
            if (B[i].Zhong == 6) GunBomb(B[i].xx, B[i].yy, B[i].rr, B[i].mr), B[i].Zhong = 0;
            if (B[i].Zhong == 7) GunBomb2(B[i].xx, B[i].yy, B[i].rr, B[i].mr), B[i].Zhong = 0;
        }
        Map(1);
        Sleep(40);
        if (T % max(10, 40 - Score / 16) == 0 || Kb >= 1) Sheng(0);
        if (T % sd == 0) Score++;
        if (Score < 0) Win = -1;
    }
    if (Win != 0) {
        system("color 7F"), Color(4);
        SetPos(0, 7);
        if (Score >= 0) cout << "你的血量为0\n";
        else cout << "你的分数为0\n";
        Sleep(1000);
        SetPos(1, 7);
        cout << "You Die!!!", Sleep(1000);

    }
    system("cls");
    goto qqq;
}