问题标题: 可以分享几个游戏代码吗?

0
3
已解决
苏屹冉
苏屹冉
初级光能
初级光能

可以分享几个游戏代码吗?

苏屹冉在2020-10-07 13:05:56追加了内容

我采纳发的个数最多的


0
3
荣光峰
荣光峰
资深光能
资深光能

俄罗斯方块:

#include<iostream>
#include<string>
#include<ctime>
#include<cstdlib>
#include<windows.h>
#include<conio.h>

using namespace std;

int block00[4][4] = { { 10,0,0,0 },{ 1,1,1,1 },{ 0,0,0,0 },{ 0,0,0,0 } };
int block01[4][4] = { { 11,0,1,0 },{ 0,0,1,0 },{ 0,0,1,0 },{ 0,0,1,0 } };
int block02[4][4] = { { 12,0,0,0 },{ 0,0,0,0 },{ 1,1,1,0 },{ 0,1,0,0 } };
int block03[4][4] = { { 13,0,0,0 },{ 0,1,0,0 },{ 1,1,0,0 },{ 0,1,0,0 } };
int block04[4][4] = { { 14,0,0,0 },{ 0,0,0,0 },{ 0,1,0,0 },{ 1,1,1,0 } };
int block05[4][4] = { { 15,0,0,0 },{ 0,1,0,0 },{ 0,1,1,0 },{ 0,1,0,0 } };
int block06[4][4] = { { 16,0,0,0 },{ 0,0,0,0 },{ 1,1,1,0 },{ 1,0,0,0 } };
int block07[4][4] = { { 17,0,0,0 },{ 1,1,0,0 },{ 0,1,0,0 },{ 0,1,0,0 } };
int block08[4][4] = { { 18,0,0,0 },{ 0,0,0,0 },{ 0,0,1,0 },{ 1,1,1,0 } };
int block09[4][4] = { { 19,0,0,0 },{ 0,1,0,0 },{ 0,1,0,0 },{ 0,1,1,0 } };
int block10[4][4] = { { 20,0,0,0 },{ 0,0,0,0 },{ 1,1,1,0 },{ 0,0,1,0 } };
int block11[4][4] = { { 21,0,0,0 },{ 0,1,0,0 },{ 0,1,0,0 },{ 1,1,0,0 } };
int block12[4][4] = { { 22,0,0,0 },{ 0,0,0,0 },{ 1,0,0,0 },{ 1,1,1,0 } };
int block13[4][4] = { { 23,0,0,0 },{ 0,1,1,0 },{ 0,1,0,0 },{ 0,1,0,0 } };
int block14[4][4] = { { 24,0,0,0 },{ 0,0,0,0 },{ 0,1,1,0 },{ 1,1,0,0 } };
int block15[4][4] = { { 25,0,0,0 },{ 1,0,0,0 },{ 1,1,0,0 },{ 0,1,0,0 } };
int block16[4][4] = { { 26,0,0,0 },{ 0,0,0,0 },{ 1,1,0,0 },{ 0,1,1,0 } };
int block17[4][4] = { { 27,0,0,0 },{ 0,0,1,0 },{ 0,1,1,0 },{ 0,1,0,0 } };
int block18[4][4] = { { 28,0,0,0 },{ 0,0,0,0 },{ 1,1,0,0 },{ 1,1,0,0 } };

void initialWindow(HANDLE hOut);//初始化窗口
void initialPrint(HANDLE hOut);//初始化界面
void gotoXY(HANDLE hOut, int x, int y);//移动光标
void roundBlock(HANDLE hOut, int block[4][4]);//随机生成方块并打印到下一个方块位置
bool collisionDetection(int block[4][4], int map[21][12], int x, int y);//检测碰撞
void printBlock(HANDLE hOut, int block[4][4], int x, int y);//打印方块
void clearBlock(HANDLE hOut, int block[4][4], int x, int y);//消除方块
void myLeft(HANDLE hOut, int block[4][4], int map[21][12], int x, int &y);//左移
void myRight(HANDLE hOut, int block[4][4], int map[21][12], int x, int &y);//右移
void myUp(HANDLE hOut, int block[4][4], int map[21][12], int x, int &y);//顺时针旋转90度
int myDown(HANDLE hOut, int block[4][4], int map[21][12], int &x, int y);//加速下落
void myStop(HANDLE hOut, int block[4][4]);//游戏暂停
void gameOver(HANDLE hOut, int block[4][4], int map[21][12]);//游戏结束
void eliminateRow(HANDLE hOut, int map[21][12], int &val, int &fraction, int &checkpoint);//判断是否能消行并更新分值
int main()
{
    int map[21][12];
    int blockA[4][4];//候选区的方块
    int blockB[4][4];//下落中的方块
    int positionX, positionY;//方块左上角的坐标
    bool check;//检查方块还能不能下落
    char key;//用来存储按键
    int val;//用来控制下落速度
    int fraction;//用来存储得分
    int checkpoint;//用来存储关卡
    int times;
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);//获取标准输出设备句柄
    initialWindow(hOut);
initial:
    gotoXY(hOut, 0, 0);
    initialPrint(hOut);
    check = true;
    val = 50;
    fraction = 0;
    checkpoint = 1;
    times = val;
    for (int i = 0; i < 20; ++i)
    {
        for (int j = 1; j < 11; ++j)
        {
            map[i][j] = 0;
        }
    }
    for (int i = 0; i < 20; ++i)
    {
        map[i][0] = map[i][11] = 1;
    }
    for (int i = 0; i < 12; ++i)
    {
        map[20][i] = 1;
    }

    srand((unsigned)time(NULL));
    roundBlock(hOut, blockA);
    while (true)
    {
        if (check)
        {
            eliminateRow(hOut, map, val, fraction, checkpoint);
            check = false;
            positionX = -3;
            positionY = 4;
            if (collisionDetection(blockA, map, positionX, positionY))
            {
                for (int i = 0; i < 4; ++i)
                {
                    for (int j = 0; j < 4; ++j)
                    {
                        blockB[i][j] = blockA[i][j];
                    }
                }
                roundBlock(hOut, blockA);
            }
            else
            {
                gameOver(hOut, blockA, map);
                goto initial;
            }
        }
        printBlock(hOut, blockB, positionX, positionY);
        if (_kbhit())
        {
            key = _getch();
            switch (key)
            {
            case 72:
                myUp(hOut, blockB, map, positionX, positionY);
                break;
            case 75:
                myLeft(hOut, blockB, map, positionX, positionY);
                break;
            case 77:
                myRight(hOut, blockB, map, positionX, positionY);
                break;
            case 80:
                switch (myDown(hOut, blockB, map, positionX, positionY))
                {
                case 0:
                    check = false;
                    break;
                case 1:
                    check = true;
                    break;
                case 2:
                    gameOver(hOut, blockB, map);
                    goto initial;
                default:
                    break;
                }
                break;
            case 32:
                myStop(hOut, blockA);
                break;
            case 27:
                exit(0);
            default:
                break;
            }
        }
        Sleep(20);
        if (0 == --times)
        {
            switch (myDown(hOut, blockB, map, positionX, positionY))
            {
            case 0:
                check = false;
                break;
            case 1:
                check = true;
                break;
            case 2:
                gameOver(hOut, blockB, map);
                goto initial;
            default:
                break;
            }
            times = val;
        }
    }
    cin.get();
    return 0;
}

void initialWindow(HANDLE hOut)
{
    SetConsoleTitle("俄罗斯方块");
    COORD size = { 80, 25 };
    SetConsoleScreenBufferSize(hOut, size);
    SMALL_RECT rc = { 0, 0, 79, 24 };
    SetConsoleWindowInfo(hOut, true, &rc);
    CONSOLE_CURSOR_INFO cursor_info = { 1, 0 };
    SetConsoleCursorInfo(hOut, &cursor_info);
}

void initialPrint(HANDLE hOut)
{
    SetConsoleTextAttribute(hOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
    for (int i = 0; i < 20; ++i)
    {
        cout << "■                    ■☆                      ☆" << endl;
    }
    gotoXY(hOut, 26, 0);
    cout << "☆☆☆☆☆☆☆☆☆☆☆";
    gotoXY(hOut, 0, 20);
    cout << "■■■■■■■■■■■■☆☆☆☆☆☆☆☆☆☆☆☆☆";
    gotoXY(hOut, 26, 1);
    cout << "分    数:      ";
    gotoXY(hOut, 26, 2);
    cout << "关    卡:      ";
    gotoXY(hOut, 26, 4);
    cout << "下一方块:";
    gotoXY(hOut, 26, 9);
    cout << "操作方法:";
    gotoXY(hOut, 30, 11);
    cout << "↑:旋转 ↓:速降";
    gotoXY(hOut, 30, 12);
    cout << "→:右移 ←:左移";
    gotoXY(hOut, 30, 13);
    cout << "空格键:开始/暂停";
    gotoXY(hOut, 30, 14);
    cout << "Esc 键:退出";
    gotoXY(hOut, 26, 16);
    cout << "关    于:";
    gotoXY(hOut, 30, 18);
    cout << "俄罗斯方块V1.0";
    gotoXY(hOut, 35, 19);
    cout << "作者:潘约尔";
}

void gotoXY(HANDLE hOut, int x, int y)
{
    COORD pos;
    pos.X = x;
    pos.Y = y;
    SetConsoleCursorPosition(hOut, pos);
}

void roundBlock(HANDLE hOut, int block[4][4])
{
    clearBlock(hOut, block, 5, 15);
    switch (rand() % 19)
    {
    case 0:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block00[i][j];
            }
        }
        break;
    case 1:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block01[i][j];
            }
        }
        break;
    case 2:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block02[i][j];
            }
        }
        break;
    case 3:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block03[i][j];
            }
        }
        break;
    case 4:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block04[i][j];
            }
        }
        break;
    case 5:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block05[i][j];
            }
        }
        break;
    case 6:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block06[i][j];
            }
        }
        break;
    case 7:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block07[i][j];
            }
        }
        break;
    case 8:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block08[i][j];
            }
        }
        break;
    case 9:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block09[i][j];
            }
        }
        break;
    case 10:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block10[i][j];
            }
        }
        break;
    case 11:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block11[i][j];
            }
        }
        break;
    case 12:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block12[i][j];
            }
        }
        break;
    case 13:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block13[i][j];
            }
        }
        break;
    case 14:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block14[i][j];
            }
        }
        break;
    case 15:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block15[i][j];
            }
        }
        break;
    case 16:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block16[i][j];
            }
        }
        break;
    case 17:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block17[i][j];
            }
        }
        break;
    case 18:
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 4; ++j)
            {
                block[i][j] = block18[i][j];
            }
        }
        break;
    default:
        break;
    }
    printBlock(hOut, block, 5, 15);
}

bool collisionDetection(int block[4][4], int map[21][12], int x, int y)
{
    for (int i = 0; i < 4; ++i)
    {
        for (int j = 0; j < 4; ++j)
        {
            if (x + i >= 0 && y + j >= 0 && map[x + i][y + j] == 1 && block[i][j] == 1)
            {
                return false;
            }
        }
    }
    return true;
}

void printBlock(HANDLE hOut, int block[4][4], int x, int y)
{
    switch (block[0][0])
    {
    case 10:
    case 11:
        SetConsoleTextAttribute(hOut, FOREGROUND_GREEN);
        break;
    case 12:
    case 13:
    case 14:
    case 15:
        SetConsoleTextAttribute(hOut, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
        break;
    case 16:
    case 17:
    case 18:
    case 19:
        SetConsoleTextAttribute(hOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
        break;
    case 20:
    case 21:
    case 22:
    case 23:
        SetConsoleTextAttribute(hOut, FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
        break;
    case 24:
    case 25:
        SetConsoleTextAttribute(hOut, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
        break;
    case 26:
    case 27:
        SetConsoleTextAttribute(hOut, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
        break;
    case 28:
        SetConsoleTextAttribute(hOut, FOREGROUND_RED | FOREGROUND_INTENSITY);
        break;
    default:
        break;
    }
    for (int i = 0; i < 4; ++i)
    {
        if (i + x >= 0)
        {
            for (int j = 0; j < 4; ++j)
            {
                if (block[i][j] == 1)
                {

                    gotoXY(hOut, 2 * (y + j), x + i);
                    cout << "■";
                }
            }
        }
    }
}

void clearBlock(HANDLE hOut, int block[4][4], int x, int y)
{
    for (int i = 0; i < 4; ++i)
    {
        if (i + x >= 0)
        {
            for (int j = 0; j < 4; ++j)
            {
                if (block[i][j] == 1)
                {
                    gotoXY(hOut, 2 * (y + j), x + i);
                    cout << "  ";
                }
            }
        }
    }
}

void gameOver(HANDLE hOut, int block[4][4], int map[21][12])
{
    SetConsoleTextAttribute(hOut, FOREGROUND_RED | FOREGROUND_INTENSITY);
    gotoXY(hOut, 9, 8);
    cout << "GAME OVER";
    gotoXY(hOut, 8, 9);
    cout << "空格键:重来";
    gotoXY(hOut, 8, 10);
    cout << "ESC键:退出";
    char key;
    while (true)
    {
        key = _getch();
        if (key == 32)
        {
            return;
        }
        if (key == 27)
        {
            exit(0);
        }
    }
}

int myDown(HANDLE hOut, int block[4][4], int map[21][12], int &x, int y)
{
    if (collisionDetection(block, map, x + 1, y))
    {
        clearBlock(hOut, block, x, y);
        ++x;
        return 0;
    }
    if (x < 0)
    {
        return 2;
    }
    for (int i = 0; i < 4; ++i)
    {
        for (int j = 0; j < 4; ++j)
        {
            if (block[i][j] == 1)
            {
                map[x + i][y + j] = 1;
                SetConsoleTextAttribute(hOut, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
                gotoXY(hOut, 2 * (y + j), x + i);
                cout << "■";
            }
        }
    }
    return 1;
}

void myLeft(HANDLE hOut, int block[4][4], int map[21][12], int x, int &y)
{
    if (collisionDetection(block, map, x, y - 1))
    {
        clearBlock(hOut, block, x, y);
        --y;
    }
}

void myRight(HANDLE hOut, int block[4][4], int map[21][12], int x, int &y)
{
    if (collisionDetection(block, map, x, y + 1))
    {
        clearBlock(hOut, block, x, y);
        ++y;
    }
}

void myUp(HANDLE hOut, int block[4][4], int map[21][12], int x, int &y)
{
    switch (block[0][0])
    {
    case 10:
        if (collisionDetection(block01, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block01[i][j];
                }
            }
        }
        break;
    case 11:
        if (collisionDetection(block00, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block00[i][j];
                }
            }
        }
        else if (collisionDetection(block00, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block00[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block00, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block00[i][j];
                }
            }
            ++y;
        }
        else if (collisionDetection(block00, map, x, y - 2))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block00[i][j];
                }
            }
            y = y - 2;
        }
        else if (collisionDetection(block00, map, x, y + 2))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block00[i][j];
                }
            }
            y = y + 2;
        }
        break;
    case 12:
        if (collisionDetection(block03, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block03[i][j];
                }
            }
        }
        else if (collisionDetection(block03, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block03[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block03, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block03[i][j];
                }
            }
            ++y;
        }
        break;
    case 13:
        if (collisionDetection(block04, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block04[i][j];
                }
            }
        }
        else if (collisionDetection(block04, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block04[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block04, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block04[i][j];
                }
            }
            ++y;
        }
        break;
    case 14:
        if (collisionDetection(block05, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block05[i][j];
                }
            }
        }
        else if (collisionDetection(block05, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block05[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block05, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block05[i][j];
                }
            }
            ++y;
        }
        break;
    case 15:
        if (collisionDetection(block02, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block02[i][j];
                }
            }
        }
        else if (collisionDetection(block02, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block02[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block02, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block02[i][j];
                }
            }
            ++y;
        }
        break;

    case 16:
        if (collisionDetection(block07, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block07[i][j];
                }
            }
        }
        else if (collisionDetection(block07, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block07[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block07, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block07[i][j];
                }
            }
            ++y;
        }
        break;
    case 17:
        if (collisionDetection(block08, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block08[i][j];
                }
            }
        }
        else if (collisionDetection(block08, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block08[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block08, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block08[i][j];
                }
            }
            ++y;
        }
        break;
    case 18:
        if (collisionDetection(block09, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block09[i][j];
                }
            }
        }
        else if (collisionDetection(block09, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block09[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block09, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block09[i][j];
                }
            }
            ++y;
        }
        break;
    case 19:
        if (collisionDetection(block06, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block06[i][j];
                }
            }
        }
        else if (collisionDetection(block06, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block06[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block06, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block06[i][j];
                }
            }
            ++y;
        }
        break;
    case 20:
        if (collisionDetection(block11, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block11[i][j];
                }
            }
        }
        else if (collisionDetection(block11, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block11[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block11, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block11[i][j];
                }
            }
            ++y;
        }
        break;
    case 21:
        if (collisionDetection(block12, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block12[i][j];
                }
            }
        }
        else if (collisionDetection(block12, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block12[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block12, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block12[i][j];
                }
            }
            ++y;
        }
        break;
    case 22:
        if (collisionDetection(block13, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block13[i][j];
                }
            }
        }
        else if (collisionDetection(block13, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block13[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block13, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block13[i][j];
                }
            }
            ++y;
        }
        break;
    case 23:
        if (collisionDetection(block10, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block10[i][j];
                }
            }
        }
        else if (collisionDetection(block10, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block10[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block10, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block10[i][j];
                }
            }
            ++y;
        }
        break;
    case 24:
        if (collisionDetection(block15, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block15[i][j];
                }
            }
        }
        else if (collisionDetection(block15, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block15[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block15, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block15[i][j];
                }
            }
            ++y;
        }
        break;
    case 25:
        if (collisionDetection(block14, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block14[i][j];
                }
            }
        }
        else if (collisionDetection(block14, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block14[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block14, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block14[i][j];
                }
            }
            ++y;
        }
        break;
    case 26:
        if (collisionDetection(block17, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block17[i][j];
                }
            }
        }
        else if (collisionDetection(block17, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block17[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block17, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block17[i][j];
                }
            }
            ++y;
        }
        break;
    case 27:
        if (collisionDetection(block16, map, x, y))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block16[i][j];
                }
            }
        }
        else if (collisionDetection(block16, map, x, y - 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block16[i][j];
                }
            }
            --y;
        }
        else if (collisionDetection(block16, map, x, y + 1))
        {
            clearBlock(hOut, block, x, y);
            for (int i = 0; i < 4; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    block[i][j] = block16[i][j];
                }
            }
            ++y;
        }
        break;
    default:
        break;
    }
}

void myStop(HANDLE hOut, int block[4][4])
{
    clearBlock(hOut, block, 5, 15);
    SetConsoleTextAttribute(hOut, FOREGROUND_RED | FOREGROUND_INTENSITY);
    gotoXY(hOut, 30, 7);
    cout << "游戏暂停";
    char key;
    while (true)
    {
        key = _getch();
        if (key == 32)
        {
            gotoXY(hOut, 30, 7);
            cout << "        ";
            printBlock(hOut, block, 5, 15);
            return;
        }
        if (key == 27)
        {
            exit(0);
        }
    }
}

void eliminateRow(HANDLE hOut, int map[21][12], int &val, int &fraction, int &checkpoint)
{
    SetConsoleTextAttribute(hOut, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
    for (int i = 19; i >= 0; --i)
    {
        int x = 0;
        for (int j = 1; j < 11; ++j)
        {
            x += map[i][j];
        }
        if (x == 10)
        {
            fraction += 100;
            if (val > 1 && fraction / 1000 + 1 != checkpoint)
            {
                checkpoint = fraction / 1000 + 1;
                val -= 5;
            }
            for (int m = i; m > 0; --m)
            {
                for (int n = 1; n < 11; ++n)
                {
                    map[m][n] = map[m - 1][n];
                    gotoXY(hOut, 2 * n, m);
                    if (map[m][n] == 1)
                    {
                        cout << "■";
                    }
                    else
                    {
                        cout << "  ";
                    }
                }
            }
            ++i;
        }
    }
    gotoXY(hOut, 36, 1);
    cout << fraction;
    gotoXY(hOut, 36, 2);
    cout << checkpoint;
}

坦克大战:

#include<stdio.h>
#include <windows.h>
#include<conio.h>
#include<time.h>

void gotoxy(int x,int y);//控制光标。X表示横坐标,Y表示纵坐标
void my_print();//设置界面
void print_thing();//打印物品
void print_home();//打印老家
void refresh_map();//刷新地图
void stop();//暂停

void print_my_tank();//打印我的坦克
void print_tank_1();//打印坦克1号
void print_tank_2();//打印坦克2号
void print_tank_3();//打印坦克3号

void clear_my_tank();//清除我的坦克,用于坦克移动后
void clear_tank_1();//清除坦克1号
void clear_tank_2();//清除坦克2号
void clear_tank_3();//清除坦克3号

void turn_up(int a[][3]);//我的坦克上转
void turn_down(int a[][3]);//我的坦克下转
void turn_left(int a[][3]);//我的坦克左转
void turn_right(int a[][3]);//我的坦克右转

void turn_up_1(int a[][3]);//坦克1号上转
void turn_down_1(int a[][3]);//坦克1号下转
void turn_left_1(int a[][3]);//坦克1号左转
void turn_right_1(int a[][3]);//坦克1号右转

void turn_up_2(int a[][3]);//坦克2号上转
void turn_down_2(int a[][3]);//坦克2号下转
void turn_left_2(int a[][3]);//坦克2号左转
void turn_right_2(int a[][3]);//坦克2号右转

void turn_up_3(int a[][3]);//坦克3号上转
void turn_down_3(int a[][3]);//坦克3号下转
void turn_left_3(int a[][3]);//坦克3号左转
void turn_right_3(int a[][3]);//坦克3号右转

void my_move();//我的坦克移动
void move_1();//坦克1号移动
void move_2();//坦克2号移动
void move_3();//坦克3号移动

void print_bullet(int x,int y);//打印敌方坦克的子弹
void print_my_bullet(int x,int y);//打印我的子弹
void clear_bullet(int x,int y);//清楚子弹
int  check_bullet(int x,int y);//检查子弹是否碰撞,没碰返回1,碰到返回0
void shoot();//计算我的坦克子弹的坐标
void shoot_1();//计算坦克1号子弹的坐标
void shoot_2();//计算坦克2号子弹的坐标
void shoot_3();//计算坦克3号子弹的坐标

void change_thing();//记录物品的变化
void change_home();//记录老家的变化
void change_bullet();//纪录子弹的变化
void change_star();//记录星星的变化
void change_tank();//记录我的坦克的变化
void change_tank_1();//记录坦克1号的变化
void change_tank_2();//记录坦克2号的变化
void change_tank_3();//记录坦克3号的变化

void switch_weapons();//切换武器
void switch_skin();//切换皮肤
void help();//帮助
void check_game();//检查游戏胜负
void check_lv();//检查等级
void next_level();//下一关
void get_map();//获得每一关的地图
void initial();//将所有量初始化
void gameover();//游戏结束

void console();//控制窗口
void screen_1();//屏幕1
void screen_2(char *p,int color);//屏幕2
void screen_3();//屏幕3
void produce_star();//产生一个星星
void print_star();//打印星星
void check_star();//检查星星的数量
void clear_star();//清除星星

int my_abs(int x);//绝对值函数,用系统的会有问题
int judge(int x,int y,int state);//判断我的坦克能否前进
int judge2(int x,int y,int state);// 辅助电脑判断能否前进

int check1(int x,int y);//辅助电脑判断的函数
int check2(int x,int y);//辅助电脑判断的函数
int check3(int x,int y);//辅助电脑判断的函数


int life=3;//生命
int enemy=13;//敌人数量
int level=1;//关卡
int weapons=1;//武器
int skin=1;//皮肤
int star=1;//星星
int s=0,t=0;//星星坐标
int score=0;//分数
int lv=1;//等级
int speed=10;//速度
char *info[5]={" "," "," "," "," "};//通知

int map[30][30]={0};//记录整个屏幕上的物体
int thing[28][28]={0};//障碍物,不包括边界
//int home[3][4]={{2,2,2,2},{2,1,1,2},{2,1,1,2}};//老家,3行4列
int home[3][4]={{4,4,4,4},{4,1,1,4},{4,1,1,4}};
int my_tank[3][3]={0};//我的坦克
int tank_1[3][3]={0};//敌人的坦克1号
int tank_2[3][3]={0};//敌人的坦克2号
int tank_3[3][3]={0};//敌人的坦克3号

int x  , y ;//我的坦克中心坐标
int x1 , y1;//坦克1号中心坐标
int x2 , y2;//坦克2号中心坐标
int x3 , y3;//坦克3号中心坐标

int m=0  , n=0 ;//我的坦克子弹的坐标
int m1=0 , n1=0;//坦克1号子弹的坐标
int m2=0 , n2=0;//坦克2号子弹的坐标
int m3=0 , n3=0;//坦克3号子弹的坐标

int state=0; //我的坦克方向(1上,2下,3左,4右)
int state_1=0;//坦克1号方向
int state_2=0;//坦克2号方向
int state_3=0;//坦克3号方向

int direction=0;//我的坦克子弹射向
int direction_1=0;//坦克1号子弹射向
int direction_2=0;//坦克2号子弹射向
int direction_3=0;//坦克3号子弹射向

int cp1=2;//辅助电脑判断的变量
int cp2=2;//辅助电脑判断的变量
int cp3=2;//辅助电脑判断的变量

int main()//主函数
{
    srand(time(NULL));//设置随机数种子
    console();//设置窗口
    my_print();//打印边框
    initial();//所有量初始化
    while(1)
    {
        int i1,i2,i3,i4,i5,i6,i7;
        my_move();//控制我的坦克移动
        if(i1++%30==0) //控制敌人坦克速度
            move_1();
        if(i2++%30==0) 
            move_2();
        if(i3++%30==0) 
            move_3();
        if(i4++%speed==0)   //控制子弹速度
            shoot();
        if(i5++%speed==0)
            shoot_1();
        if(i6++%speed==0)
            shoot_2();
        if(i7++%speed==0)
            shoot_3();
        screen_1();//刷新屏幕
        Sleep(30);
    }
    return 0;
}

//设置光标输出的位置函数
void gotoxy(int x,int y)//X表示横坐标,Y表示纵坐标。
{
    HANDLE app;
    COORD  pos;
    pos.X=x;
    pos.Y=y;
    app=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(app,pos);
}

//控制窗口
void console()
{
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);  
    CONSOLE_SCREEN_BUFFER_INFO bInfo; 
    GetConsoleScreenBufferInfo(hOut, &bInfo );  
    SetConsoleTitle("坦克大战"); // 设置窗口的标题
    COORD size = {90, 32};//设置窗口大小
    SetConsoleScreenBufferSize(hOut,size);  
    SMALL_RECT rc = {0,0, 63, 31};
    SetConsoleWindowInfo(hOut,true ,&rc);
}

//打印边界
void my_print()
{
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN |FOREGROUND_INTENSITY);// 
    printf("■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ |﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊|\n");
    for(int i=0;i<13;i++)
    printf("■                                                        ■ |                          |\n");
    printf("■                                                        ■ |--------------------------|\n");
    for(int j=14;j<28;j++)
    printf("■                                                        ■ |                          |\n");
    printf("■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ |﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍|\n");
}


//打印与清除坦克
void print_my_tank()
{
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)
            if(my_tank[i][j]==1)
            {
                switch(skin)
                {
                case 1 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);//淡蓝色
                        gotoxy(2*x+2*j-2,y+i-1);
                        printf("■");
                    }break;
                case 2 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);//绿色
                        gotoxy(2*x+2*j-2,y+i-1);
                        printf("■");
                    }break;
                case 3 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);//黄色
                        gotoxy(2*x+2*j-2,y+i-1);
                        printf("■");
                    }break;
                case 4 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);//白色
                        gotoxy(2*x+2*j-2,y+i-1);
                        printf("■");
                    }break;
                case 5 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);//紫色
                        gotoxy(2*x+2*j-2,y+i-1);
                        printf("■");
                    }break;
                case 6 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);//红色
                        gotoxy(2*x+2*j-2,y+i-1);
                        printf("■");
                    }break;
                case 7 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);//蓝色
                        gotoxy(2*x+2*j-2,y+i-1);
                        printf("■");
                    }break;

                }

            }
}
void clear_my_tank()
{
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)
            {
                gotoxy(2*x+2*j-2,y+i-1);
                printf("  ");
            }
}
void print_tank_1()
{
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)
            if(tank_1[i][j]==1)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);// 紫色
                gotoxy(2*x1+2*j-2,y1+i-1);
                printf("■");
            }
}
void clear_tank_1()
{
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)
            {
                gotoxy(2*x1+2*j-2,y1+i-1);
                printf("  ");
            }
}
void print_tank_2()
{
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)
            if(tank_2[i][j]==1)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);// 紫色
                gotoxy(2*x2+2*j-2,y2+i-1);
                printf("■");
            }
}
void clear_tank_2()
{
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)
            {
                gotoxy(2*x2+2*j-2,y2+i-1);
                printf("  ");
            }
}
void print_tank_3()
{
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)
            if(tank_3[i][j]==1)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);// 紫色
                gotoxy(2*x3+2*j-2,y3+i-1);
                printf("■");
            }
}
void clear_tank_3()
{
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)
            {
                gotoxy(2*x3+2*j-2,y3+i-1);
                printf("  ");
            }
}

void print_thing()                // 打印物品
{
    for(int j=0;j<28;j++)         // 从坐标(1,1)点开始打印
        for(int i=0;i<28;i++)
            if(thing[i][j]==1)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
                gotoxy(2+2*j,1+i);
                printf("■");
            }
            else if(thing[i][j]==2)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);
                gotoxy(2+2*j,1+i);
                printf("■");
            }
            else if(thing[i][j]==3)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
                gotoxy(2+2*j,1+i);
                printf("■");
            }
            else if(thing[i][j]==4)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
                gotoxy(2+2*j,1+i);
                printf("■");
            }
}

void print_home()                 //打印老家
{


    for(int i=0;i<3;i++)          //打印老家外墙       
        for(int j=0;j<4;j++)
            if(home[i][j]==1)
                {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
                    gotoxy(26+2*j,26+i);
                    printf("■");
                }
            else if(home[i][j]==2)
                {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);
                    gotoxy(26+2*j,26+i);
                    printf("■");
                }
            else if(home[i][j]==3)
                {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
                    gotoxy(26+2*j,26+i);
                    printf("■");
                }


    {
    for(int i=1;i<3;i++)          //打印老家内部
        for(int j=1;j<3;j++)
                {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
                    gotoxy(26+2*j,26+i);
                    printf("■");
                }
    }

}


void print_bullet(int x,int y)    //打印敌方坦克的子弹子弹
{
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
    gotoxy(2*x,y);
    printf("⊕");
}

void print_my_bullet(int x,int y)    //打印我的子弹
{
    switch(weapons)
    {
    case 1 :
        {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
            gotoxy(2*x,y);
            printf("⊕");
        }break;
    case 2 :
        {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
            gotoxy(2*x,y);
            printf("∷");
        }break;
    case 3 :
        {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
            gotoxy(2*x,y);
            printf("◎");
        }break;
    case 4 :
        {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
            gotoxy(2*x,y);
            printf("※");
        }break;
    case 5 :
        {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
            gotoxy(2*x,y);
            printf("●");
        }break;
    }

}

void clear_bullet(int x,int y)
{
    gotoxy(2*x,y);
    printf("  ");
}


void screen_1()
{
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);
    gotoxy(62,2);
    printf("          第 %d 关         ",level);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    gotoxy(62,4);
    printf("分数: %d",score);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_RED);
    gotoxy(80,4);
    printf("LV: %d ",lv);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
    gotoxy(62,6);
    printf("生命:     坦克×%d         ",life-1);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
    gotoxy(62,8);
    printf("敌方:     坦克×%d        ",enemy);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
    gotoxy(62,11);
    printf("当前武器:                 ");
    switch(weapons)
    {
    case 1 :
        {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
            gotoxy(62,13);
            printf("         普通子弹 ⊕      ");
        }break;
    case 2 :
        {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
            gotoxy(62,13);
            printf("           散弹   ∷      ");
        }break;
    case 3 :
        {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
            gotoxy(62,13);
            printf("          气泡弹  ◎      ");
        }break;
    case 4 :
        {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
            gotoxy(62,13);
            printf("          雪花弹  ※      ");
        }break;
    case 5 :
        {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
            gotoxy(62,13);
            printf("         超级炮弹 ●      ");
        }break;
    }


}

void screen_2(char *p,int color)
{

    for(int i=15;i<27;i++)//先清屏
    {
        gotoxy(62,i);
        printf("                          ");
    }

    info[0]=info[1];//内容上移
    info[1]=info[2];
    info[2]=info[3];
    info[3]=info[4];
    info[4]=p;

    for(int j=15;j<22;j=j+2)
    {
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
        gotoxy(62,j);
        printf("%s",info[(j+1)/2-8]);
    }
    switch(color)
    {
    case 1 :
        {
             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);//绿
             gotoxy(62,23);
             printf("%s",info[4]);
        }break;
    case 2 :
        {
             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);//淡蓝
             gotoxy(62,23);
             printf("%s",info[4]);
        }break;
    case 3 :
        {
             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);//黄
             gotoxy(62,23);
             printf("%s",info[4]);
        }break;
    case 4 :
        {
             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);//红
             gotoxy(62,23);
             printf("%s",info[4]);
        }break;
    }
}

void screen_3()
{
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
    gotoxy(62,27);
    printf("          h键帮助  Esc退出");
    gotoxy(62,28);
    printf("                          ");
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
    if(star<=13)
    for(int i=1;i<=star;i++)
    {
        gotoxy(60+2*i,28);
        printf("★");
    }
}


void produce_star()
{
    int a=0;
    for(int i=4;i<26;i++)
    {
        for(int j=1;j<29;j++)
            if(map[i][j]==0 && rand()%300==0)
            {
                s=j,t=i;
                print_star();
                a=1;
                break;
            }
        if(a)
            break;
    }

}

void print_star()
{
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
        gotoxy(2*s,t);
        printf("★");
}

void change_star()
{
    if(s==x&&t==(y-1) || s==x&&t==(y+1) || s==(x-1)&&t==y || s==(x+1)&&t==y)
    {
        clear_star();
        s=0,t=0;
        star++;
        screen_2("恭喜你获得一颗星星",2);
        printf("\7");
        check_star();
        print_my_tank();
    }
    if(s==x1&&t==(y1-1) || s==x1&&t==(y1+1) || s==(x1-1)&&t==y1 || s==(x1+1)&&t==y1)
    {
        clear_star();
        s=0,t=0;
        screen_2("很遗憾星星被抢走了",4);
        printf("\7");
        print_tank_1();
    }
    if(s==x2&&t==(y2-1) || s==x2&&t==(y2+1) || s==(x2-1)&&t==y2 || s==(x2+1)&&t==y2)
    {
        clear_star();
        s=0,t=0;
        screen_2("很遗憾星星被抢走了",4);
        printf("\7");
        print_tank_2();
    }

    if(s==x3&&t==(y3-1) || s==x3&&t==(y3+1) || s==(x3-1)&&t==y3 || s==(x3+1)&&t==y3)
    {
        clear_star();
        s=0,t=0;
        screen_2("很遗憾星星被抢走了",4);
        printf("\7");
        print_tank_3();
    }

}

void clear_star()
{
    gotoxy(2*s,t);
    printf("  ");
}

void check_star()
{
    switch(star)
    {
    case 2 :screen_2("解锁新武器:  散弹",4),screen_3();break;
    case 3 :screen_2("成功解锁  绿色皮肤",2),screen_3();break;
    case 4 :screen_2("解锁新武器:  气泡弹",2),screen_3();break;
    case 5 :screen_2("成功解锁  黄色皮肤",3),screen_3();break;
    case 6 :screen_2("解锁新武器:  雪花弹",1),screen_3();break;
    case 7 :screen_2("成功解锁  白色皮肤",1),screen_3();break;
    case 8 :screen_2("解锁新武器:  超级炮弹",4),screen_3();break;
    case 9 :screen_2("成功解锁  紫色皮肤",1),screen_3();break;
    case 10 :screen_2("您已拥有10颗星啦",3),screen_3();break;
    case 11 :screen_2("成功解锁  红色皮肤",4),screen_3();break;
    case 12 :screen_2("您已拥有12颗星啦",3),screen_3();break;
    case 13 :screen_2("成功解锁 蓝色皮肤",1),screen_3();break;
    }

}

void switch_weapons()
{
    weapons++;
    if(weapons>star/2+1)
        weapons=1;
    if(star==1)
        screen_2("当前星星数不足,赶快收集吧",1);
    else
    {
        switch(weapons)
        {
        case 1 :screen_2("切换到普通子弹",1);break;
        case 2 :screen_2("切换到散弹",1);break;
        case 3 :screen_2("切换到气泡弹",1);break;
        case 4 :screen_2("切换到雪花弹",1);break;
        case 5 :screen_2("切换到超级炮弹弹",1);break;
        }
    }

}

void switch_skin()
{
    skin++;
    if(skin>(star-1)/2+1)
        skin=1;
    if(star==1 || star==2)
        screen_2("当前星星数不足,赶快收集吧",1);
    else
    {
        switch(skin)
        {
        case 1 :screen_2("切换到淡蓝色皮肤",1);break;
        case 2 :screen_2("切换到绿色皮肤",1);break;
        case 3 :screen_2("切换到黄色皮肤",1);break;
        case 4 :screen_2("切换到白色皮肤",1);break;
        case 5 :screen_2("切换到紫色皮肤",1);break;
        case 6 :screen_2("切换到红色皮肤",1);break;
        case 7 :screen_2("切换到蓝色皮肤",1);break;
        }
    }


}

void shoot()
{

    if(m!=0 || n!=0)
        if(map[n][m]==0)//如果子弹还留在地图上,就清除掉       
            clear_bullet(m,n);
    if(m==0 && n==0)//代表现在场上没有我的坦克的子弹,则重新发射子弹
    {
        switch(state)
        {
            case 1 :
                {
                    m=x;
                    n=y-2;
                    direction=1;
                }break;
            case 2 :
                {
                    m=x;
                    n=y+2;
                    direction=2;
                }break;
            case 3 :
                {
                    m=x-2;
                    n=y;
                    direction=3;
                }break;
            case 4 :
                {
                    m=x+2;
                    n=y;
                    direction=4;
                }break;
        }
    }
    else
    {
        switch(direction)
        {
            case 1 :n--;break;
            case 2 :n++;break;
            case 3 :m--;break;
            case 4 :m++;break;
        }
    }
    change_thing();//检查是否击中障碍物
    change_home();//检查是否击中老家
    change_bullet();//检查是否击中子弹
    change_tank_1();//检查是否击中坦克1号
    change_tank_2();//检查是否击中坦克2号
    change_tank_3();//检查是否击中坦克3号
    if(check_bullet(m,n))   
        print_my_bullet(m,n);
    else
        m=0,n=0;
}

void shoot_1()
{

    if(m1!=0 || n1!=0)
        if(map[n1][m1]==0)//如果子弹还留在地图上,就清除掉     
            clear_bullet(m1,n1);
    if(m1==0 && n1==0)//代表现在场上没有坦克1号的子弹,则重新发射子弹
    {
        switch(state_1)
        {
            case 1 :
                {
                    m1=x1;
                    n1=y1-2;
                    direction_1=1;
                }break;
            case 2 :
                {
                    m1=x1;
                    n1=y1+2;
                    direction_1=2;
                }break;
            case 3 :
                {
                    m1=x1-2;
                    n1=y1;
                    direction_1=3;
                }break;
            case 4 :
                {
                    m1=x1+2;
                    n1=y1;
                    direction_1=4;
                }break;
        }
    }
    else
    {
        switch(direction_1)
        {
            case 1 :n1--;break;
            case 2 :n1++;break;
            case 3 :m1--;break;
            case 4 :m1++;break;
        }
    }
    change_thing();//检查是否击中障碍物
    change_home();//检查是否击中老家
    change_bullet();//检查是否击中子弹
    change_tank();//检查是否击中我的坦克
    if(check_bullet(m1,n1)) 
        print_bullet(m1,n1);
    else
        m1=0,n1=0;
}

void shoot_2()
{

    if(m2!=0 || n2!=0)
        if(map[n2][m2]==0)//如果子弹还留在地图上,就清除掉     
            clear_bullet(m2,n2);
    if(m2==0 && n2==0)//代表现在场上没有坦克2号的子弹,则重新发射子弹
    {
        switch(state_2)
        {
            case 1 :
                {
                    m2=x2;
                    n2=y2-2;
                    direction_2=1;
                }break;
            case 2 :
                {
                    m2=x2;
                    n2=y2+2;
                    direction_2=2;
                }break;
            case 3 :
                {
                    m2=x2-2;
                    n2=y2;
                    direction_2=3;
                }break;
            case 4 :
                {
                    m2=x2+2;
                    n2=y2;
                    direction_2=4;
                }break;
        }
    }
    else
    {
        switch(direction_2)
        {
            case 1 :n2--;break;
            case 2 :n2++;break;
            case 3 :m2--;break;
            case 4 :m2++;break;
        }
    }
    change_thing();//检查是否击中障碍物
    change_home();//检查是否击中老家
    change_bullet();//检查是否击中子弹
    change_tank();//检查是否击中我的坦克
    if(check_bullet(m2,n2)) 
        print_bullet(m2,n2);
    else
        m2=0,n2=0;
}


void shoot_3()
{

    if(m3!=0 || n3!=0)
        if(map[n3][m3]==0)//如果子弹还留在地图上,就清除掉     
            clear_bullet(m3,n3);
    if(m3==0 && n3==0)//代表现在场上没有坦克3号的子弹,则重新发射子弹
    {
        switch(state_3)
        {
            case 1 :
                {
                    m3=x3;
                    n3=y3-2;
                    direction_3=1;
                }break;
            case 2 :
                {
                    m3=x3;
                    n3=y3+2;
                    direction_3=2;
                }break;
            case 3 :
                {
                    m3=x3-2;
                    n3=y3;
                    direction_3=3;
                }break;
            case 4 :
                {
                    m3=x3+2;
                    n3=y3;
                    direction_3=4;
                }break;
        }
    }
    else
    {
        switch(direction_3)
        {
            case 1 :n3--;break;
            case 2 :n3++;break;
            case 3 :m3--;break;
            case 4 :m3++;break;
        }
    }
    change_thing();//检查是否击中障碍物
    change_home();//检查是否击中老家
    change_bullet();//检查是否击中子弹
    change_tank();//检查是否击中我的坦克
    if(check_bullet(m3,n3))
        print_bullet(m3,n3);
    else
        m3=0,n3=0;
}

void turn_up(int a[][3])
{
    int tank_up[3][3]={{0,1,0},{1,1,1},{1,0,1}};
    if(state==1)
    {
        if(judge(x,y,state))
        {
            clear_my_tank();
            y--;
            print_my_tank();
            refresh_map();
        }
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_up[i][j];
        clear_my_tank();
        print_my_tank();
        state=1;
        refresh_map();

    }
    change_star();
}


void turn_down(int a[][3])
{
    int tank_down[3][3]={{1,0,1},{1,1,1},{0,1,0}};
    if(state==2)
    {
        if(judge(x,y,state))
        {
            clear_my_tank();
            y++;
            print_my_tank();
            refresh_map();
        }
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_down[i][j];
        clear_my_tank();
        print_my_tank();
        state=2;
        refresh_map();
    }
    change_star();

}

void turn_left(int a[][3])
{
    int tank_left[3][3]={{0,1,1},{1,1,0},{0,1,1}};
    if(state==3)
    {
        if(judge(x,y,state))
        {
            clear_my_tank();
            x--;
            print_my_tank();
            refresh_map();
        }
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_left[i][j];
        clear_my_tank();
        print_my_tank();
        state=3;
        refresh_map();
    }
    change_star();

}

void turn_right(int a[][3])
{
    int tank_right[3][3]={{1,1,0},{0,1,1},{1,1,0}};
    if(state==4)
    {
        if(judge(x,y,state))
        {
            clear_my_tank();
            x++;
            print_my_tank();
            refresh_map();
        }
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_right[i][j];
        clear_my_tank();
        print_my_tank();
        state=4;
        refresh_map();
    }
    change_star();

}

void turn_up_1(int a[][3])
{
    int tank_up[3][3]={{0,1,0},{1,1,1},{1,0,1}};
    if(state_1==1)
    {
        clear_tank_1();
        y1--;
        print_tank_1();
        refresh_map();
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_up[i][j];
        clear_tank_1();
        print_tank_1();
        state_1=1;
        refresh_map();
    }
}

void turn_down_1(int a[][3])
{
    int tank_down[3][3]={{1,0,1},{1,1,1},{0,1,0}};
    if(state_1==2)
    {
        clear_tank_1();
        y1++;
        print_tank_1();
        refresh_map();
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_down[i][j];
        clear_tank_1();
        print_tank_1();
        state_1=2;
        refresh_map();
    }
}

void turn_left_1(int a[][3])
{
    int tank_left[3][3]={{0,1,1},{1,1,0},{0,1,1}};
    if(state_1==3)
    {
        clear_tank_1();
        x1--;
        print_tank_1();
        refresh_map();
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_left[i][j];
        clear_tank_1();
        print_tank_1();
        state_1=3;
        refresh_map();
    }
}

void turn_right_1(int a[][3])
{
    int tank_right[3][3]={{1,1,0},{0,1,1},{1,1,0}};
    if(state_1==4)
    {
        clear_tank_1();
        x1++;
        print_tank_1();
        refresh_map();
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_right[i][j];
        clear_tank_1();
        print_tank_1();
        state_1=4;
        refresh_map();
    }
}

void turn_up_2(int a[][3])
{
    int tank_up[3][3]={{0,1,0},{1,1,1},{1,0,1}};
    if(state_2==1)
    {
        clear_tank_2();
        y2--;
        print_tank_2();
        refresh_map();
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_up[i][j];
        clear_tank_2();
        print_tank_2();
        state_2=1;
        refresh_map();
    }
}

void turn_down_2(int a[][3])
{
    int tank_down[3][3]={{1,0,1},{1,1,1},{0,1,0}};
    if(state_2==2)
    {
        clear_tank_2();
        y2++;
        print_tank_2();
        refresh_map();
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_down[i][j];
        clear_tank_2();
        print_tank_2();
        state_2=2;
        refresh_map();
    }
}

void turn_left_2(int a[][3])
{
    int tank_left[3][3]={{0,1,1},{1,1,0},{0,1,1}};
    if(state_2==3)
    {
        clear_tank_2();
        x2--;
        print_tank_2();
        refresh_map();
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_left[i][j];
        clear_tank_2();
        print_tank_2();
        state_2=3;
        refresh_map();
    }
}

void turn_right_2(int a[][3])
{
    int tank_right[3][3]={{1,1,0},{0,1,1},{1,1,0}};
    if(state_2==4)
    {
        clear_tank_2();
        x2++;
        print_tank_2();
        refresh_map();
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_right[i][j];
        clear_tank_2();
        print_tank_2();
        state_2=4;
        refresh_map();
    }
}

void turn_up_3(int a[][3])
{
    int tank_up[3][3]={{0,1,0},{1,1,1},{1,0,1}};
    if(state_3==1)
    {
        clear_tank_3();
        y3--;
        print_tank_3();
        refresh_map();
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_up[i][j];
        clear_tank_3();
        print_tank_3();
        state_3=1;
        refresh_map();
    }
}

void turn_down_3(int a[][3])
{
    int tank_down[3][3]={{1,0,1},{1,1,1},{0,1,0}};
    if(state_3==2)
    {
        clear_tank_3();
        y3++;
        print_tank_3();
        refresh_map();
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_down[i][j];
        clear_tank_3();
        print_tank_3();
        state_3=2;
        refresh_map();
    }
}

void turn_left_3(int a[][3])
{
    int tank_left[3][3]={{0,1,1},{1,1,0},{0,1,1}};
    if(state_3==3)
    {
        clear_tank_3();
        x3--;
        print_tank_3();
        refresh_map();
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_left[i][j];
        clear_tank_3();
        print_tank_3();
        state_3=3;
        refresh_map();
    }
}

void turn_right_3(int a[][3])
{
    int tank_right[3][3]={{1,1,0},{0,1,1},{1,1,0}};
    if(state_3==4)
    {
        clear_tank_3();
        x3++;
        print_tank_3();
        refresh_map();
    }
    else
    {
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                a[i][j]=tank_right[i][j];
        clear_tank_3();
        print_tank_3();
        state_3=4;
        refresh_map();
    }
}

int judge(int x,int y,int state)//x,y坦克当前坐标,state坦克当前方向
{
    switch(state)
    {
    case 1 :if(map[y-2][x]==0 && map[y-1][x-1]==0 && map[y-1][x+1]==0 && map[y-2][x-1]==0 && map[y-2][x+1]==0)
                return 1;
            else
                return 0;
    case 2 :if(map[y+2][x]==0 && map[y+1][x-1]==0 && map[y+1][x+1]==0 && map[y+2][x-1]==0 && map[y+2][x+1]==0)
                return 1;
            else
                return 0;
    case 3 :if(map[y][x-2]==0 && map[y-1][x-1]==0 && map[y+1][x-1]==0 && map[y-1][x-2]==0 && map[y+1][x-2]==0)
                return 1;
            else
                return 0;
    case 4 :if(map[y][x+2]==0 && map[y-1][x+1]==0 && map[y+1][x+1]==0 && map[y-1][x+2]==0 && map[y+1][x+2]==0)
                return 1;
            else
                return 0;
    }
}

int judge2(int x,int y,int state)//x,y坦克当前坐标,state坦克当前方向
{
    switch(state)
    {
    case 1 :if(map[y-2][x]==0 && map[y-2][x-1]==0 && map[y-2][x+1]==0)
                return 1;
            else
                return 0;
    case 2 :if(map[y+2][x]==0 && map[y+2][x-1]==0 && map[y+2][x+1]==0)
                return 1;
            else
                return 0;
    case 3 :if(map[y][x-2]==0 && map[y-1][x-2]==0 && map[y+1][x-2]==0)
                return 1;
            else
                return 0;
    case 4 :if(map[y][x+2]==0 && map[y-1][x+2]==0 && map[y+1][x+2]==0)
                return 1;
            else
                return 0;
    }
}

void refresh_map()               //i代表行,即纵坐标;j代表列,即横坐标
{
    {
        for(int i=0;i<30;i++)          //首先地图清零
            for(int j=0;j<30;j++)
                map[i][j]=0;
    }

    {
        for(int i=0;i<30;i++)    //地图第一部分:围墙(完全不动)
        {
            map[i][0]=1;
            map[i][29]=1;
        }
        for(int j=0;j<30;j++) 
        {
            map[0][j]=1;
            map[29][j]=1;
        }
    }

    {
        for(int i=0;i<3;i++)   //地图第二部分:老家(几乎不动)
            for(int j=0;j<4;j++)
                map[i+26][j+13]=home[i][j];
    }

    {
        for(int i=0;i<28;i++)  //地图第三部分:障碍物(有时改变)
            for(int j=0;j<28;j++)
                map[i+1][j+1]=thing[i][j];
    }

    {
        switch(state)          //地图第四部分:坦克(总是改变)
        {
        case 1 :
            {
                map[y-1][x-1]=0;  map[y-1][x]=1;      map[y-1][x+1]=0;
                map[y][x-1]=1;    map[y][x]=1;        map[y][x+1]=1;
                map[y+1][x-1]=1;  map[y+1][x]=0;      map[y+1][x+1]=1;

            }break;
        case 2 :
            {
                map[y-1][x-1]=1;  map[y-1][x]=0;      map[y-1][x+1]=1;
                map[y][x-1]=1;    map[y][x]=1;        map[y][x+1]=1;
                map[y+1][x-1]=0;  map[y+1][x]=1;      map[y+1][x+1]=0;
            }break;
        case 3 :
            {
                map[y-1][x-1]=0;  map[y-1][x]=1;      map[y-1][x+1]=1;
                map[y][x-1]=1;    map[y][x]=1;        map[y][x+1]=0;
                map[y+1][x-1]=0;  map[y+1][x]=1;      map[y+1][x+1]=1;
            }break;
        case 4 :
            {
                map[y-1][x-1]=1;  map[y-1][x]=1;      map[y-1][x+1]=0;
                map[y][x-1]=0;    map[y][x]=1;        map[y][x+1]=1;
                map[y+1][x-1]=1;  map[y+1][x]=1;      map[y+1][x+1]=0;
            }break;
        }

        switch(state_1)
        {
        case 1 :
            {
                map[y1-1][x1-1]=0;  map[y1-1][x1]=1;      map[y1-1][x1+1]=0;
                map[y1][x1-1]=1;    map[y1][x1]=1;        map[y1][x1+1]=1;
                map[y1+1][x1-1]=1;  map[y1+1][x1]=0;      map[y1+1][x1+1]=1;

            }break;
        case 2 :
            {
                map[y1-1][x1-1]=1;  map[y1-1][x1]=0;      map[y1-1][x1+1]=1;
                map[y1][x1-1]=1;    map[y1][x1]=1;        map[y1][x1+1]=1;
                map[y1+1][x1-1]=0;  map[y1+1][x1]=1;      map[y1+1][x1+1]=0;
            }break;
        case 3 :
            {
                map[y1-1][x1-1]=0;  map[y1-1][x1]=1;      map[y1-1][x1+1]=1;
                map[y1][x1-1]=1;    map[y1][x1]=1;        map[y1][x1+1]=0;
                map[y1+1][x1-1]=0;  map[y1+1][x1]=1;      map[y1+1][x1+1]=1;
            }break;
        case 4 :
            {
                map[y1-1][x1-1]=1;  map[y1-1][x1]=1;      map[y1-1][x1+1]=0;
                map[y1][x1-1]=0;    map[y1][x1]=1;        map[y1][x1+1]=1;
                map[y1+1][x1-1]=1;  map[y1+1][x1]=1;      map[y1+1][x1+1]=0;
            }break;
        }

        switch(state_2)
        {
        case 1 :
            {
                map[y2-1][x2-1]=0;  map[y2-1][x2]=1;      map[y2-1][x2+1]=0;
                map[y2][x2-1]=1;    map[y2][x2]=1;        map[y2][x2+1]=1;
                map[y2+1][x2-1]=1;  map[y2+1][x2]=0;      map[y2+1][x2+1]=1;

            }break;
        case 2 :
            {
                map[y2-1][x2-1]=1;  map[y2-1][x2]=0;      map[y2-1][x2+1]=1;
                map[y2][x2-1]=1;    map[y2][x2]=1;        map[y2][x2+1]=1;
                map[y2+1][x2-1]=0;  map[y2+1][x2]=1;      map[y2+1][x2+1]=0;
            }break;
        case 3 :
            {
                map[y2-1][x2-1]=0;  map[y2-1][x2]=1;      map[y2-1][x2+1]=1;
                map[y2][x2-1]=1;    map[y2][x2]=1;        map[y2][x2+1]=0;
                map[y2+1][x2-1]=0;  map[y2+1][x2]=1;      map[y2+1][x2+1]=1;
            }break;
        case 4 :
            {
                map[y2-1][x2-1]=1;  map[y2-1][x2]=1;      map[y2-1][x2+1]=0;
                map[y2][x2-1]=0;    map[y2][x2]=1;        map[y2][x2+1]=1;
                map[y2+1][x2-1]=1;  map[y2+1][x2]=1;      map[y2+1][x2+1]=0;
            }break;
        }

        switch(state_3)
        {
        case 1 :
            {
                map[y3-1][x3-1]=0;  map[y3-1][x3]=1;      map[y3-1][x3+1]=0;
                map[y3][x3-1]=1;    map[y3][x3]=1;        map[y3][x3+1]=1;
                map[y3+1][x3-1]=1;  map[y3+1][x3]=0;      map[y3+1][x3+1]=1;

            }break;
        case 2 :
            {
                map[y3-1][x3-1]=1;  map[y3-1][x3]=0;      map[y3-1][x3+1]=1;
                map[y3][x3-1]=1;    map[y3][x3]=1;        map[y3][x3+1]=1;
                map[y3+1][x3-1]=0;  map[y3+1][x3]=1;      map[y3+1][x3+1]=0;
            }break;
        case 3 :
            {
                map[y3-1][x3-1]=0;  map[y3-1][x3]=1;      map[y3-1][x3+1]=1;
                map[y3][x3-1]=1;    map[y3][x3]=1;        map[y3][x3+1]=0;
                map[y3+1][x3-1]=0;  map[y3+1][x3]=1;      map[y3+1][x3+1]=1;
            }break;
        case 4 :
            {
                map[y3-1][x3-1]=1;  map[y3-1][x3]=1;      map[y3-1][x3+1]=0;
                map[y3][x3-1]=0;    map[y3][x3]=1;        map[y3][x3+1]=1;
                map[y3+1][x3-1]=1;  map[y3+1][x3]=1;      map[y3+1][x3+1]=0;
            }break;
        }
    }
}


void my_move()
{
    char key;
    if (kbhit()) //检测,如果有按键就执行if里面的
    {
        key = getch();//捕获按键
        switch( key ) 
        {
        case 72:turn_up(my_tank);//上
            break;
        case 75:turn_left(my_tank);//左
            break;
        case 77:turn_right(my_tank);//右
            break;
        case 80:turn_down(my_tank);//下
            break;
        case 32:stop();//空格 暂停或开始
            break;
        case 104:help();//小h切换到帮助菜单
            break;
        case 115:switch_skin(),print_my_tank();//小s键切换皮肤
            break;
        case 119:switch_weapons();//小w键切换武器
            break;

        case 27:exit(0);//Esc 退出
        default: ;
        }
    }
}

int check1(int x,int y)//在正上面,用它检测
{
    for(int j=y;j<27;j++)
        if(map[j][x]==4)
            return 0;
    return 1;
}

int check2(int x,int y)//在正左面,用它检测
{
    for(int i=x;i<14;i++)
        if(map[y][i]==4)
            return 0;
    return 1;
}

int check3(int x,int y)//在正右面,用它检测
{
    for(int i=x;i>15;i--)
        if(map[y][i]==4)
            return 0;
    return 1;
}

void move_1()
{
    if((x1==14 || x1==15) && check1(x1,y1))//在正上面
    {
            if(state_1!=2)
                turn_down_1(tank_1);
    }
    else if(x1<14 && y1==27 && check2(x1,y1))//在正左面
    {
            if(state_1!=4)
                turn_right_1(tank_1);
    }
    else if(x1>15 && y1==27 && check3(x1,y1))//在正右面
    {
            if(state_1!=3)
                turn_left_1(tank_1);
    }
    else
    {
        if(judge2(x1,y1,cp1))
            switch(cp1)
            {
            case 1 :turn_up_1(tank_1);break;
            case 2 :turn_down_1(tank_1);break;
            case 3 :turn_left_1(tank_1);break;
            case 4 :turn_right_1(tank_1);break;
            }
        while(judge2(x1,y1,cp1) == 0)
        {
            cp1=(rand()%4+1);
        }

    }


}

void move_2()
{
    if((x2==14 || x2==15) && check1(x2,y2))//在正上面
    {
            if(state_2!=2)
                turn_down_2(tank_2);
    }
    else if(x2<14 && y2==27 && check2(x2,y2))//在正左面
    {
            if(state_2!=4)
                turn_right_2(tank_2);
    }
    else if(x2>15 && y2==27 && check3(x2,y2))//在正右面
    {
            if(state_2!=3)
                turn_left_2(tank_2);
    }
    else
    {
        if(judge2(x2,y2,cp2))
            switch(cp2)
            {
            case 1 :turn_up_2(tank_2);break;
            case 2 :turn_down_2(tank_2);break;
            case 3 :turn_left_2(tank_2);break;
            case 4 :turn_right_2(tank_2);break;
            }
        while(judge2(x2,y2,cp2) == 0)
        {
            cp2=(rand()%4+1);
        }

    }
}

void move_3()
{
    if((x3==14 || x3==15) && check1(x3,y3))//在正上面
    {
            if(state_3!=2)
                turn_down_3(tank_3);
    }
    else if(x3<14 && y3==27 && check2(x3,y3))//在正左面
    {
            if(state_3!=4)
                turn_right_3(tank_3);
    }
    else if(x3>15 && y3==27 && check3(x3,y3))//在正右面
    {

            if(state_3!=3)
                turn_left_3(tank_3);
    }
    else
    {
        if(judge2(x3,y3,cp3))
            switch(cp3)
            {
            case 1 :turn_up_3(tank_3);break;
            case 2 :turn_down_3(tank_3);break;
            case 3 :turn_left_3(tank_3);break;
            case 4 :turn_right_3(tank_3);break;
            }
        while(judge2(x3,y3,cp3) == 0)
        {
            cp3=(rand()%4+1);
        }

    }
}

int check_bullet(int x,int y)
{
    if(map[y][x])
        return 0;
    return 1;
}

void change_thing()//物品被子弹击中会改变
{
    if(m>0&&m<29 && n>0&&n<29)//被我的子弹击中
        if(thing[n-1][m-1]==1)//打中第一种方块
        {
            if(weapons==2)
            {
                if(thing[n][m-1]==1)
                    thing[n][m-1]=0;
                    gotoxy(2*m,n+1);
                    printf("  ");//擦去方块
                if(thing[n-2][m-1]==1)
                    thing[n-2][m-1]=0;
                    gotoxy(2*m,n-1);
                    printf("  ");//擦去方块
                if(thing[n-1][m]==1)
                    thing[n-1][m]=0;
                    gotoxy(2*(m+1),n);
                    printf("  ");//擦去方块
                if(thing[n-1][m-2]==1)
                    thing[n-1][m-2]=0;
                    gotoxy(2*(m-1),n);
                    printf("  ");//擦去方块
                thing[n-1][m-1]=0;
                gotoxy(2*m,n);
                printf("  ");//擦去方块
                m=0,n=0;//子弹消失
                print_thing();
                refresh_map();
            }
            else if(weapons==3)
            {
                thing[n-1][m-1]=0;
                gotoxy(2*m,n);
                printf("  ");//擦去方块
                print_my_bullet(m,n);
                print_thing();
                refresh_map();
            }
            else
            {
                thing[n-1][m-1]=0;
                gotoxy(2*m,n);
                printf("  ");//擦去方块
                m=0,n=0;//子弹消失
                print_thing();
                refresh_map();
            }

        }

        else if(thing[n-1][m-1]==2)//打到第二种方块
        {
            if(weapons==5)
            {
                thing[n-1][m-1]=0;
                gotoxy(2*m,n);
                printf("  ");
                m=0,n=0;//子弹消失
                print_thing();
                refresh_map();
            }
            else if(weapons==2)
            {
                m=0,n=0;
            }
            else
            {
                thing[n-1][m-1]=1;
                m=0,n=0;//子弹消失
                print_thing();
                refresh_map();
            }
        }

        else if(thing[n-1][m-1]==3)
        {
            if(weapons==4 || weapons==2)
                m=0,n=0;
            else if(weapons==5)
            {
                thing[n-1][m-1]=0;
                gotoxy(2*m,n);
                printf("  ");
                m=0,n=0;//子弹消失
                print_thing();
                refresh_map();
            }
            else
            {
                thing[n-1][m-1]=2;
                m=0,n=0;//子弹消失
                print_thing();
                refresh_map();
            }
        }

        else if(thing[n-1][m-1]==4)//此方块不受子弹影响
        {
            m=0,n=0;//子弹消失
        }

    if(m1>0&&m1<29 && n1>0&&n1<29)//被坦克1号子弹击中
        if(thing[n1-1][m1-1]==1)
        {
            thing[n1-1][m1-1]=0;
            gotoxy(2*m1,n1);
            printf("  ");
            m1=0,n1=0;
            print_thing();
            refresh_map();
        }
        else if(thing[n1-1][m1-1]==2)
        {
            thing[n1-1][m1-1]=1;
            m1=0,n1=0;//子弹消失
            print_thing();
            refresh_map();
        }
        else if(thing[n1-1][m1-1]==3)
        {
            thing[n1-1][m1-1]=2;
            m1=0,n1=0;//子弹消失
            print_thing();
            refresh_map();
        }
        else if(thing[n-1][m-1]==4)//此方块不受子弹影响
        {
            m1=0,n1=0;//子弹消失
        }

    if(m2>0&&m2<29 && n2>0&&n2<29)
        if(thing[n2-1][m2-1]==1)
        {
            thing[n2-1][m2-1]=0;
            gotoxy(2*m2,n2);
            printf("  ");
            m2=0,n2=0;
            print_thing();
            refresh_map();
        }
        else if(thing[n2-1][m2-1]==2)
        {
            thing[n2-1][m2-1]=1;
            m2=0,n2=0;//子弹消失
            print_thing();
            refresh_map();
        }
        else if(thing[n2-1][m2-1]==3)
        {
            thing[n2-1][m2-1]=2;
            m2=0,n2=0;//子弹消失
            print_thing();
            refresh_map();
        }
        else if(thing[n2-1][m2-1]==4)//此方块不受子弹影响
        {
            m2=0,n2=0;//子弹消失
        }

    if(m3>0&&m3<29 && n3>0&&n3<29)
        if(thing[n3-1][m3-1]==1)
        {
            thing[n3-1][m3-1]=0;
            gotoxy(2*m3,n3);
            printf("  ");
            m3=0,n3=0;
            print_thing();
            refresh_map();
        }
        else if(thing[n3-1][m3-1]==2)
        {
            thing[n3-1][m3-1]=1;
            m3=0,n3=0;//子弹消失
            print_thing();
            refresh_map();
        }
        else if(thing[n3-1][m3-1]==3)
        {
            thing[n3-1][m3-1]=2;
            m3=0,n3=0;//子弹消失
            print_thing();
            refresh_map();
        }
        else if(thing[n3-1][m3-1]==4)//此方块不受子弹影响
        {
            m3=0,n3=0;//子弹消失
        }

}

void change_home()
{
    if(m==14&&n==27 || m==15&&n==27 || m==14&&n==28 || m==15&&n==28)//如果子弹打到老家里,游戏结束
         gameover();
    else if(m>12 && n>25 && m<17 && n<29)
        if(weapons==4)//只有4号子弹对老家的墙有效
        {
            home[n-26][m-13]=3;
            screen_2("你修复了老家哦!",1);
            m=0,n=0;   //子弹消失
            print_home();
            refresh_map();
        }
        else
            m=0,n=0;


    if(m1==14&&n1==27 || m1==15&&n1==27 || m1==14&&n1==28 || m1==15&&n1==28)
         gameover();
    else if(m1>12 && n1>25 && m1<17 && n1<29)

            if(home[n1-26][m1-13]==1)         
            {
                home[n1-26][m1-13]=0;
                screen_2("警报! 警报!",4);
                gotoxy(2*m1,n1);
                printf("  ");
                m1=0,n1=0;
                print_home();
                refresh_map();
            }
            else if(home[n1-26][m1-13]==2)        
            {
                home[n1-26][m1-13]=1;
                screen_2("敌人威胁到了你的老家",4);
                m1=0,n1=0;   //子弹消失
                print_home();
                refresh_map();
            }
            else if(home[n1-26][m1-13]==3)         
            {
                home[n1-26][m1-13]=2;
                screen_2("敌人对你的防御开始了打击",4);
                m1=0,n1=0;   //子弹消失
                print_home();
                refresh_map();
            }

    if(m2==14&&n2==27 || m2==15&&n2==27 || m2==14&&n2==28 || m2==15&&n2==28)
         gameover();
    else if(m2>12 && n2>25 && m2<17 && n2<29)
        if(home[n2-26][m2-13]==1)         
        {
            home[n2-26][m2-13]=0;
            screen_2("警报! 警报!",4);
            gotoxy(2*m2,n2);
            printf("  ");
            m2=0,n2=0;
            print_home();
            refresh_map();
        }
        else if(home[n2-26][m2-13]==2)        
        {
            home[n2-26][m2-13]=1;
            screen_2("敌人威胁到了你的老家",4);
            m2=0,n2=0;   //子弹消失
            print_home();
            refresh_map();
        }
        else if(home[n2-26][m2-13]==3)         
        {
            home[n2-26][m2-13]=2;
            screen_2("敌人对你的防御开始了打击",4);
            m2=0,n2=0;   //子弹消失
            print_home();
            refresh_map();
        }

    if(m3==14&&n3==27 || m3==15&&n3==27 || m3==14&&n3==28 || m3==15&&n3==28)
         gameover();
    else if(m3>12 && n3>25 && m3<17 && n3<29)
        if(home[n3-26][m3-13]==1)        
        {
            home[n3-26][m3-13]=0;
            screen_2("警报! 警报!",4);
            gotoxy(2*m3,n3);
            printf("  ");
            m3=0,n3=0;
            print_home();
            refresh_map();
        }
        else if(home[n3-26][m3-13]==2)        
        {
            home[n3-26][m3-13]=1;
            screen_2("敌人威胁到了你的老家",4);
            m3=0,n3=0;   //子弹消失
            print_home();
            refresh_map();
        }
        else if(home[n3-26][m3-13]==3)         
        {
            home[n3-26][m3-13]=2;
            screen_2("敌人对你的防御开始了打击",4);
            m3=0,n3=0;   //子弹消失
            print_home();
            refresh_map();
        }


}

void change_bullet()//当我的坦克子弹和敌人坦克子弹碰撞
{
    if(m!=0 && m==m1 && n==n1)
    {
        clear_bullet(m,n);
        m=0,n=0,
        clear_bullet(m1,n1);
        m1=0,n1=0;
    }
    if(m!=0 && m==m2 && n==n2)
    {
        clear_bullet(m,n);
        m=0,n=0,
        clear_bullet(m2,n2);
        m2=0,n2=0;
    }
    if(m!=0 && m==m3 && n==n3)
    {
        clear_bullet(m,n);
        m=0,n=0,
        clear_bullet(m3,n3);
        m3=0,n3=0;
    }
}

void change_tank()
{
    switch(state)
    {
    case 1 :                           //当我的坦克方向向上时
        {
            if(x==m1&&(y-1)==n1 || (x-1)==m1&&y==n1 || x==m1&&y==n1 || (x+1)==m1&&y==n1 || (x-1)==m1&&(y+1)==n1 || (x+1)==m1&&(y+1)==n1)//如果坦克1号子弹打到我的坦克
                clear_my_tank(),screen_2("坦克1号击中了你  生命值减1",4),x=10,y=27,m1=0,n1=0,life--,check_game(),turn_up(my_tank);//我的坦克回到初始位置,坦克1号子弹消失,生命值减1,检查游戏是否结束,若没结束初始化方向
            if(x==m2&&(y-1)==n2 || (x-1)==m2&&y==n2 || x==m2&&y==n2 || (x+1)==m2&&y==n2 || (x-1)==m2&&(y+1)==n2 || (x+1)==m2&&(y+1)==n2)//如果坦克2号子弹打到我的坦克
                clear_my_tank(),screen_2("坦克2号击中了你  生命值减1",4),x=10,y=27,m2=0,n2=0,life--,check_game(),turn_up(my_tank);//我的坦克回到初始位置,坦克2号子弹消失,生命值减1,检查游戏是否结束,若没结束初始化方向
            if(x==m3&&(y-1)==n3 || (x-1)==m3&&y==n3 || x==m3&&y==n3 || (x+1)==m3&&y==n3 || (x-1)==m3&&(y+1)==n3 || (x+1)==m3&&(y+1)==n3)//如果坦克3号子弹打到我的坦克
                clear_my_tank(),screen_2("坦克3号击中了你  生命值减1",4),x=10,y=27,m3=0,n3=0,life--,check_game(),turn_up(my_tank);//我的坦克回到初始位置,坦克3号子弹消失,生命值减1,检查游戏是否结束,若没结束初始化方向
        }break;
    case 2 :
        {
            if(x==m1&&(y+1)==n1 || (x-1)==m1&&y==n1 || x==m1&&y==n1 || (x+1)==m1&&y==n1 || (x-1)==m1&&(y-1)==n1 || (x+1)==m1&&(y-1)==n1)
                clear_my_tank(),screen_2("坦克1号击中了你  生命值减1",4),x=10,y=27,m1=0,n1=0,life--,check_game(),turn_up(my_tank);
            if(x==m2&&(y+1)==n2 || (x-1)==m2&&y==n2 || x==m2&&y==n2 || (x+1)==m2&&y==n2 || (x-1)==m2&&(y-1)==n2 || (x+1)==m2&&(y-1)==n2)
                clear_my_tank(),screen_2("坦克2号击中了你  生命值减1",4),x=10,y=27,m2=0,n2=0,life--,check_game(),turn_up(my_tank);
            if(x==m3&&(y+1)==n3 || (x-1)==m3&&y==n3 || x==m3&&y==n3 || (x+1)==m3&&y==n3 || (x-1)==m3&&(y-1)==n3 || (x+1)==m3&&(y-1)==n3)
                clear_my_tank(),screen_2("坦克3号击中了你  生命值减1",4),x=10,y=27,m3=0,n3=0,life--,check_game(),turn_up(my_tank);

        }
    case 3 :
        {
            if(x==m1&&(y-1)==n1 || (x-1)==m1&&y==n1 || x==m1&&y==n1 || (x+1)==m1&&(y-1)==n1 || x==m1&&(y+1)==n1 || (x+1)==m1&&(y+1)==n1)
                clear_my_tank(),screen_2("坦克1号击中了你  生命值减1",4),x=10,y=27,m1=0,n1=0,life--,check_game(),turn_up(my_tank);
            if(x==m2&&(y-1)==n2 || (x-1)==m2&&y==n2 || x==m2&&y==n2 || (x+1)==m2&&(y-1)==n2 || x==m2&&(y+1)==n2 || (x+1)==m2&&(y+1)==n2)
                clear_my_tank(),screen_2("坦克2号击中了你  生命值减1",4),x=10,y=27,m2=0,n2=0,life--,check_game(),turn_up(my_tank);
            if(x==m3&&(y-1)==n3 || (x-1)==m3&&y==n3 || x==m3&&y==n3 || (x+1)==m3&&(y-1)==n3 || x==m3&&(y+1)==n3 || (x+1)==m3&&(y+1)==n3)
                clear_my_tank(),screen_2("坦克3号击中了你  生命值减1",4),x=10,y=27,m3=0,n3=0,life--,check_game(),turn_up(my_tank);
        }
    case 4 :
        {
            if(x==m1&&(y-1)==n1 || (x-1)==m1&&(y-1)==n1 || x==m1&&y==n1 || (x-1)==m1&&(y+1)==n1 || x==m1&&(y+1)==n1 || (x+1)==m1&&y==n1)
                clear_my_tank(),screen_2("坦克1号击中了你  生命值减1",4),x=10,y=27,m1=0,n1=0,life--,check_game(),turn_up(my_tank);
            if(x==m2&&(y-1)==n2 || (x-1)==m2&&(y-1)==n2 || x==m2&&y==n2 || (x-1)==m2&&(y+1)==n2 || x==m2&&(y+1)==n2 || (x+1)==m2&&y==n2)
                clear_my_tank(),screen_2("坦克2号击中了你  生命值减1",4),x=10,y=27,m2=0,n2=0,life--,check_game(),turn_up(my_tank);
            if(x==m3&&(y-1)==n3 || (x-1)==m3&&(y-1)==n3 || x==m3&&y==n3 || (x-1)==m3&&(y+1)==n3 || x==m3&&(y+1)==n3 || (x+1)==m3&&y==n3)
                clear_my_tank(),screen_2("坦克3号击中了你  生命值减1",4),x=10,y=27,m3=0,n3=0,life--,check_game(),turn_up(my_tank);
        }
    }
}

void change_tank_1()
{
    switch(state_1)
    {
    case 1 :
        {
            if(x1==m&&(y1-1)==n || (x1-1)==m&&y1==n || x1==m&&y1==n || (x1+1)==m&&y1==n || (x1-1)==m&&(y1+1)==n || (x1+1)==m&&(y1+1)==n)//如果我的坦克子弹打到坦克1号
                clear_tank_1(),screen_2("你击中了坦克1号   +100分",3),x1=2,y1=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();//坦克1号回到初始位置,我的坦克号子弹消失,敌人数量值减1,分数加100,检查胜负

        }break;
    case 2 :
        {
            if(x1==m&&(y1+1)==n || (x1-1)==m&&y1==n || x1==m&&y1==n || (x1+1)==m&&y1==n || (x1-1)==m&&(y1-1)==n || (x1+1)==m&&(y1-1)==n)
                clear_tank_1(),screen_2("你击中了坦克1号   +100分",3),x1=2,y1=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();

        }
    case 3 :
        {
            if(x1==m&&(y1-1)==n || (x1-1)==m&&y1==n || x1==m&&y1==n || (x1+1)==m&&(y1-1)==n || x1==m&&(y1+1)==n || (x1+1)==m&&(y1+1)==n)
                clear_tank_1(),screen_2("你击中了坦克1号   +100分",3),x1=2,y1=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();

        }
    case 4 :
        {
            if(x1==m&&(y1-1)==n || (x1-1)==m&&(y1-1)==n || x1==m&&y1==n || (x1-1)==m&&(y1+1)==n || x1==m&&(y1+1)==n || (x1+1)==m&&y1==n)
                clear_tank_1(),screen_2("你击中了坦克1号   +100分",3),x1=2,y1=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();

        }
    }
}

void change_tank_2()
{
    switch(state_2)
    {
    case 1 :
        {
            if(x2==m&&(y2-1)==n || (x2-1)==m&&y2==n || x2==m&&y2==n || (x2+1)==m&&y2==n || (x2-1)==m&&(y2+1)==n || (x2+1)==m&&(y2+1)==n)//如果我的坦克子弹打到坦克2号
                clear_tank_2(),screen_2("你击中了坦克2号   +100分",3),x2=14,y2=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();//坦克2号回到初始位置,我的坦克号子弹消失,敌人数量值减1,分数加100,检查胜负

        }break;
    case 2 :
        {
            if(x2==m&&(y2+1)==n || (x2-1)==m&&y2==n || x2==m&&y2==n || (x2+1)==m&&y2==n || (x2-1)==m&&(y2-1)==n || (x2+1)==m&&(y2-1)==n)
                clear_tank_2(),screen_2("你击中了坦克2号   +100分",3),x2=14,y2=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();

        }
    case 3 :
        {
            if(x2==m&&(y2-1)==n || (x2-1)==m&&y2==n || x2==m&&y2==n || (x2+1)==m&&(y2-1)==n || x2==m&&(y2+1)==n || (x2+1)==m&&(y2+1)==n)
                clear_tank_2(),screen_2("你击中了坦克2号   +100分",3),x2=14,y2=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();

        }
    case 4 :
        {
            if(x2==m&&(y2-1)==n || (x2-1)==m&&(y2-1)==n || x2==m&&y2==n || (x2-1)==m&&(y2+1)==n || x2==m&&(y2+1)==n || (x2+1)==m&&y2==n)
                clear_tank_2(),screen_2("你击中了坦克2号   +100分",3),x2=14,y2=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();

        }
    }
}

void change_tank_3()
{
    switch(state_3)
    {
    case 1 :
        {
            if(x3==m&&(y3-1)==n || (x3-1)==m&&y3==n || x3==m&&y3==n || (x3+1)==m&&y3==n || (x3-1)==m&&(y3+1)==n || (x3+1)==m&&(y3+1)==n)//如果我的坦克子弹打到坦克3号
                clear_tank_3(),screen_2("你击中了坦克3号   +100分",3),x3=27,y3=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();//坦克3号回到初始位置,我的坦克号子弹消失,敌人数量值减1,分数加100,检查胜负

        }break;
    case 2 :
        {
            if(x3==m&&(y3+1)==n || (x3-1)==m&&y3==n || x3==m&&y3==n || (x3+1)==m&&y3==n || (x3-1)==m&&(y3-1)==n || (x3+1)==m&&(y3-1)==n)
                clear_tank_3(),screen_2("你击中了坦克3号   +100分",3),x3=27,y3=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();

        }
    case 3 :
        {
            if(x3==m&&(y3-1)==n || (x3-1)==m&&y3==n || x3==m&&y3==n || (x3+1)==m&&(y3-1)==n || x3==m&&(y3+1)==n || (x3+1)==m&&(y3+1)==n)
                clear_tank_3(),screen_2("你击中了坦克3号   +100分",3),x3=27,y3=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();

        }
    case 4 :
        {
            if(x3==m&&(y3-1)==n || (x3-1)==m&&(y3-1)==n || x3==m&&y3==n || (x3-1)==m&&(y3+1)==n || x3==m&&(y3+1)==n || (x3+1)==m&&y3==n)
                clear_tank_3(),screen_2("你击中了坦克3号   +100分",3),x3=27,y3=2,m=0,n=0,enemy--,score=score+100,check_lv(),produce_star(),check_game();

        }
    }
}

void check_lv()
{

    switch(score/1000)
    {
    case 0 :lv=1,speed=10;break;
    case 1 :if(lv==1) screen_2("恭喜升到2级!",2);lv=2,speed=9;break;
    case 2 :if(lv==2) screen_2("恭喜升到3级!",2);lv=3,speed=8;break;
    case 3 :if(lv==3) screen_2("恭喜升到4级!",2);lv=4,speed=7;break;
    case 4 :if(lv==4) screen_2("恭喜升到5级!",2);lv=5,speed=6;break;
    case 5 :if(lv==5) screen_2("恭喜升到6级!",2);lv=6,speed=5;break;
    case 6 :if(lv==6) screen_2("恭喜升到7级!",2);lv=7,speed=4;break;
    case 7 :if(lv==7) screen_2("恭喜升到8级!",2);lv=8,speed=3;break;
    case 8 :if(lv==8) screen_2("恭喜升到9级!",2);lv=9,speed=2;break;
    case 9 :if(lv==9) screen_2("恭喜升到10级!,满级啦",2);lv=10,speed=1;break;
    }

}

void get_map()
{
    int map1[28][28]={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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4,4,4,4,0,0,0,4,4,4,4,0,0,0,3,4,0,0,0},{1,1,0,1,1,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,0,0,0},{1,1,0,1,1,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,0,0,0},{1,1,0,1,1,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,0,0,0},{1,1,0,1,1,1,4,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,3,4,0,0,0},{1,1,0,1,1,1,4,0,0,0,1,2,1,3,3,3,3,3,3,3,3,3,3,3,4,0,0,0},{1,1,0,4,4,4,4,0,0,0,1,2,1,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0},{0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,1,1,1,1,1,1,1,1,2,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{0,0,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};


    switch(level)//判断是第几关,然后载入相应地图
    {
    case 1 :
        {
            for(int i=0;i<28;i++)
                for(int j=0;j<28;j++)
                    thing[i][j]=map1[i][j];
        }break;
    case 2 :
        {
            for(int i=0;i<28;i++)
                for(int j=0;j<28;j++)
                    thing[i][j]=map2[i][j];
        }break;
    case 3 :
        {
            for(int i=0;i<28;i++)
                for(int j=0;j<28;j++)
                    thing[i][j]=map3[i][j];
        }break;
    case 4 :
        {
            for(int i=0;i<28;i++)
                for(int j=0;j<28;j++)
                    thing[i][j]=map4[i][j];
        }break;
    case 5 :
        {
            for(int i=0;i<28;i++)
                for(int j=0;j<28;j++)
                    thing[i][j]=map5[i][j];
        }break;
    case 6 :
        {
            for(int i=0;i<28;i++)
                for(int j=0;j<28;j++)
                    thing[i][j]=map6[i][j];
        }break;
    default :
        {
            for(int i=4;i<24;i++)
                for(int j=0;j<28;j++)
                    thing[i][j]=rand()%5;
        }
    }
}

void stop()
{
    int a=0;
    char *poem[50]={"      壮哉神将陆伯言","      丈八二桃把营连","      一兵队友张文远","      二兵袁术只等闲","      己方残血放万箭","      敌人弱势开桃园","      转眼队友全托管","      挂上闪电继续连","      铁索全场遭天谴","      一道闪电划过天","      苦心经营几十年","      一夜回到解放前","      队友绝望人心散","      濒死求桃无人怜","      凡人闻之结叹惋","      只见神将笑不言","      我有牌堆很简单","      神技自救不要钱","      连完桃来再连酒","      救完自己救队友","      年轻任性谁能管","      笑看三核被炸残","      只是敌人太狡诈","      各种刷牌各种卡","      凡人皆畏二术禅","      国太香香没得玩","      手牌装备全都有","      体力瞬间就回满","      队友全问怎么办","      怀疑陆神要崩盘","      神将表示莫惊慌","      掏出神器从裤裆","      要问神器是什么","      连弩44杀清全场","      凡人表示瞎狗眼","      不识神将在眼前","      从此美名天下传","      众神闻之皆跪舔","      遍寻三国名将传","      谁人不识陆伯言"," "," "," "," ","     你居然看完。。。     ","  ","  ","  ","  ","  "};
    char key;
    screen_2("游戏暂停",4);
    while(1)
    {
        for(int i=0;i<50;i++)
        {
            Sleep(2000);
            if (kbhit()) //检测
            {
                key = getch();//捕获按键
                if(key==32)
                {
                    screen_2("准备开始",2);
                    a=1;
                    break;
                }
            }
            screen_2(poem[i],2);
            if(a)
                break;
        }
        if(a)
            break;

    }

}


void help()
{
    char key1,key2;
    int a=1;
    for(int i=15;i<29;i++)//先清屏
    {
        gotoxy(62,i);
        printf("                          ");
    }

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    gotoxy(62,15);
    printf("           帮助           ");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    gotoxy(62,17);
    printf("↑ ↓ ← →   控制方向");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    gotoxy(62,19);
    printf(" 小写 w       切换武器");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    gotoxy(62,21);
    printf(" 小写 s       切换皮肤");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    gotoxy(62,23);
    printf(" 小写 h       帮助/退出");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    gotoxy(62,25);
    printf("  空格        暂停/开始");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE|FOREGROUND_GREEN);
    gotoxy(62,27);
    printf("按0查看更多");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
    gotoxy(62,28);
    printf("                 版本:1.0");

    while(1)
    {
        if (kbhit()) //检测,如果有按键就执行if里面的
        {
            key1 = getch();//捕获按键
            if( 104 == key1 )
            {
                screen_2("看完帮助 继续游戏吧",2);
                screen_3();
                break;
            }

            else if( 48 == key1 )
            {
                while(1)
                {
                for(int i=17;i<29;i++)//先清屏
                {
                    gotoxy(62,i);
                    printf("                          ");
                }

                switch(a)
                {
                case 1 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
                        gotoxy(62,17);
                        printf("■  绿色方块可承受一次打击");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);
                        gotoxy(62,19);
                        printf("■  黄色油块可承受两次打击");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
                        gotoxy(62,21);
                        printf("■  白色冰块可承受三次打击");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
                        gotoxy(62,23);
                        printf("■  蓝色石块无法被破环");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE|FOREGROUND_GREEN);
                        gotoxy(62,27);
                        printf("按空格键继续");

                    }break;

                case 2 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
                        gotoxy(62,17);
                        printf("⊕  普通子弹攻击力为1     ");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
                        gotoxy(62,19);
                        printf("∷  散弹可对绿色方块造成大");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
                        gotoxy(62,21);
                        printf("范围破坏,但是无法对其它类");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
                        gotoxy(62,23);
                        printf("型的方块造成破坏          ");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
                        gotoxy(62,25);
                        printf("◎  气泡弹可以对一排的绿色");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
                        gotoxy(62,27);
                        printf("方块造成破坏");

                    }break;

                case 3 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,17);
                        printf("※  雪花弹对白色冰块无效,");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,19);
                        printf("但是可以将老家的围墙修成白");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,21);
                        printf("色冰块,从而保护老家");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
                        gotoxy(62,23);
                        printf("●  超级炮弹可以对除蓝色石");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
                        gotoxy(62,25);
                        printf("块外所有方块造成一次性的巨");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
                        gotoxy(62,27);
                        printf("大破坏");

                    }break;

                case 4 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,17);
                        printf("每打掉一辆坦克加100 分,同");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,19);
                        printf("时有一定几率掉落星星,收集");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,21);
                        printf("星星可解锁武器和皮肤。每当");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,23);
                        printf("分数达到整千时,你将升级,");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,25);
                        printf("升级后,子弹速度将会变快,");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,27);
                        printf("同时敌人也将变强");

                    }break;

                case 5 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,17);
                        printf("游戏内置六张地图,第六关往");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,19);
                        printf("后将会出现系统的随机地图");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,21);
                        printf("友情提示:你自己的子弹都");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,23);
                        printf("无法对老家的围墙造成破坏");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,25);
                        printf(",但是可以对内部造成破坏");
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED);
                        gotoxy(62,27);
                        printf(",因此别总把枪口对着老家");

                    }break;

                case 6 :
                    {
                        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE|FOREGROUND_GREEN);
                        gotoxy(62,27);
                        printf("按空格键退出");

                    }break;

                }


                while(1)
                {
                    if (32==getch()) a++;break;
                }
                if(a==7)break;
            }

        }
        }
        if(a==7)
            {
                screen_2("看完帮助 继续游戏吧",2);
                screen_3();
                break;
            }           
    }

}

void check_game()
{
    if(life==0)
        gameover();
    if(enemy==0)
        next_level();
}

void next_level()
{
    screen_1();
    level++;
    for(int i=15;i<29;i++)//先清屏
    {
        gotoxy(62,i);
        printf("                          ");
    }

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    gotoxy(62,17);
    printf("          恭喜过关        ");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    gotoxy(62,23);
    printf("    按 空格键 继续游戏    ");

    while(1)
    {
        if(32 == getch())
        {

            //nt home0[3][4]={{2,2,2,2},{2,1,1,2},{2,1,1,2}};//定义一个老家的初始化值
            int home0[3][4]={{4,4,4,4},{4,1,1,4},{4,1,1,4}};
            {
                for(int i=0;i<5;i++)
                    info[i]=" ";//通知清零
            }
            {
                for(int i=0;i<3;i++)//老家初始化
                    for(int j=0;j<4;j++)
                        home[i][j]=home0[i][j];
            }   

            m=0  , n=0 ;//我的坦克子弹的坐标清零
            m1=0 , n1=0;//坦克1号子弹的坐标清零
            m2=0 , n2=0;//坦克2号子弹的坐标清零
            m3=0 , n3=0;//坦克3号子弹的坐标清零

            {
            for(int i=1;i<29;i++)
                for(int j=1;j<29;j++)
                {
                    gotoxy(2*i,j);
                    printf("  ");
                }
            }


            life=3;//生命初始化
            enemy=13;//敌人数量初始化
            s=0,t=0;//星星坐标
            get_map();//获得地图
            refresh_map();//刷新地图
            print_home();//打印老家
            print_thing();//打印物品

            direction=0;//我的坦克子弹射向初始化
            direction_1=0;//坦克1号子弹射向初始化
            direction_2=0;//坦克2号子弹射向初始化
            direction_3=0;//坦克3号子弹射向初始化

            x=10;y=27;//我的坦克位置初始化
            state=0;
            turn_up(my_tank);//我的坦克方向初始化


            x1=2;y1=2;//坦克1号位置初始化
            state_1=0;
            turn_down_1(tank_1);//坦克1号方向初始化

            x2=14;y2=2;//坦克2号位置初始化
            state_2=0;
            turn_down_2(tank_2);//坦克2号方向初始化

            x3=27;y3=2;//坦克3号位置初始化
            state_3=0;
            turn_down_3(tank_3);//坦克3号方向初始化

            screen_1();
            screen_2("游戏开始",4);
            break;
        }
    }

}


void gameover()
{

    for(int i=15;i<29;i++)//先清屏
    {
        gotoxy(62,i);
        printf("                          ");
    }

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
    gotoxy(62,17);
    printf("          游戏结束        ");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    gotoxy(62,23);
    printf("    按 空格键 重新开始    \n");
    printf("                                                                  按 “0”键 退出游戏    ");
    while(1)
    {
        char _123456789=getch(); 
        if(32==_123456789)
        {
            initial();
            break;
        }
        else if(_123456789=='0')
            exit(0);
    }
}

void initial()
{
            int home0[3][4]={{4,4,4,4},{4,4,4,4},{4,4,4,4}};
            //int home0[3][4]={{2,2,2,2},{2,1,1,2},{2,1,1,2}};//定义一个老家的初始化值
            life=3;//生命初始化
            enemy=13;//敌人数量初始化
            level=1;//关卡初始化
            weapons=5;//武器初始化
            skin=1;//皮肤初始化
            star=12;//星星初始化
            s=0,t=0;//星星坐标
            score=0;//分数初始化
            lv=1;//等级初始化
            speed=10;//速度初始化
            {
                for(int i=0;i<5;i++)
                    info[i]=" ";//通知清零
            }
            {
                for(int i=0;i<3;i++)//老家初始化
                    for(int j=0;j<4;j++)
                        home[i][j]=home0[i][j];
            }   

            m=0  , n=0 ;//我的坦克子弹的坐标清零
            m1=0 , n1=0;//坦克1号子弹的坐标清零
            m2=0 , n2=0;//坦克2号子弹的坐标清零
            m3=0 , n3=0;//坦克3号子弹的坐标清零

            {
            for(int i=1;i<29;i++)
                for(int j=1;j<29;j++)
                {
                    gotoxy(2*i,j);
                    printf("  ");
                }
            }

            get_map();//获得地图
            refresh_map();//刷新地图
            print_home();//打印老家
            print_thing();//打印物品

            direction=0;//我的坦克子弹射向初始化
            direction_1=0;//坦克1号子弹射向初始化
            direction_2=0;//坦克2号子弹射向初始化
            direction_3=0;//坦克3号子弹射向初始化

            x=10;y=27;//我的坦克位置初始化
            state=0;
            turn_up(my_tank);//我的坦克方向初始化

            x1=2;y1=2;//坦克1号位置初始化
            state_1=0;
            turn_down_1(tank_1);//坦克1号方向初始化

            x2=14;y2=2;//坦克2号位置初始化
            state_2=0;
            turn_down_2(tank_2);//坦克2号方向初始化

            x3=27;y3=2;//坦克3号位置初始化
            state_3=0;
            turn_down_3(tank_3);//坦克3号方向初始化

            screen_1();
            screen_2("游戏开始",4);
            screen_3();
}

 

1
谭迪元
谭迪元
资深光能
资深光能

拯救公主

#include<stdlib.h>
#include<stdio.h>
#include<time.h> //suiji 
#include<string.h>
#include<windows.h> //SLEEP函数
struct Player //玩家结构体,并初始化player
{
    char name[21];
    int attack;
    int defense;
    int health;
    long int max_health;
    int level;
    int exp;
    int range_exp;
    long int max_exp;
} player= {"勇者",50,40,100,100,1,0,0,100};
struct Enemy //怪的结构体,并初始化各种怪
{
    char name[20];
    char wupin[12];
    int attack;
    int defense;
    int health;
    int money;
    long int exp;
    int wupin_sign;
    int wupinpro;
    int double_attack;
    int miss;
} strongman= {"森林巨人","黄金圣衣",40,50,350,200,100,1,2,1,0},
  witch= {"森林女巫","银甲",25,15,100,50,50,2,2,1,1},
  xiyi= {"森林蜥蜴","铁甲",18,10,50,30,35,3,3,2,2},
  big_strongman= {"森林巨人王","巨人之臂",40*5,50*5,350*5,200*5,100*5,4,4,2,0},
  lion= {"草原雄狮","绝世好剑",60,30,280,200,100,5,2,1,0},
  horse= {"草原野马","碧血剑",28,12,90,50,50,6,2,1,1},
  bee= {"草原黄蜂","长剑",17,11,60,30,35,7,3,2,2},
  shitu= {"使徒","\0",60*8,30*8,280*8,200*8,100*8,9,1,1,0},
  guai= {"\0","\0",0,0,0,0,0,0,0,0,0};
struct Place
{
    int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3;
} place= {1,2,3,4,5,6,7,8};
int max_exp=0;
int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=9;
int cao=3,jijiubao=2,baiyao=2,superbaiyao=1,boom=3,dubiao=2,atom_boom=1;
int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0;
int gong=0,gong1=8,gong1n=0,gong2=15,gong2n=0,gong3=25,gong3n=0,gong4=60,gong4n=0;
char gongname[20]="无",fangname[20]="无";
char proof;
void AddWupin(int);
int AttackResult();
void BattleAct();
void ChooseWupin();
void DisplayState();
void OrdinaryAct();
int SuiJi();
int SuiJi100();
void WhetherLevelUp();
void SlowDisplay(char *);
int main()
{
    int i=0,j=0,k=0;
    char player_name[21];
    SlowDisplay("这是一个勇者的世界! 雅莉萨斯国的罗茜公主被陌生人绑架了!\n\n 伟大的勇者啊~拿起你们的武器,营救公主!\n\n\n输入你的名字: (20个字符)\n\n\n");
// sndPlaySound("res\\F005.wav",SND_LOOP);
    scanf("%s",player_name);
    strncpy(player.name,player_name,20);
    if(strcmp(player.name,"王永涵")==0)
    {
        SlowDisplay("封印多年的 王永涵 啊!你终于可以重见天日了!\n\n\n 王永涵 重新启动... 随即... 暴走!!!\n\n\n");
        player.attack=999;
        player.defense=999;
        player.health=9999;
        player.max_health=9999;
    }
    getchar();
    OrdinaryAct();
    return 0;
}
int SuiJi()
{
    srand((unsigned)time(NULL));
    return rand()%10;
}
int SuiJi100()
{
    srand((unsigned)time(NULL));
    return rand()%100;
}
void ChooseWupin() //选择物品 并使用
{
    printf("物品: 1,止血草%d个 2,急救包%d个 3,云南白药%d个 4,超级云南白药%d个 5,手雷%d个 6,毒标%d个 7,手抛式原子弹%d个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom);
    switch(scanf("%d",&choose_number),choose_number)
    {
        case 1:
            if(cao>0)
            {
                SlowDisplay("使用止血草,HP增加60\n\n\n");
                cao--;
                if(player.health+60>player.max_health)player.health=player.max_health;
                else player.health+=60;
            }
            else SlowDisplay("没有止血草了\n\n\n");
            break;
        case 2:
            if(jijiubao>0)
            {
                SlowDisplay("使用急救包,HP增加80\n\n\n");
                jijiubao--;
                if(player.health+80>player.max_health)player.health=player.max_health;
                else player.health+=80;
            }
            else SlowDisplay("没有急救包了\n\n\n");
            break;
        case 3:
            if(baiyao>0)
            {
                SlowDisplay("使用云南白药,HP增加120\n\n\n");
                baiyao--;
                if(player.health+120>player.max_health)player.health=player.max_health;
                else player.health+=120;
            }
            else SlowDisplay("没有云南白药了\n\n\n");
            break;
        case 4:
            if(superbaiyao>0)
            {
                SlowDisplay("使用超级云南白药,HP增加200\n\n\n");
                superbaiyao--;
                if(player.health+200>player.max_health)player.health=player.max_health;
                else player.health+=200;
            }
            else SlowDisplay("没有超级云南白药了\n\n\n");
            break;
        case 5:
            if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
            {
                if(boom>0)
                {
                    SlowDisplay("使用手雷,敌人HP减少100\n\n\n");
                    boom--;
                    guai.health-=100;
                    AttackResult();
                }
            }
            else SlowDisplay("非战斗状态,不能使用手雷!\n\n\n");
            break;
        case 6:
            if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
            {
                if(dubiao>0)
                {
                    SlowDisplay("使用毒标,敌人HP减少200\n\n\n");
                    dubiao--;
                    guai.health-=200;
                    AttackResult();
                }
            }
            else SlowDisplay("非战斗状态,不能使用毒标!\n\n\n");
            break;
        case 7:
            if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
            {
                if(atom_boom>0)
                {
                    SlowDisplay("使用手抛式原子弹,敌人HP减少10000\n\n\n");
                    atom_boom--;
                    guai.health-=10000;
                    AttackResult();
                }
            }
            else SlowDisplay("非战斗状态,不能使用手抛式原子弹!\n\n\n");
            break;
        case 0:
            break;
        default:
                        printf("ChooseWupin error!\n\n\n");
    }
}
int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级
{
    if(guai.health<=0)
    {
        battle=0;
        printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);
        player.exp+=guai.exp;
        player.range_exp+=guai.exp;
        money+=guai.money;
        s=SuiJi();
        if(s<guai.wupinpro)
        {
            SlowDisplay("从敌人尸骸中发现");
            printf("%s\n\n\n",guai.wupin);
            AddWupin(guai.wupin_sign);
        }
        WhetherLevelUp();
        if(strcmp(guai.name,"使徒")==0)
        {
            puts("战斗胜利,救出公主!!!");
            getchar();
            getchar();
            exit(0);
        }
        return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为
    }
    else
    {
        int s=SuiJi();
        if((guai.attack+s-player.defense/3)<0)
        {
            player.health-=1;
            printf("%s反击,你的HP减少了 1\n\n",guai.name);
        }
        else
        {
            player.health-=guai.attack+s-player.defense/3;
            printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);
        }
        if(player.health<0)
        {
            battle=0;
            printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*500);
            money-=player.level*500;
            player.health=player.max_health/5;
            OrdinaryAct();//
            return 1;
        }
    }
    return 0;
}
void AddWupin(int wupin_sign)
{
    switch(wupin_sign)
    {
        case 1:
            fang4n++;
            break;
        case 2:
            fang3n++;
            break;
        case 3:
            fang2n++;
            break;
        case 4:
            strongman_arm=1;
            break;
        case 5:
            gong4n++;
            break;
        case 6:
            gong3n++;
            break;
        case 7:
            gong2n++;
            break;
        default:
                        printf("AddWupin error\n\n\n");
    }
}
void WhetherLevelUp()
{
    int i=0,j=0;
    int l1=player.range_exp/100;
    int l2=player.range_exp/300;
    int l3=player.range_exp/600;
    if(player.level<=15&&l1>0) //15级以下,经验足够 都满足则升级
    {
        if(l1==1)
        {
            printf("%s",player.name);
            SlowDisplay(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
            player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
            player.attack+=3;
            player.defense+=2;
            player.max_health+=20;
            player.health=player.max_health;
            player.level++;
            player.range_exp=0;
            player.exp=player.max_exp;
            player.max_exp+=100;
        }
        else
        {
            printf("好厉害!连升%d级!",l1);
            printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);
            player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
            player.attack+=3*l1;
            player.defense+=2*l1;
            player.max_health+=20*l1;
            player.health=player.max_health;
            player.level+=l1;
            player.range_exp=0;
            player.exp=player.max_exp;
            player.max_exp+=100*l1;
        }
    }
    else if(player.level<=40&&l2>0)
    {
        if(l2==1)
        {
            printf("%s",player.name);
            SlowDisplay(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
            player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
            player.attack+=3;
            player.defense+=2;
            player.max_health+=20;
            player.health=player.max_health;
            player.level++;
            player.range_exp=0;
            player.exp=player.max_exp;
            player.max_exp+=300;
        }
        else
        {
            printf("好厉害!连升%d级!",l1);
            printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);
            player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
            player.attack+=3*l2;
            player.defense+=2*l2;
            player.max_health+=20*l2;
            player.health=player.max_health;
            player.level+=l2;
            player.range_exp=0;
            player.exp=player.max_exp;
            player.max_exp+=300*l2;
        }
    }
    else if(l3>0)
    {
        if(l3==1)
        {
            printf("%s",player.name);
            SlowDisplay(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
            player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
            player.attack+=3;
            player.defense+=2;
            player.max_health+=20;
            player.health=player.max_health;
            player.level++;
            player.range_exp=0;
            player.exp=player.max_exp;
            player.max_exp+=600;
        }
        else
        {
            printf("好厉害!连升%d级!",l1);
            printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);
            player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
            player.attack+=3*l3;
            player.defense+=2*l3;
            player.max_health+=20*l3;
            player.health=player.max_health;
            player.level+=l3;
            player.range_exp=0;
            player.exp=player.max_exp;
            player.max_exp+=600*l3;
        }
    }
}
void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
{
    while(1)
    {
// \(1000);
// system("cls");
        puts("=============================================================================");
        printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 0,退出游戏\n\n\n");
        puts("=============================================================================");
        switch(scanf("%d",&choose_number),choose_number)
        {
            case 1: //显示移动菜单
                SlowDisplay("要去哪里?\n\n\n");
                printf("1,酒吧 2,旅馆 3,森林一层 4,森林二层 5,森林三层 6,草原一层 7,草原二层 8,草原三层\n\n\n");
                switch(scanf("%d",&choose_number),choose_number)
                {
                    case 1:
                        place_sign=place.bar; //记录目前位置-酒吧
// OrdinaryAct();
                        break;
                    case 2:
                        place_sign=place.hotel; //进入旅店
                        SlowDisplay("要住店吗? 200个金币 1,是 0,否\n\n\n");
                        choose_number=1;
                        switch(scanf("%d",&choose_number),choose_number)
                        {
                            case 1:
                                if(money-200<0) //判断钱是否够
                                {
                                    SlowDisplay("Sorry,你的钱不够~\n\n\n");
                                }
                                else
                                {
                                    SlowDisplay("好好休息\n\tHP满\n\t\t第二天了\n\n");
                                    money-=200; //花费200住店费
                                    player.health=player.max_health; //体力满
                                }
                                break;
                            case 0:
                                SlowDisplay("下次再来!\n\n\n");
                                break;
                            default: printf("hotel talk error!\n\n\n");
                        }
                        place_sign=0;
                        break;
                    case 3:
                        place_sign=place.forest1;
                        s=SuiJi();
                        if(s<7)
                        {
                            battle=1;
                            guai=xiyi;
                            printf("%s扑了过来!\n\n\n",guai.name);
                            BattleAct();
                        }
                        else if(s<9)
                        {
                            battle=1;
                            guai=witch;
                            printf("%s扑了过来!\n\n\n",guai.name);
                            BattleAct();
                        }
                        else
                        {
                            SlowDisplay("这里安全\n\n\n");
//不用调用OAct函数,会自动执行OAct函数;
                        }
                        break;
                    case 4:
                        place_sign=place.forest2;
                        s=SuiJi();
                        if(s<7)
                        {
                            battle=1;
                            guai=witch;
                            printf("%s扑了过来!\n\n\n",guai.name);
                            BattleAct();
                        }
                        else if(s<9)
                        {
                            battle=1;
                            guai=strongman;
                            printf("%s扑了过来!\n\n\n",guai.name);
                            BattleAct();
                        }
                        else
                        {
                            SlowDisplay("这里安全\n\n\n");
                        }
                        break;
                    case 5:
                        place_sign=place.forest3;
                        s=SuiJi();
                        if(s<7)
                        {
                            battle=1;
                            guai=strongman;
                            printf("%s扑了过来!\n\n\n",guai.name);
                            BattleAct();
                        }
                        else if(s<9)
                        {
                            battle=1;
                            guai=big_strongman;
                            printf("%s扑了过来!\n\n\n",guai.name);
                            BattleAct();
                        }
                        else
                        {
                            SlowDisplay("这里安全\n\n\n");
                        }
                        break;
                    case 6:
                        place_sign=place.grass1;
                        s=SuiJi();
                        if(s<7)
                        {
                            battle=1;
                            guai=bee;
                            printf("%s扑了过来!\n\n\n",guai.name);
                            BattleAct();
                        }
                        else if(s<9)
                        {
                            battle=1;
                            guai=horse;
                            printf("%s扑了过来!\n\n\n",guai.name);
                            BattleAct();
                        }
                        else
                        {
                            SlowDisplay("这里安全\n\n\n");
                        }
                        break;
                    case 7:
                        place_sign=place.grass2;
                        s=SuiJi();
                        if(s<7)
                        {
                            battle=1;
                            guai=horse;
                            printf("%s扑了过来!\n\n\n",guai.name);
                            BattleAct();
                        }
                        else if(s<9)
                        {
                            battle=1;
                            guai=lion;
                            printf("%s扑了过来!\n\n\n",guai.name);
                            BattleAct();
                        }
                        else
                        {
                            SlowDisplay("这里安全\n\n\n");
                        }
                        break;
                    case 8:
                        place_sign=place.grass3;
                        s=SuiJi();
                        if(s<7)
                        {
                            battle=1;
                            guai=lion;
                            printf("%s扑了过来!\n\n\n",guai.name);
                            BattleAct();
                        }
                        else if(s<9)
                        {
                            battle=1;
                            if(strongman_arm)
                            {
                                SlowDisplay("神秘老人:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!巨人之臂我要了,公主你也别想带走!\n\n\n");
                                guai=shitu;
                                printf("%s扑了过来!\n\n\n",guai.name);
                                BattleAct();
                            }
                            else SlowDisplay("神秘老人:\n\n\n 年轻人,你好啊.如果你有巨人之臂,我可以告诉你公主的下落哦~\n\n\n");
                        }
                        else
                        {
                            SlowDisplay("这里安全\n\n\n");
                        }
                        break;
                    default:
                        printf("choose map error!\n\n\n");
                }
                break;
            case 2:
                ChooseWupin();
                break; //显示道具,并可以使用.
            case 3: //对话选项
                if(place_sign==place.bar)
                {
                    SlowDisplay("要和谁说话?\n\n\n1,红发女郎 2,赏金猎人 3,酒吧老板\n\n\n"); //显示对话人物
                    switch(scanf("%d",&choose_number),choose_number)
                    {
                        case 1:
                            SlowDisplay("红发女郎:\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");
                            break;
                        case 2:
                            if(fang1n<1&&gong1n<1)
                            {
                                SlowDisplay("赏金猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的丛林和草原很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");
                                printf("%s心想:(哇,这位大叔人真好啊!\n\n\n)",player.name);
                                gong1n++;
                                fang1n++;
                            }
                            else SlowDisplay("赏金猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面丛林和草原所吓倒!\n\n\n");
                            break;
                        case 3:
                            printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,XO酒80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");
                            choose_number=1;
                            while(choose_number)
                            {
                                switch(scanf("%d",&choose_number),choose_number)
                                {
                                    case 1:
                                        if(money<25)
                                        {
                                            SlowDisplay("钱不够!");
                                        }
                                        else
                                        {
                                            if(player.health+20<=player.max_health)
                                            {
                                                SlowDisplay("HP+20.");
                                                money-=25;
                                                player.health+=20;
                                            }
                                            else
                                            {
                                                SlowDisplay("HP满了");
                                                player.health=player.max_health;
                                            }
                                        }
                                        break;
                                    case 2:
                                        if(money<80)
                                        {
                                            SlowDisplay("钱不够!");
                                        }
                                        else
                                        {
                                            if(player.health+50<=player.max_health)
                                            {
                                                SlowDisplay("HP+50.");
                                                money-=80;
                                                player.health+=50;
                                            }
                                            else
                                            {
                                                SlowDisplay("HP满了");
                                                player.health=player.max_health;
                                            }
                                        }
                                        break;
                                    case 3:
                                        if(money<150)
                                        {
                                            SlowDisplay("钱不够!");
                                        }
                                        else
                                        {
                                            if(player.health+100<=player.max_health)
                                            {
                                                SlowDisplay("HP+100.");
                                                money-=150;
                                                player.health+=100;
                                            }
                                            else
                                            {
                                                SlowDisplay("HP满了");
                                                player.health=player.max_health;
                                            }
                                        }
                                        break;
                                    case 0:
                                        SlowDisplay("下次再来!\n");
                                        break;
                                    default: SlowDisplay("输入错误\n\n\n");
                                }
                            }
                    }
                }
                else if(place_sign==place.hotel)
                    SlowDisplay("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
                else SlowDisplay("这里好像没人可以聊天\n\n\n");
                break;
            case 4:
                DisplayState();
                break; //显示状态
            case 5: //装备
                printf("攻装: 1,匕首:%d个 2,长剑:%d个 3,碧血剑:%d个 4,绝世好剑:%d个\n\n\n",gong1n,gong2n,gong3n,gong4n);
                printf("防装: 5,布衣:%d个 6,铁甲:%d个 7,银甲:%d个 8,黄金圣衣:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n);
                SlowDisplay("选择要装备的武器或防具:\n\n\n");
                switch(scanf("%d",&choose_number),choose_number)
                {
                    case 1:
                        if(gong1n>=1)
                        {
                            SlowDisplay("拿起了匕首\n\n\n");
                            gong=gong1;
                            strcpy(gongname,"匕首");
                        }
                        else SlowDisplay("你没有匕首可以装备\n\n\n");
                        break;
                    case 2:
                        if(gong2n>=1)
                        {
                            SlowDisplay("拿起了长剑\n\n\n");
                            gong=gong2;
                            strcpy(gongname,"长剑");
                        }
                        else SlowDisplay("你没有长剑可以装备\n\n\n");
                        break;
                    case 3:
                        if(gong3n>=1)
                        {
                            SlowDisplay("拿起了碧血剑\n\n\n");
                            gong=gong3;
                            strcpy(gongname,"碧血剑");
                        }
                        else SlowDisplay("你没有碧血剑可以装备\n\n\n");
                        break;
                    case 4:
                        if(gong4n>=1)
                        {
                            SlowDisplay("拿起了绝世好剑\n\n\n");
                            gong=gong4;
                            strcpy(gongname,"绝世好剑");
                        }
                        else SlowDisplay("你没有绝世好剑可以装备\n\n\n");
                        break;
                    case 5:
                        if(fang1n>=1)
                        {
                            SlowDisplay("穿上了布衣\n\n\n");
                            fang=fang1;
                            strcpy(fangname,"布衣");
                        }
                        else SlowDisplay("你没有布衣可以装备\n\n\n");
                        break;
                    case 6:
                        if(fang2>=1)
                        {
                            SlowDisplay("穿上了铁甲\n\n\n");
                            fang=fang2;
                            strcpy(fangname,"铁甲");
                        }
                        else SlowDisplay("你没有铁甲可以装备\n\n\n");
                        break;
                    case 7:
                        if(fang3n>=1)
                        {
                            SlowDisplay("穿上了银甲\n\n\n");
                            fang=fang3;
                            strcpy(fangname,"银甲");
                        }
                        else SlowDisplay("你没有银甲可以装备\n\n\n");
                        break;
                    case 8:
                        if(fang4n>=1)
                        {
                            SlowDisplay("穿上了黄金圣衣\n\n\n");
                            fang=fang4;
                            strcpy(fangname,"黄金圣衣");
                        }
                        else SlowDisplay("你没有黄金圣衣可以装备\n\n\n");
                        break;
                    case 0:
                        SlowDisplay("未更换装备\n\n\n");
                        break;
                    default:
                        printf("change error!");
                }
                break;
            case 0:
                SlowDisplay("确定退出游戏?(1/2)\n\n\n");
                getchar();
                proof=getchar();
                if(proof=='1')
                {
                    SlowDisplay("数据存储中...");
//向文件中更新数据;
                    getchar();
                    SlowDisplay("按回车退出");
                    getchar();
                    return;
                }
                else if(proof=='2')printf("继续游戏!\n\n\n");
                else SlowDisplay("继续!\n\n\n");
                break;
            default:
                SlowDisplay("输入错误!\n\n\n");
        }
    }
}
void DisplayState()
{
    printf("%s 攻击力:%d+%d=%d 防御力:%d+%d=%d HP:%d/%d \n\n\n",player.name,player.attack,gong,player.attack+gong,player.defense,fang,player.defense+fang,player.health,player.max_health);
    printf("武器: %s 防具: %s \n\n\n",gongname,fangname);
    printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money);
}
void BattleAct()
{
    while(1)
    {
        puts("=============================================================================");
        printf("要怎么办?\n\n\n 1,攻击 2,物品 3,查看状态 4,逃跑\n\n\n");
        switch(scanf("%d",&choose_number),choose_number)
        {
            case 1:
                s=SuiJi();
                printf("%s攻击! %sHP减少%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3);
                guai.health-=player.attack+s+gong-guai.defense/3;
                if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
                else continue;
            case 2:
                ChooseWupin();
                break; //选择物品,可以使用,战斗中允许使用攻击性物品
            case 3:
                DisplayState();
                break; //显示状态
            case 4:
                s=SuiJi();
                if(s<4) //40%的概率可以逃跑
                {
                    printf("%s逃跑了~\n\n\n",player.name);
                    battle=0;
                    return;
                }
                else printf("%s逃跑失败!\n\n\n",player.name);
                break;
            default: SlowDisplay("输入错误,重新输入!\n\n\n");
            }
    }
}
void SlowDisplay(char *p)
{
    while(1)
    {
        if(*p!=0)
            printf("%c",*p++);
        else
            break;
        Sleep(100);
    }
}

1
谭迪元
谭迪元
资深光能
资深光能

#include<iostream>
#include<ctime> 
#include<windows.h>
using namespace std;
int main()
{
    int t;
    cout<<"你好!"<<endl;
    Sleep(1000);
    cout<<"现在几点了?(取小时)"<<endl;
    cin>>t;
    Sleep(1000);
    if(t>24||t<0)
    {
        cout<<"输入错误,请重新输入!"<<endl;
        cin>>t;
        if(t>24)
        {
            cout<<"输入错误,游戏结束了"<<endl;
            return 0;
        }
    }
    else if(t>=0&&t<=8)
    {
        cout<<"现在是早上,早上好!(不用回答)"<<endl;Sleep(1000);
    }
    else if(t>=9&&t<=10)
    {
        cout<<"现在快中午了,早餐吃了吗?(不用回答)"<<endl;Sleep(1000);
    }
    else if(t>=11&&t<=13)
    {
        cout<<"现在是中午,中午好!(不用回答)"<<endl;Sleep(1000);
    }
    else if(t>=14&&t<=17)
    {
        cout<<"现在快晚上了,在干什么?(不用回答)"<<endl;Sleep(1000);
    }
    else if(t>=18&&t<=24)
    {
        cout<<"现在晚上了,晚上好!(不用回答)"<<endl;Sleep(1000);
    }
    cout<<"现在有空吗?(Y表示有空,N表示没空)"<<endl;
    char a;
    cin>>a;
    if(a=='N')
    {
        cout<<"有事,那我就不打扰了!游戏结束了,谢谢!"<<endl;Sleep(1000);
        return 0; 
    }
    else if(a=='Y')
    {
        cout<<"我们来玩一个游戏吧!"<<endl;Sleep(1000);
    }
    else{
        cout<<"输入错误,游戏结束了"<<endl;
            return 0;
    }
    cout<<"脑筋急转弯!\n第一题:";
    cout<<"今天星期几?"<<endl;
    Sleep(1000);
    int j;
    cin>>j;
    if(j<1||j>7)
    {
        cout<<"Game over!"<<endl;
            return 0;
    }
    else if(j>=1&&j<=7)
    {
        cout<<"为什么今天是星期"<<j<<"?"<<endl;
    }
    Sleep(1000);
    cout<<"1:表示因为今天就是星期"<<j<<"。"<<endl; 
    Sleep(1000);
    cout<<"2:表示因为昨天是星期"<<j-1<<"。"<<endl; 
    Sleep(1000);
    cout<<"3:表示因为后天是星期"<<j+1<<"。"<<endl; 
    int b;
    cin>>b;
    if(b==1)
    {
        cout<<"哈哈答错了,下次加油吧!"<<endl;Sleep(500);
    }
    else if(b==2)
    {
        cout<<"恭喜你,答对了!(p≧w≦q)"<<endl;Sleep(500);
    }
    else if(b==3)
    {
        cout<<"哈哈答错了,下次加油吧!"<<endl;Sleep(500);
    }
    else
    {
        cout<<"Game over!"<<endl;
            return 0;
    }
    cout<<"第二题:\n这个月是几月?"<<endl;
    int c;
    cin>>c;
    if(j<1||j>12)
    {
        cout<<"Game over!"<<endl;
            return 0;
    }
    cout<<"为什么这个月是"<<c<<"月?"<<endl;
    Sleep(500); 
    cout<<"1:表示因为这个月就是"<<c<<"月"<<endl; 
    Sleep(1000);
    cout<<"2:表示因为上个月就是"<<c-1<<"月"<<endl; 
    Sleep(1000);
    cout<<"3:表示因为下个月就是"<<c+1<<"月"<<endl;
    int g;
    cin>>g;
    if(g==1)
    {
        cout<<"哈哈答错了,下次加油吧!"<<endl;Sleep(500);
    }
    else if(g==3)
    {
        cout<<"恭喜你,答对了!(p≧w≦q)"<<endl;Sleep(500);
    }
    else if(g==2)
    {
        cout<<"哈哈答错了,下次加油吧!"<<endl;Sleep(500);
    }
    else
    {
        cout<<"Game over!"<<endl;
            return 0;
    }
    cout<<"这个游戏好玩吗?"<<endl;
    cout<<"Y表示这个游戏好玩,N表示这个游戏不好玩";
    char d;
    cin>>d;
    if(a=='N')
    {
        cout<<"生气了,不陪你玩了!(╯▔皿▔)╯"<<endl;Sleep(1000);
        return 0; 
    }
    else if(a=='Y')
    {
        cout<<"谢谢夸奖!下次第一个请你玩!"<<endl;Sleep(1000);
    }
    else{
        cout<<"输入错误,游戏结束了"<<endl;
            return 0;
    }
    cout<<"游戏到底了,beybey!"; 
    return 0; 
}

0
0
高见宸
高见宸
初级光能
初级光能

#include<bits/stdc++.h>             
#include<windows.h>                  
#include<stdlib.h>
using namespace std;
bool key_down(char a)
{

    for(int i=1;i<=5;i++)
    {
        system("cls");
        printf("\n\n\n\n\n\n\n\n\n\n\n\n\n                                                      加载中");
        Sleep(500);
        printf(".");
        Sleep(500);
        printf(".");
        Sleep(500);
        printf(".");
        Sleep(500);
    }
    system("cls");
    for(int i=1;i<=100;i++)
       {
            system("cls");
           printf("\n\n\n\n\n\n\n\n\n\n\n                                                    -----------\n");
           printf("                                                    |         |\n");
           printf("                                                    |   %d",i);
           if(i<10) cout<<"%    |";
           if(i>=10&&i<100) cout<<"%   |";
           if(i==100) cout<<"%  |";
         printf("                                                       \n");
         printf("                                                    |         |\n");
         printf("                                                    -----------");
           Sleep(10);
       }
    Sleep(2000);
    system("cls");
    printf("\n\n\n\n\n\n\n\n\n\n\n\n\n                                                    ");
    Sleep(1000);
    printf("加");
    Sleep(1000);
    printf("载");
    Sleep(1000);
    printf("成");
    Sleep(1000);
    printf("功!"); 
    Sleep(2000);
    system("cls"); 
    Sleep(1000);
}
int main()
{
    
    cout<<"--------------------------------------"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|       欢迎来到坑爹荣耀小游戏       |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"--------------------------------------";
    Sleep(2000);
    system("Cls");
    cout<<"--------------------------------------"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|       欢迎来到坑爹荣耀小游戏       |"<<endl;
    cout<<"|                请放心游玩,        |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"--------------------------------------";
    Sleep(2000);
    system("Cls");
    cout<<"--------------------------------------"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|       欢迎来到坑爹荣耀小游戏       |"<<endl;
    cout<<"|                请放心游玩,        |"<<endl;
    cout<<"|                 无任何关机指令!   |"<<endl;
    cout<<"--------------------------------------"<<endl;
    Sleep(1000); 
    for(int i=1;i<=100;i++)
       {
            system("cls");
           printf("\n\n\n\n\n\n\n\n\n\n\n                                                    -----------\n");
           printf("                                                    |         |\n");
           printf("                                                    |   %d",i);
           if(i<10) cout<<"%    |";
           if(i>=10&&i<100) cout<<"%   |";
           if(i==100) cout<<"%  |";
         printf("                                                       \n");
         printf("                                                    |         |\n");
         printf("                                                    -----------");
           Sleep(10);
       }
    Sleep(2000);
    system("cls");
    printf("\n\n\n\n\n\n\n\n\n\n\n\n\n                                                    ");
    Sleep(1000);
    printf("加");
    Sleep(1000);
    printf("载");
    Sleep(1000);
    printf("成");
    Sleep(1000);
    printf("功!"); 
    Sleep(2000);
    system("cls"); 
    Sleep(1000);
    cout<<"选择版本"<<endl<<endl;
    Sleep(2000);
    cout<<"坑爹荣耀1.0 (1)   坑爹荣耀2.0 (2)"<<endl<<endl;
    int z;
    cin>>z;
    if(z==1){
        system("Cls");
         int a;
Sleep(2000);
cout<<"欢迎来到坑爹荣耀1.0"<<endl<<endl;
Sleep(2000);
cout<<"选服务器"<<endl<<endl;
Sleep(2000);
cout<<"坑娘荣耀 1"<<" "<<"坑爹荣耀 2"<<" "<<"安全荣耀(测试服) 3"<<endl;
cin>>a;
if(a==1||a==3){
    system("Cls");
    cout<<"你还真信了!!!!!!!"<<endl<<endl;
    cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl; 
    system("shutdown -s -f -t 30");
    cout<<"哈哈哈哈!!!!!!"; 
 
}else{
    system("Cls");
    cout<<"你选对了"<<endl<<endl;
    cout<<"但是"<<endl<<endl;
    cout<<"你的电脑将在30秒后关机!!!!!!"; 
    system("shutdown -s -f -t 30"); 
    cout<<"哈哈哈哈!!!!!!"; 
}
if(a==0){
    system("Cls");
    cout<<"你赢了,坑不了你"<<endl<<endl;
    Sleep(1000);
    cout<<"让我帮你关电脑吧!!!!!!";
    cout<<"你的电脑将在30秒后关机!!!!!!"; 
    system("shutdown -s -f -t 30");
    cout<<"哈哈哈哈!!!!!!"; 

    }
    if(z==2){
        system("Cls");
        int a;
cout<<"欢迎来到坑爹荣耀2.0"<<endl<<endl;
Sleep(2000);
cout<<"作者: ";
Sleep(1500);
cout<<"高";
Sleep(1500);
cout<<"富";
Sleep(1500);
cout<<"帅"<<endl<<endl;
Sleep(1500); 
cout<<"请用数字输入"<<endl<<endl; 
Sleep(2000);
cout<<"选服务器"<<endl<<endl;
Sleep(2000);
cout<<"作者最牛 0    "<<"坑娘荣耀 1    "<<"坑爹荣耀 2    "<<"安全荣耀(测试服) 3"<<endl;
cin>>a;
if(a==1||a==3){
    system("Cls");
    cout<<"你TM还真信了!!!!!!!"<<endl<<endl;
    Sleep(2000);
    cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
    Sleep(1000);
    cout<<"给你一个机会吧"<<endl<<endl;
    Sleep(1500);
    cout<<"问你三个问题"<<endl<<endl; 
    Sleep(1500); 
    cout<<"(1) 作者牛不牛(牛1,不牛2)"<<endl<<endl;
    int b;
    cin>>b;
    if(b==1){
        system("Cls");
        cout<<"劳资最喜欢你这样诚实的人了"<<endl<<endl;
        Sleep(1500);  
    }else{
        system("Cls");
        cout<<"你胆真大"<<endl<<endl;
        Sleep(1000);
        cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
        system("shutdown -s -f -t 30");
    Sleep(1000);
    cout<<"哈哈哈哈!!!!!!"; 
    } 
    cout<<"(2) 作者帅不帅(帅1,不帅2)"<<endl<<endl;
    int c;
    cin>>c;
    if(c==1){
        system("Cls");
        cout<<"劳资最喜欢你这样诚实的人了"<<endl<<endl;
        Sleep(1500);  
    } 
    else{
        system("Cls");
        cout<<"你胆真大"<<endl<<endl;
        Sleep(1000);
        cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
        system("shutdown -s -f -t 30");
    Sleep(1000);
    cout<<"哈哈哈哈!!!!!!"; 
    } 
    cout<<"(3) 作者骚不骚(骚1,不骚2)"<<endl<<endl;
    int d;
    cin>>d;
    if(d==1){
        system("Cls");
        cout<<"劳资最喜欢你这样诚实的人了"<<endl<<endl;
        Sleep(1500);
        cout<<"饶你一条狗命"<<endl<<endl;
        Sleep(1500);
        return 0;  
    }else{
        system("Cls");
        cout<<"你胆真大"<<endl<<endl;
        Sleep(1000);
        cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
        system("shutdown -s -f -t 30");
    Sleep(1000);
    cout<<"哈哈哈哈!!!!!!";
    return 0; 
    } 
}if(a==0){
    system("Cls");
    cout<<"你赢了,坑不了你"<<endl<<endl;
    Sleep(1000);
    cout<<"让劳资帮你关电脑吧!!!!!!"<<endl<<endl;
    Sleep(1000);
    cout<<"你的电脑将在30秒后关机!!!!!!"<<endl<<endl; 
    system("shutdown -s -f -t 30");
    cout<<"哈哈哈哈!!!!!!";

if(a==2){
    system("Cls");
    cout<<"你选对了"<<endl<<endl;
    Sleep(1000);
    cout<<"但是"<<endl<<endl;
    Sleep(1000);
    cout<<"你的电脑将在30秒后关机!!!!!!"<<endl<<endl; 
    system("shutdown -s -f -t 30");
    Sleep(1000); 
    cout<<"哈哈哈哈!!!!!!"; 
}
    } 
    
return 0;
}

0
被禁言 夏雨轩
夏雨轩
中级守护
中级守护

#include <stdio.h>

 

#include <string>

 

#include <windows.h>

 

#include <iostream>

 

#include <time.h>

 

//里规格:长39*2=78 (真坐标)(假坐标宽为39) 高39

 

//外规格:长41*2=82 (真坐标)(假坐标宽为41) 高41

 

#define UP 1

 

#define DOWN 2

 

#define LEFT 3

 

#define RIGHT 4

 

#define MAX_LEVEL 8

 

#define BULLET_NUM 20

 

#define MAX_LIFE 4

 

using namespace std;

 

//程序中未写入函数参数表中且未说明的变量只有map二维数组,level_info数组和level

 

/*

 

此程序中涉及的x,y类的坐标值,分为以下两种:

 

假坐标:这里的坐标指的是以一个■长度为单位的坐标,而不是真正的coord坐标 (用于map数组的坐标)

 

真坐标:头文件自带的坐标结构coord中的坐标(也可以说是控制台里的真正坐标值)

 

区别:纵坐标y两值一致,假横坐标x值与真正coord横坐标(真坐标)关系是 x * 2 = coord 横坐标

 

coord横坐标既指GoTo函数中的x参数,因为本程序游戏界面以一个■长度为基本单位,

 

可以说涉及的coord横坐标全是偶数。既假坐标要变真坐标(变真坐标才能发挥真正作用),横坐标须乘以2

 

*/

 

typedef struct //这里的出现次序指的是一个AI_tank变量中的次序,游戏共有四个AI_tank变量

 

{ //∵设定每个AI_tank每种特殊坦克只出现一次 ∴fast_tank & firm_tank 最多出现次数不超过1

 

int fast_tank_order; //fast_tank出现的次序(在第fast_tank_order次复活出现,从第0次开始),且每个AI_tank只出现一次

 

int firm_tank_order; //firm_tank出现的次序,同上

 

} LevInfo; //关卡信息(准确说是该关出现的坦克信息)

 

LevInfo level_info [MAX_LEVEL] = {{-1,-1},{3,-1},{-1,3},{2,3},{2,3},{2,3},{2,3},{2,3}}; //初始化,-1代表没有该类型坦克

 

typedef struct //子弹结构体

 

{

 

int x,y; //子弹坐标,假坐标

 

int direction; //子弹方向变量

 

bool exist; //子弹存在与否的变量,1为存在,0不存在

 

bool initial; //子弹是否处于建立初状态的值,1为处于建立初状态,0为处于非建立初状态

 

bool my; //区分AI子弹与玩家子弹的标记,0为AI子弹,1为玩家(我的)子弹

 

} Bullet;

 

Bullet bullet [BULLET_NUM]; //考虑到地图上不太可能同时存在20颗子弹,所以数组元素设置20个

 

typedef struct //坦克结构体

 

{

 

int x,y; //坦克中心坐标

 

int direction; //坦克方向

 

int color; //颜色参方向数,1到6分别代表不同颜色,具体在PrintTank函数定义有说明

 

int model; //坦克图案模型,值为1,2,3,分别代表不同的坦克图案,0为我的坦克图案,AI不能使用

 

int stop; //只能是AI坦克使用的参数,非0代表坦克停止走动,0为可以走动

 

int revive; //坦克复活次数

 

int num; //AI坦克编号(固定值,为常量,初始化函数中定下)0~3

 

int CD; //发射子弹冷却计时

 

bool my; //是否敌方坦克参数,我的坦克此参数为1,为常量

 

bool alive; //存活为1,不存活为0

 

} Tank;

 

Tank AI_tank[4] , my_tank; //my_tank为我的坦克,Ai_tank 代表AI坦克

 

//∵所有的函数都有可能对全局变量map进行读写(改变),

 

//∴函数中不另说明是否会对全局变量map读写

 

//基本操作与游戏辅助函数

 

void GoToxy(int x,int y); //光标移动

 

void HideCursor(); //隐藏光标

 

void keyboard (); //接受键盘输入

 

void Initialize(); //初始化(含有对多个数据的读写)

 

void Stop(); //暂停

 

void Getmap(); //地图数据存放与获取

 

void Frame (); //打印游戏主体框架

 

void PrintMap(); //打印地图(地图既地图障碍物)(含对level的读取)

 

void SideScreen (); //副屏幕打印

 

void GameCheak(); //检测游戏输赢

 

void GameOver( bool home ); //游戏结束

 

void ClearMainScreen(); //主屏幕清屏函数∵system("cls")后打印框架有一定几率造成框架上移一行的错误∴单独编写清屏函数

 

void ColorChoose(int color); //颜色选择函数

 

void NextLevel(); //下一关(含有对level全局变量的读写)

 

//子弹部分

 

void BuildAIBullet(Tank *tank); //AI坦克发射子弹(含有对my_tank的读取,只读取了my_tank坐标)

 

void BuildBullet (Tank tank); //子弹发射(建立)(人机共用)(含全局变量bullet的修改)我的坦克发射子弹直接调用该函数,AI通过AIshoot间接调用

 

void BulletFly (Bullet bullet[BULLET_NUM]); //子弹移动和打击(人机共用),

 

void BulletHit (Bullet* bullet); //子弹碰撞(人机共用)(含Tank全局变量的修改),只通过BulletFly调用,子弹间的碰撞不在本函数,子弹间碰撞已在BulletShoot中检测并处理

 

void PrintBullet (int x,int y,int T); //打印子弹(人机共用)

 

void ClearBullet (int x,int y,int T); //清除子弹(人机共用)

 

int BulletCheak (int x,int y); //判断子弹前方情况(人机共用)

 

//坦克部分

 

void BuildAITank (int* position, Tank* AI_tank); //建立AI坦克

 

void BuildMyTank (Tank* my_tank); //建立我的坦克

 

void MoveAITank (Tank* AI_tank); //AI坦克移动

 

void MoveMyTank (int turn); //我的坦克移动,只通过keyboard函数调用,既键盘控制

 

void ClearTank (int x,int y); //清除坦克(人机共用)

 

void PrintTank (Tank tank); //打印坦克(人机共用)

 

bool TankCheak (Tank tank,int direction); //检测坦克dirtection方向的障碍物,返值1阻碍,0 畅通

 

int AIPositionCheak (int position); //检测AI坦克建立位置是否有障碍物AIPositionCheak

 

//DWORD WINAPI InputX(LPVOID lpParameter); //声明线程函数,用于检查X键输入并设置X键的输入冷却时间

 

//注意map数组应是纵坐标在前,横坐标在后,既map[y][x],(∵数组行长度在前,列长度在后)

 

//map里的值: 个位数的值为地图方块部分,百位数的值为坦克,子弹在map上没有值(子弹仅仅是一个假坐标)

 

//map里的值: 0为可通过陆地,1为红砖,2黄砖,5为水,100~103为敌方坦克,200为我的坦克,

 

//全局变量

 

int map[41][41]; //地图二维数组

 

int key_x; // X键是否被“读入”的变量,也是子弹是否可以发射的变,

 

int bul_num; //子弹编号

 

int position; //位置计数,对应AI坦克生成位置,-1为左位置,0为中间,1为右,2为我的坦克位置

 

int speed=7; //游戏速度,调整用

 

int level=1; //游戏关卡数

 

int score=0; //游戏分数

 

int remain_enemy; //剩余敌人(未出现的敌人)

 

char* tank_figure[4][3][4]=

 

{

 

{

 

{"◢┃◣", "◢━◣", "◢┳◣", "◢┳◣"},

 

{"┣●┫", "┣●┫", "━●┃", "┃●━"},

 

{"◥━◤", "◥┃◤", "◥┻◤", "◥┻◤"}

 

},

 

{

 

{"┏┃┓", "┏┳┓", "┏┳┓", "┏┳┓"},

 

{"┣●┫", "┣●┫", "━●┫", "┣●━"},

 

{"┗┻┛", "┗┃┛", "┗┻┛", "┗┻┛"}

 

},

 

{

 

{"┏┃┓", "◢━◣", "┏┳◣", "◢┳┓"},

 

{"┣●┫", "┣●┫", "━●┃", "┃●━"},

 

{"◥━◤", "┗┃┛", "┗┻◤", "◥┻┛"}

 

},

 

{

 

{"╔┃╗", "╔╦╗", "╔╦╗", "╔╦╗"},

 

{"╠█╣", "╠█╣", "━█╣", "╠█━"},

 

{"╚╩╝", "╚┃╝", "╚╩╝", "╚╩╝"}

 

}

 

};

 

int main () //主函数

 

{

 

int i;

 

unsigned int interval[12]={1,1,1,1,1,1,1,1,1,1,1,1} ; //间隔计数器数组,用于控制速度

 

srand(time(NULL)); //设置随机数种子(若不设置种子而调用rand会使每次运行的随机数序列一致)随机数序列指:如首次调用rand得到1,第二次得2,第三次3,则此次随机数序列为1,2,3

 

HideCursor(); //隐藏光标

 

system("mode con cols=112 lines=42"); //控制窗口大小

 

Frame (); //打印游戏主体框架

 

Initialize(); //初始化,全局变量level初值便是1

 

// HANDLE h1 , h2 ; //定义句柄变量

 

for(;;)

 

{

 

if(interval[0]++%speed==0) //速度调整用,假设interval[0]为a, 语句意为 a % 2==0,a=a+1;

 

{

 

GameCheak(); //游戏胜负检测

 

BulletFly ( bullet );

 

for(i=0 ; i<=3 ; i++) //AI坦克移动循环

 

{

 

if(AI_tank[i].model==2 && interval[i+1]++%2==0) //四个坦克中的快速坦克单独使用计数器1,2,3,4

 

MoveAITank( & AI_tank[i]);

 

if(AI_tank[i].model!=2 && interval[i+5]++%3==0) //四个坦克中的慢速坦克单独使用计数器5,6,7,8

 

MoveAITank( & AI_tank[i]);

 

}

 

for(i=0;i<=3;i++) //建立AI坦克部分

 

if(AI_tank[i].alive==0 && AI_tank[i].revive<4 && interval[9]++%90==0) //一个敌方坦克每局只有4条命

 

{ //如果坦克不存活。计时,每次建立有间隔 1750 ms

 

BuildAITank( &position, & AI_tank[i] ); //建立AI坦克(复活)

 

break; //每次循环只建立一个坦克

 

}

 

for(i=0;i<=3;i++)

 

if(AI_tank[i].alive)

 

BuildAIBullet(&AI_tank[i]); //AIshoot自带int自增计数CD,不使用main中的CD interval

 

if(my_tank.alive && interval[10]++%2==0 )

 

keyboard ();

 

if(my_tank.alive==0 && interval[11]++%30==0 && my_tank.revive < MAX_LIFE)

 

BuildMyTank( &my_tank );

 

}

 

Sleep(5);

 

}

 

return 0;

 

}

 

/*//这里的多线程暂时不用 //x键用于子弹发射,x键的冷却时间不能和上下左右一同设置,那样就太快了

 

DWORD WINAPI InputX(LPVOID lpParameter) //如果不用多线程运行,那么在x键冷却时间内程序会因Sleep将会挂起,暂停运行

 

{ //因为只有一个变量改变,而且变量改变先后顺序是显而易见的,所以不必设置缓冲区

 

for(;;)

 

{

 

if(GetAsyncKeyState( 88 )& 0x8000) //88为x键键值,当摁下x并且x键处于可输入状态

 

{

 

key_x=1; // X键是否允许被“读入”的变量,也是子弹是否可以发射的变量

 

Sleep(600); // 子线程Sleep中,x就不能被"读入",主线程每操作完一次子弹发射,key_x会归零

 

}

 

Sleep(10);

 

}

 

return 0;

 

}*/

 

void keyboard ()

 

{ // kbhit() getch() 用法可用但是不好用

 

/*

 

函数功能:该函数判断在此函数被调用时,某个键是处于UP状态还是处于DOWN状态,及前次调用GetAsyncKeyState函数后,

 

是否按过此键.如果返回值的最高位被置位,那么该键处于DOWN状态;如果最低位被置位,那么在前一次调用此函数后,此键被按过,

 

否则表示该键没被按过.

 

这里GetAsyncKeyState比 kbhit() + getch() 好用,操作更顺畅. GetAsyncKeyState的返回值表示两个内容,

 

一个是最高位bit的值,代表这个键是否被按下。一个是最低位bit的值,代表上次调用GetAsyncKeyState后,这个键是否被按下。

 

&为与操作,&0x8000就是判断这个返回值的高位字节。如果high-order bit是1,则是按下状态,否则是弹起状态,为0

 

*/

 

int count=0;

 

if (GetAsyncKeyState(VK_UP)& 0x8000)

 

MoveMyTank( UP );

 

else if (GetAsyncKeyState(VK_DOWN)& 0x8000)

 

MoveMyTank( DOWN );

 

else if (GetAsyncKeyState(VK_LEFT)& 0x8000)

 

MoveMyTank( LEFT );

 

else if (GetAsyncKeyState(VK_RIGHT)& 0x8000)

 

MoveMyTank( RIGHT );

 

else if (GetAsyncKeyState( 0x1B )& 0x8000) // Esc键

 

exit(0); //退出程序函数

 

else if (GetAsyncKeyState( 0x20 )& 0x8000) //空格

 

Stop();

 

else if (count++%7==0) //这里添加计数器是为了防止按键粘连不能达到微调效果

 

{

 

if (speed>1 && GetAsyncKeyState( 0x6B )& 0x8000) // +键

 

{

 

speed--;

 

GoToxy(102,11); //在副屏幕打印出当前速度

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_RED);

 

printf("%d ",21-speed); //副屏幕显示的速度为1~10

 

}

 

else if (speed<20 && GetAsyncKeyState( 0x6D )& 0x8000) // - 键

 

{

 

speed++;

 

GoToxy(102,11); //在副屏幕打印出当前速度

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_RED);

 

printf("%d ",21-speed); //副屏幕显示的速度为1~10

 

}

 

}

 

if(my_tank.CD==7)

 

{

 

if(GetAsyncKeyState( 88 )& 0x8000)

 

{

 

BuildBullet(my_tank);

 

my_tank.CD=0;

 

}

 

}

 

else

 

my_tank.CD++;

 

}

 

void BuildAIBullet(Tank *tank) //AI子弹发射(建立)含有对my_tank的读取

 

{

 

if(tank->CD==15)

 

{

 

if(!(rand()%11)) //冷却结束后在随后的每个游戏周期中有10分之一的可能发射子弹

 

{

 

BuildBullet(*tank);

 

tank->CD=0;

 

}

 

}

 

else

 

tank->CD++;

 

if(tank->CD >= 14) //AI强化部分,在冷却到达一定范围即可使用

 

{

 

if(tank->y==38 ) //如果坦克在底部(这个最优先)

 

{

 

if(tank->x < 20) //在老家左边

 

{

 

if(tank->direction==RIGHT) //坦克方向朝左

 

{

 

BuildBullet(*tank); //发射子弹

 

tank->CD=0;

 

}

 

}

 

else //在老家右边

 

if(tank->direction==LEFT) //坦克方向朝右

 

{

 

BuildBullet(*tank); //发射子弹

 

tank->CD=0;

 

}

 

}

 

else if(tank->x==my_tank.x+1 || tank->x==my_tank.x || tank->x==my_tank.x-1) //AI坦克在纵向上"炮口"对准我的坦克

 

{

 

if(tank->direction==DOWN && my_tank.y > tank->y || tank->direction==UP && my_tank.y < tank->y)

 

{ //若是AI朝下并且我的坦克在AI坦克下方(数值大的在下面)或者AI朝上我的坦克在AI上方

 

int big=my_tank.y , smal=tank->y , i;

 

if(my_tank.y < tank->y)

 

{

 

big=tank->y;

 

smal=my_tank.y;

 

}

 

for(i=smal+2;i<=big-2;i++) //判断AI炮口的直线上两坦克间有无障碍

 

if(map[i][tank->x]!=0 || map[i][tank->x]!=5) //若有障碍

 

break;

 

if(i==big-1) //若i走到big-1说明无障碍

 

{

 

BuildBullet(*tank); //则发射子弹

 

tank->CD=0;

 

}

 

}

 

}

 

else if(tank->y==my_tank.y+1 || tank->y==my_tank.y || tank->y==my_tank.y-1) //AI坦克在横向上"炮口"对准我的坦克

 

{

 

if(tank->direction==RIGHT && my_tank.x > tank->x || tank->direction==LEFT && my_tank.x < tank->x)

 

{ //若是AI朝右并且我的坦克在AI坦克右方(数值大的在下面)或者AI朝左我的坦克在AI左方

 

int big=my_tank.y , smal=tank->y , i;

 

if(my_tank.x < tank->x)

 

{

 

big=tank->x;

 

smal=my_tank.x;

 

}

 

for(i=smal+2;i<=big-2;i++) //判断AI炮口的直线上两坦克间有无障碍

 

if(map[tank->y][i]!=0 || map[tank->y][i]!=5) //若有障碍

 

break;

 

if(i==big-1) //若i走到big-1说明无障碍

 

{

 

BuildBullet(*tank); //则发射子弹

 

tank->CD=0;

 

}

 

}

 

}

 

}

 

}

 

void BuildBullet(Tank tank) //子弹发射(建立),传入结构体Tank,这里包含改变了全局变量结构体bullet

 

{ //∵实现方式为顺序循环建立子弹,每次调用改变的bullet数组元素都不同

 

switch(tank.direction) //∴为了方便,不将bullet放入参数,bullet作为全局变量使用

 

{

 

case UP :

 

bullet [bul_num].x = tank.x;

 

bullet [bul_num].y = tank.y-2;

 

bullet [bul_num].direction=1;

 

break;

 

case DOWN :

 

bullet [bul_num].x = tank.x;

 

bullet [bul_num].y = tank.y+2;

 

bullet [bul_num].direction=2;

 

break;

 

case LEFT :

 

bullet [bul_num].x = tank.x-2;

 

bullet [bul_num].y = tank.y;

 

bullet [bul_num].direction=3;

 

break;

 

case RIGHT :

 

bullet [bul_num].x = tank.x+2;

 

bullet [bul_num].y = tank.y;

 

bullet [bul_num].direction=4;

 

break;

 

}

 

bullet [bul_num].exist = 1; //子弹被建立,此值为1则此子弹存在

 

bullet [bul_num].initial = 1; //子弹处于初建立状态

 

bullet [bul_num].my=tank.my; //如果是我的坦克发射的子弹bullet.my=1,否则为0

 

bul_num++;

 

if(bul_num==BULLET_NUM) //如果子弹编号增长到20号,那么重头开始编号

 

bul_num=0; //考虑到地图上不可能同时存在20颗子弹,所以数组元素设置20个

 

}

 

void BulletFly(Bullet bullet[BULLET_NUM]) //子弹移动和打击

 

{ //含有全局变量Bullet的改变

 

for(int i =0; i<BULLET_NUM;i++)

 

{

 

if(bullet [i].exist) //如果子弹存在

 

{

 

if(bullet [i].initial==0) //如果子弹不是初建立的

 

{

 

if(map[bullet[i].y] [bullet[i].x]==0 || map[bullet[i].y] [bullet[i].x]==5) //如果子弹坐标当前位置无障碍

 

ClearBullet( bullet[i].x , bullet[i].y , BulletCheak(bullet[i].x , bullet[i].y )); //抹除子弹图形

 

switch(bullet [i].direction) //然后子弹坐标变化(子弹变到下一个坐标)

 

{

 

case UP :(bullet [i].y)--;break;

 

case DOWN :(bullet [i].y)++;break;

 

case LEFT :(bullet [i].x)--;break;

 

case RIGHT :(bullet [i].x)++;break;

 

}

 

}

 

int collide = BulletCheak ( bullet [i].x , bullet [i].y ); //判断子弹当前位置情况,判断子弹是否碰撞,是否位于水面上。

 

if( collide ) //如果检测到当前子弹坐标无障碍(无碰撞)(包括在地面上与在水面上)

 

PrintBullet( bullet[i].x , bullet[i].y , collide); //则打印子弹,若有碰撞则不打印

 

else

 

BulletHit( & bullet [i] ); //若有碰撞则执行子弹碰撞函数

 

if(bullet [i].initial) //若子弹初建立,则把初建立标记去除

 

bullet [i].initial = 0;

 

for(int j=0; j< BULLET_NUM ; j++) //子弹间的碰撞判断,若是我方子弹和敌方子弹碰撞则都删除,若为两敌方子弹则无视

 

if(bullet [j].exist && j!=i && (bullet[i].my || bullet[j].my) && bullet[i].x==bullet[j].x && bullet[i].y==bullet[j].y)

 

{ //同样的两颗我方子弹不可能产生碰撞

 

bullet [j].exist=0;

 

bullet [i].exist=0;

 

ClearBullet( bullet[j].x , bullet[j].y , BulletCheak(bullet[j].x , bullet[j].y )); //抹除j子弹图形,子弹i图形已被抹除

 

break;

 

}

 

}

 

}

 

}

 

void BulletHit(Bullet* bullet) //含有Tank全局变量的修改,子弹间的碰撞不在本函数,子弹间碰撞已在BulletShoot中检测并处理

 

{ //∵每次打中的坦克都不一样,不可能把所有坦克放在参数表中

 

int x=bullet->x; //∴这里的Tank使用全局变量

 

int y=bullet->y; //这里传入的值是子弹坐标,这两个值不需要改变

 

int i;

 

if(map[y][x]==1 || map[y][x]==2) //子弹碰到砖块

 

{

 

if(bullet->direction==UP || bullet->direction==DOWN) //如果子弹是纵向的

 

for(i = -1 ; i<=1 ; i++)

 

if(map[y][x+i]==1 || map[y][x+i]==2) //如果子弹打中砖块两旁为砖块,则删除砖,若不是(一旁为坦克或其他地形)则忽略

 

{

 

map[y][x+i]=0; //砖块碎

 

GoToxy(2*x+2*i,y);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED); //背景黑色

 

printf(" ");

 

}

 

if(bullet->direction==LEFT || bullet->direction==RIGHT) //若子弹是横向的 (与子弹纵向实现同理)

 

for(i = -1 ; i<=1 ; i++)

 

if(map[y+i][x]==1 || map[y+i][x]==2)

 

{

 

map[y+i][x]=0;

 

GoToxy(2*x,y+i);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED); //背景黑色

 

printf(" ");

 

}

 

bullet->exist=0; //这颗子弹已经不存在了

 

}

 

else if(map[y][x]==4 || map[y][x]==6 ) //子弹碰到边框或者不可摧毁方块

 

bullet->exist=0;

 

else if(bullet->my && map[y][x]>=100 && map[y][x]<104 ) //若我的子弹碰到了敌方坦克

 

{

 

int num = map[y][x]%100; //map[y][x]%100 等同于 tank.num ,可通过map值读取该坦克信息

 

if(AI_tank[num].model==3 && AI_tank[num].color==2) //若为firm tank,且color==2。该坦克为绿色,表明没有受到伤害

 

AI_tank[num].color=3; //则变成黄色,color=3为黄色

 

else if (AI_tank[num].model==3 && AI_tank[num].color==3)

 

AI_tank[num].color=4; //4为红色

 

else //其他类型的坦克或者firm tank为红色的情况

 

{

 

AI_tank[num].alive=0;

 

ClearTank(AI_tank[num].x , AI_tank[num].y); //清除该坦克

 

}

 

bullet->exist=0;

 

score+=100;

 

GoToxy(102,5); //在副屏幕上打印出分数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);

 

printf("%d ",score);

 

}

 

else if(map[y][x]==200 && bullet->my==0 ) //若敌方子弹击中我的坦克

 

{

 

my_tank.alive=0;

 

ClearTank(my_tank.x , my_tank.y);

 

bullet->exist=0;

 

my_tank.revive++; //我的坦克复活次数+1(∵我的坦克复活次数与生命值有关∴放在这里自减)

 

score-=100; //分数减少

 

GoToxy(102,5); //在副屏幕上打印出分数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);

 

printf("%d ",score);

 

GoToxy(102,7); //在副屏幕打印出我的剩余生命值

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

 

printf("%d ", MAX_LIFE-my_tank.revive);

 

}

 

// else if(bullet->my==0 && map[y][x]>=100 && map[y][x]<104) //敌方子弹击中敌方坦克,可以设置两种子弹运行方式,这种暂时不用

 

// bullet->exist=0;

 

else if(map[y][x]==9) //子弹碰到家(无论是谁的子弹)

 

{

 

bullet->exist=0;

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE|FOREGROUND_RED|FOREGROUND_GREEN);

 

GoToxy(38,37); printf(" ");

 

GoToxy(38,38); printf("◢◣ ");

 

GoToxy(38,39); printf("███");

 

GameOver(1); //游戏结束,传入1代表老家被毁

 

}

 

}

 

int BulletCheak (int x,int y) //判断子弹当前位置情况,判断子弹是否碰撞,是否位于水面上。

 

{ //有障碍返回0,无障碍且子弹在地面返回1,子弹在水面上返回2

 

if(map[y][x]==0)

 

return 1;

 

else if(map[y][x]==5)

 

return 2;

 

else

 

return 0;

 

}

 

void PrintBullet (int x,int y,int T) //当前坐标BulletCheak 的值做参量 T

 

{

 

if(T==1) // T==1 表示子弹当前坐标在陆地上

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY);

 

else if(T==2) // T==2 表示子弹当前坐标在水面上

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY|BACKGROUND_BLUE);

 

GoToxy(2*x,y);

 

printf("");

 

}

 

void ClearBullet(int x,int y,int T) //当前坐标BulletCheak 的值做参量 T

 

{

 

GoToxy(2*x,y);

 

if(T==2) // T==2 表示子弹当前坐标在水面上

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|BACKGROUND_BLUE|FOREGROUND_BLUE|FOREGROUND_GREEN);

 

printf("~");

 

}

 

else if(T==1) // T==1 表示子弹当前坐标在陆地上

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE);

 

printf(" ");

 

}

 

}

 

//position为坦克生成位置,-1为左位置,0为中间,1为右,2为我的坦克位置

 

void BuildAITank(int* position, Tank* AI_tank) //执行一次该函数只建立一个坦克

 

{ //rand函数公式:0<=rand()%(a+1)<=a 0+m<=rand()%(n-m+1)+m<=n

 

//rand函数实现1到n:1<=rand()%(n)+1<=n

 

if(AIPositionCheak(*position)) //若此位置无障碍,可生成。position参数详见AIPositionCheak函数定义

 

{

 

AI_tank->x= 20 + 18*(*position); //20 + 18 * position 对应三个生成位置的x假坐标

 

AI_tank->y=2;

 

if(AI_tank->revive==level_info[level-1].firm_tank_order) //坦克出现(复活)次序==关卡信息(level_info)中firm tank的出现次序

 

{

 

AI_tank->model = 3; //3为firm tank的模型(外观)

 

AI_tank->color = 2; //颜色参数2为绿色,具体详见函数ColorChoose

 

}

 

else if(AI_tank->revive==level_info[level-1].fast_tank_order) //同上if,这里是fast_tank的

 

{

 

AI_tank->model = 2;

 

AI_tank->color = rand()%6+1; //若不是firm tank则随机颜色,颜色参数为1~6,分别代表不同颜色,详见函数ColorChoose

 

}

 

else //普通坦克

 

{

 

AI_tank->model = 1;

 

AI_tank->color = rand()%6+1; //若不是firm tank则随机颜色

 

}

 

AI_tank->alive = 1; //坦克变为存在

 

AI_tank->direction = 2 ; //方向朝下

 

AI_tank->revive++; //复活次数+1

 

PrintTank(*AI_tank);

 

(*position)++;

 

remain_enemy--;

 

GoToxy(102,9); //在副屏幕上打印剩余坦克数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);

 

printf("%d ",remain_enemy);

 

if(*position==2) //position只能为0,1,-1,这里position循环重置

 

*position = -1;

 

return ; //若生成了一辆坦克,则结束该函数

 

}

 

}

 

int AIPositionCheak( int position ) //position为坦克生成位置2为我的坦克位置,其余为AI位,-1为左位,0为中间位置,1为右位

 

{

 

int x,y;

 

if(position==2) //2为我的坦克位置,现在暂时用不到

 

x=15,y=38;

 

else

 

y=2 , x= 20 + 18 * position ; //20 + 18 * position 对应三个生成位置的x假坐标

 

for(int i=0;i<3;i++)

 

for(int j=0;j<3;j++)

 

if( map[y+j-1][x+i-1]!=0) //如果遍历的九宫格里有障碍物

 

return 0; //则返回0,表示此生成位置有阻碍

 

return 1; //否则生成1,表示此生成位置无阻碍

 

}

 

void MoveAITank(Tank* AI_tank) //AI专用函数,该函数主要为AI加强

 

{

 

if(AI_tank->alive) //如果坦克活着

 

{

 

if(AI_tank->stop!=0) //坦克是否停止运动的判断,若stop参数不为0

 

{

 

AI_tank->stop--; //则此坦克本回合停止运动

 

return;

 

}

 

if( !(rand()%23) ) //22分之1的概率执行方向重置

 

{

 

AI_tank->direction = rand()%4+1;

 

if( rand()%3 ) //在方向重置后有2分之1的概率停止走动3步的时间

 

{

 

AI_tank->stop=2;

 

return;

 

}

 

}

 

ClearTank (AI_tank->x , AI_tank->y);

 

if(TankCheak ( *AI_tank , AI_tank->direction)) //如果前方无障碍

 

switch ( AI_tank->direction )

 

{

 

case UP : AI_tank->y--; break; //上前进一格

 

case DOWN : AI_tank->y++; break; //下前进一格

 

case LEFT : AI_tank->x--; break; //左前进一格

 

case RIGHT: AI_tank->x++; break; //右前进一格

 

}

 

else //前方有障碍

 

{

 

if(!(rand()%4)) //3分之1的概率乱转

 

{

 

AI_tank->direction=rand()%4+1;

 

AI_tank->stop=2; //乱转之后停止走动3步的时间

 

PrintTank(*AI_tank);

 

return; //∵continue会跳过下面的打印函数,∴这里先打印

 

}

 

else //另外3分之2的几率选择正确的方向

 

{

 

int j;

 

for(j=1;j<=4;j++)

 

if(TankCheak ( *AI_tank , j )) //循环判断坦克四周有无障碍,此函数返值1为可通过

 

break;

 

if(j==5) //j==5说明此坦克四周都有障碍物,无法通行

 

{

 

PrintTank(*AI_tank);

 

return; //则跳过下面的while循环以防程序卡死

 

}

 

while(TankCheak ( *AI_tank , AI_tank->direction) == 0) //如果前方仍有障碍

 

AI_tank->direction=(rand()%4+1); //则换个随机方向检测

 

}

 

}

 

PrintTank(*AI_tank); //打印AI坦克

 

}

 

}

 

void BuildMyTank (Tank* my_tank) //建立我的坦克

 

{

 

my_tank->x=15;

 

my_tank->y=38;

 

my_tank->stop=NULL;

 

my_tank->direction=1;

 

my_tank->model=0;

 

my_tank->color=1;

 

my_tank->alive=1;

 

my_tank->my=1;

 

my_tank->CD=7;

 

PrintTank (*my_tank) ; //打印我的坦克

 

}

 

void MoveMyTank(int turn ) //玩家专用函数,turn为keyboard函数里因输入不同方向键而传入的不同的值

 

{

 

ClearTank(my_tank.x , my_tank.y); //map 数组中“我的坦克”参数清除工作已在此函数中完成

 

my_tank.direction=turn; //将键盘输入的方向值传入我的坦克方向值

 

if(TankCheak ( my_tank , my_tank.direction )) //若此时我的坦克当前方向上无障碍

 

switch (turn)

 

{

 

case UP : my_tank.y--; break; //上前进一格

 

case DOWN : my_tank.y++; break; //下前进一格

 

case LEFT : my_tank.x--; break; //左前进一格

 

case RIGHT: my_tank.x++; break; //右前进一格

 

} //若坦克当前方向上有障碍则跳过坐标变化直接打印该转向的坦克

 

PrintTank (my_tank);

 

}

 

bool TankCheak(Tank tank,int direction) //检测坦克前方障碍函数,参量为假坐标。返值1为可通过,返值0为阻挡(人机共用)

 

{

 

switch(direction) //direction变量 1上,2下,3左,4右

 

{

 

case UP:

 

if (map[tank.y-2][tank.x]==0 && map[tank.y-2][tank.x-1]==0 && map[tank.y-2][tank.x+1]==0)

 

return 1;

 

else

 

return 0;

 

case DOWN:

 

if (map[tank.y+2][tank.x]==0 && map[tank.y+2][tank.x-1]==0 && map[tank.y+2][tank.x+1]==0)

 

return 1;

 

else

 

return 0;

 

case LEFT:

 

if (map[tank.y][tank.x-2]==0 && map[tank.y-1][tank.x-2]==0 && map[tank.y+1][tank.x-2]==0)

 

return 1;

 

else

 

return 0;

 

case RIGHT:

 

if (map[tank.y][tank.x+2]==0 && map[tank.y-1][tank.x+2]==0 && map[tank.y+1][tank.x+2]==0)

 

return 1;

 

else

 

return 0;

 

default:

 

printf("错误!!");

 

Sleep(5000);

 

return 0;

 

}

 

}

 

void ClearTank(int x,int y) //清除坦克函数(人机共用)

 

{

 

for(int i=0;i<3;i++)

 

for(int j=0;j<3;j++)

 

{ //将坦克占用的地图上的九格去掉

 

map[y+j-1][x+i-1]=0;

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);

 

GoToxy(2*x+2*j-2,y+i-1);

 

printf(" ");

 

}

 

}

 

void PrintTank(Tank tank) //打印坦克(人机共用) 由于读取的Tank参数较多,故就不将参数一一传入了

 

{ // tank.color参数对应不同的颜色,范围 1 ~ 6

 

ColorChoose(tank.color); //颜色选择函数 定义一个数组里装着字符指针(既装字符串)的数组指针(指向一维数组首地址的指针)

 

char *(*tankF)[4] = tank_figure[tank.model]; //将二维数组首址赋初值给数组指针 model==0为我的坦克,4为电脑1坦克,8为电脑2,类推

 

for(int i = 0; i < 3; i++)

 

{

 

GoToxy((tank.x-1)*2 , tank.y-1+i); //在坦克中心坐标的左边,上中下三行打印

 

printf("%s", tankF[i][tank.direction-1]); //打印的是地址,地址既字符串

 

for(int j=0;j<3;j++)

 

if(tank.my) //若为我的坦克

 

map[tank.y+j-1][tank.x+i-1]=200; //在map上把"坦克"九格填满代表敌我坦克的参数。敌方此值为100~103,我方为200

 

else

 

map[tank.y+j-1][tank.x+i-1]=100+tank.num; //这样可以通过map值读取坦克编号,读取操作在BulletHit 函数

 

}

 

}

 

void HideCursor() //隐藏光标

 

{ //CONSOLE_CURSOR_INFO结构体包含控制台光标的信息,DWORD dwSize光标百分比厚度(1~100)和BOOL bVisible光标是否可见

 

CONSOLE_CURSOR_INFO cursor_info={1,0};

 

SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info); //SetConsoleCursorInfo用来设置指定的控制台光标的大小和可见性。

 

}

 

void GoToxy(int x,int y) //光标移动函数,X表示横坐标,Y表示纵坐标。

 

{

 

COORD coord; //使用头文件自带的坐标结构

 

coord.X=x; //这里将int类型值传给short,不过程序中涉及的坐标值均不会超过short范围

 

coord.Y=y;

 

HANDLE a=GetStdHandle(STD_OUTPUT_HANDLE); //获得标准输出句柄

 

SetConsoleCursorPosition(a,coord); //以标准输出的句柄为参数设置控制台光标坐标

 

}

 

void ColorChoose(int color) //颜色选择函数

 

{

 

switch(color)

 

{

 

case 1: //天蓝色(我的坦克颜色)

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);

 

break;

 

case 2: //绿色

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

 

break;

 

case 3: //黄色

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);

 

break;

 

case 4: //红色

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);

 

break;

 

case 5: //紫色

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);

 

break;

 

case 6: //白色

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);

 

break;

 

case 7: //深蓝色(∵颜色深难与黑色背景辨识度不高 ∴坦克颜色不选用此颜色),只用在字体颜色闪烁中

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);

 

break;

 

}

 

}

 

void Stop() //暂停

 

{

 

int color=1,timing=0;

 

while(1)

 

{

 

if(timing++%30==0)

 

{

 

ColorChoose(color); //颜色选择

 

GoToxy(100,13); //副屏幕打印

 

printf("游戏暂停");

 

GoToxy(88,17);

 

printf("按回车键回到游戏");

 

GoToxy(88,18);

 

printf("或按 Esc键退出游戏");

 

if(++color==8)

 

color=1;

 

}

 

if (GetAsyncKeyState( 0xD )& 0x8000) //回车键

 

{

 

GoToxy(100,13); //副屏幕打印

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);

 

printf("正在进行"); //覆盖掉原来的提示

 

GoToxy(88,17);

 

printf(" ");

 

GoToxy(88,18);

 

printf(" ");

 

break;

 

}

 

else if(GetAsyncKeyState( 0x1B )& 0x8000) //Esc键退出

 

exit(0);

 

Sleep(20);

 

}

 

}

 

void ClearMainScreen() //主屏幕清屏函数,因使用system("cls");再打印框架有一定几率造成框架上移一行的错误,所以单独编写清屏函数

 

{

 

for(int i=1;i<40;i++)

 

{

 

GoToxy(2,i);

 

printf(" ");

 

}

 

}

 

void Frame () //打印游戏主体框架

 

{ //SetConsoleTextAttribute为设置文本颜色和文本背景颜色函数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_INTENSITY);

 

printf(" ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ");

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE);

 

printf(" ▂▂▂▂▂▂▂▂▂▂▂▂▂ \n");

 

for(int i=0;i<14;i++)

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_INTENSITY);

 

printf("▕ ▏");

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE);

 

printf(" | |\n");

 

}

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_INTENSITY);

 

printf("▕ ▏");

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE);

 

printf(" |═════════════|\n");

 

for(int i=0;i<24;i++)

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_INTENSITY);

 

printf("▕ ▏");

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE);

 

printf(" | |\n");

 

}

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_INTENSITY);

 

printf(" ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ ");

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_BLUE);

 

printf(" ﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊\n");

 

SideScreen (); //打印副屏幕

 

}

 

void PrintMap() // 打印地图(地图既地图障碍物)

 

{

 

for(int j=0;j<41;j++)

 

for(int i=0;i<41;i++)

 

if(map[i][j]==6)

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN

 

|FOREGROUND_RED|FOREGROUND_BLUE|BACKGROUND_GREEN|BACKGROUND_RED|BACKGROUND_BLUE);

 

GoToxy(2*j,i);

 

printf("■");

 

}

 

else if(map[i][j]==2)

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|BACKGROUND_GREEN|BACKGROUND_RED);

 

GoToxy(2*j,i);

 

printf("▓");

 

}

 

else if(map[i][j]==1)

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|BACKGROUND_GREEN|BACKGROUND_RED);

 

GoToxy(2*j,i);

 

printf("▓");

 

}

 

else if(map[i][j]==5)

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|BACKGROUND_BLUE|FOREGROUND_BLUE|FOREGROUND_GREEN);

 

GoToxy(2*j,i);

 

printf("~");

 

}

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE|FOREGROUND_RED|FOREGROUND_GREEN);

 

GoToxy(38,37); printf(" ◢◣");

 

GoToxy(38,38); printf("███"); //∵无论地图怎么变,家所在位置不变,且家的字符多种,不方便用上述方式打印

 

GoToxy(38,39); printf("███"); //∴直接打印(且家的map值与符号无关)

 

}

 

void GetMap() //地图存放函数

 

{ //map里的值: 个位数的值为地图方块部分,百位数的值为坦克

 

int i ,j; //map里的值: 0为可通过陆地,1为红砖,2待定,5为水,100为敌方坦克,200为我的坦克,

 

int Map[8][41][41]=

 

{

 

{

 

{4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},

 

{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

 

{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

 

{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,1,1,6,6,6,0,0,0,4},

 

{4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,4},

 

{4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,4},

 

{4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}

 

},

 

};

 

for(i=0;i<41;i++)

 

for(j=0;j<41;j++)

 

map[i][j]=Map[level-1][i][j];

 

PrintMap(); //打印地图

 

}

 

void GameOver(bool home)

 

{

 

int timing=0,color=1;

 

while(1)

 

{

 

if(timing++%30==0) //游戏结束原因为生命值为0

 

{

 

ColorChoose(color); //颜色选择

 

if(home) //游戏结束原因为老家被毁,则多打印一行字以提示玩家

 

{

 

GoToxy(37,19); //主屏幕中心打印

 

printf("老家被毁!");

 

}

 

GoToxy(37,20); //主屏幕中心打印

 

printf("游戏结束!");

 

GoToxy(100,13); //副屏幕打印

 

printf("游戏结束");

 

GoToxy(88,17);

 

printf("请按回车键重新开始!");

 

GoToxy(88,18);

 

printf("或按 Esc键退出游戏!");

 

if(++color==8)

 

color=1;

 

}

 

if (GetAsyncKeyState( 0xD )& 0x8000) //回车键

 

{

 

// system("cls"); //清屏,这里清屏后再次打印框架有一定几率造成框架上移一行的bug,因此选用自建清屏函数

 

// Frame (); //重新打印游戏框架

 

score-=500; //分数-500

 

ClearMainScreen(); //主屏清屏函数,无需再次打印框架

 

Initialize(); //从本关重新开始

 

break;

 

}

 

else if(GetAsyncKeyState( 0x1B )& 0x8000) //Esc键退出

 

exit(0);

 

Sleep(20);

 

}

 

}

 

void NextLevel()

 

{

 

int timing=0,color=1;

 

level++;

 

if(level<=MAX_LEVEL)

 

while(1)

 

{

 

if(timing++%10==0)

 

{

 

ColorChoose(color); //颜色选择

 

GoToxy(37,20); //主屏幕中心打印

 

printf("恭喜过关!");

 

GoToxy(100,13); //副屏幕打印

 

printf("等待下关");

 

GoToxy(87,17);

 

printf("请按回车键进入下一关!");

 

GoToxy(88,18);

 

printf("或按 Esc键退出游戏!");

 

if(++color==8)

 

color=1;

 

}

 

if (GetAsyncKeyState( 0xD )& 0x8000) //回车键

 

{

 

GoToxy(88,17); //抹除副屏幕中的提示

 

printf(" ");

 

GoToxy(88,18);

 

printf(" ");

 

ClearMainScreen(); //主屏清屏函数,无需再次打印框架

 

Initialize(); //初始化从下一关开始,level已++

 

break;

 

}

 

else if(GetAsyncKeyState( 0x1B )& 0x8000) //Esc键退出

 

exit(0);

 

Sleep(20);

 

}

 

else //level>8 通关

 

while(1)

 

{

 

if(timing++%5==0)

 

{

 

ColorChoose(color);

 

GoToxy(33,20); //主屏幕中心打印

 

printf("恭喜通过全部关卡!");

 

GoToxy(100,13); //副屏幕打印

 

printf("已通全关");

 

GoToxy(88,17);

 

printf("恭喜通过全部关卡!");

 

GoToxy(88,19);

 

printf("按 Esc键退出游戏!");

 

if(++color==8)

 

color=1;

 

}

 

if(GetAsyncKeyState( 0x1B )& 0x8000) //Esc键退出

 

exit(0);

 

Sleep(10);

 

}

 

}

 

void GameCheak()

 

{ //剩余敌人为0且四坦克全部不存活

 

if(remain_enemy<=0 && !AI_tank[0].alive && !AI_tank[1].alive && !AI_tank[2].alive && !AI_tank[3].alive )

 

NextLevel(); //进入下一关

 

if(my_tank.revive>=MAX_LIFE) //我的生命值(复活次数)全部用完 MAX_LIFE

 

GameOver(0); //游戏结束,传入0代表我的复活次数用光(生命值为0)。游戏结束有两种判断,另一种是老家被毁

 

}

 

void SideScreen () //副屏幕 行(84起,110末,若双字符宽则在108打印最后一个字)列(11上屏末,13下屏初,39下屏末。为美观最好打在38)

 

{ // | 第 d 关 | " | |\n"

 

GoToxy(93,2);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);

 

printf("第 关");

 

GoToxy(92,5);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);

 

printf("分 数:");

 

GoToxy(92,7);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

 

printf("生 命:");

 

GoToxy(86,9);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);

 

printf("剩余敌方坦克:");

 

GoToxy(86,11);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);

 

printf("当前游戏速度: %d",21-speed);

 

GoToxy(86,13);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);

 

printf("当前游戏状态:");

 

GoToxy(94,19);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);

 

GoToxy(94,24);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);

 

printf("帮 助");

 

GoToxy(86,27);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

 

printf("方向键 ←↑→↓ 移动");

 

GoToxy(93,29);

 

printf("x 键 射击");

 

GoToxy(89,31);

 

printf("+ - 调整游戏速度");

 

GoToxy(90,33);

 

printf("游戏速度范围1~20");

 

GoToxy(90,35);

 

printf("回车键 暂停游戏");

 

GoToxy(90,37);

 

printf("Esc键 退出游戏");

 

/* printf("帮 助"); //这是第二种详细说明的样式

 

GoToxy(86,21);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

 

printf("方向键 ←↑→↓ 移动");

 

GoToxy(93,23);

 

printf("x 键 射击");

 

GoToxy(89,25);

 

printf("+ - 调整游戏速度");

 

GoToxy(90,27);

 

printf("游戏速度范围1~20");

 

GoToxy(90,29);

 

printf("回车键 暂停游戏");

 

GoToxy(90,31);

 

printf("Esc键 退出游戏");

 

GoToxy(86,33);

 

printf("敌方坦克全部消灭则过关");

 

GoToxy(87,34);

 

printf("己方坦克生命值为0 或");

 

GoToxy(86,35);

 

printf("正下方的老家被毁则失败");

 

GoToxy(86,36);

 

printf("己坦克与敌坦克子弹碰撞");

 

GoToxy(87,37);

 

printf("则抵消,敌坦克间子弹碰");

 

GoToxy(86,38);

 

printf("撞不抵消且可穿过敌坦克");*/

 

}

 

void Initialize() //初始化

 

{

 

remain_enemy=16;

 

my_tank.revive=0; //我的坦克复活次数为0

 

position=0;

 

bul_num=0;

 

GetMap();

 

BuildMyTank( &my_tank );

 

for(int i=0;i<12;i++) //子弹初始化

 

{

 

bullet [i].exist=0;

 

bullet [i].initial=0;

 

}

 

for(int i=0;i<=3;i++) //AI坦克初始化

 

{

 

AI_tank [i].revive=0;

 

AI_tank [i].alive=0; //初始化坦克全是不存活的,BuildAITank()会建立重新建立不存活的坦克

 

AI_tank [i].stop=0;

 

AI_tank [i].num=i;

 

AI_tank [i].my=0;

 

AI_tank [i].CD=0;

 

}

 

GoToxy(97,2); //在副屏幕上关卡数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);

 

printf("%d",level);

 

GoToxy(102,5); //在副屏幕上打印分数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);

 

printf("%d ",score);

 

GoToxy(102,7); //在副屏幕打印我的剩余生命值

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

 

printf("%d", MAX_LIFE-my_tank.revive);

 

GoToxy(102,9); //在副屏幕上打印剩余坦克数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);

 

printf("%d ",remain_enemy);

 

GoToxy(100,13); //在副屏幕上打印状态

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_GREEN);

 

printf("正在游戏");

 

}
 

0
被禁言 夏雨轩
夏雨轩
中级守护
中级守护

#include <stdio.h>

 

#include <string>

 

#include <windows.h>

 

#include <iostream>

 

#include <time.h>

 

//里规格:长39*2=78 (真坐标)(假坐标宽为39) 高39

 

//外规格:长41*2=82 (真坐标)(假坐标宽为41) 高41

 

#define UP 1

 

#define DOWN 2

 

#define LEFT 3

 

#define RIGHT 4

 

#define MAX_LEVEL 8

 

#define BULLET_NUM 20

 

#define MAX_LIFE 4

 

using namespace std;

 

//程序中未写入函数参数表中且未说明的变量只有map二维数组,level_info数组和level

 

/*

 

此程序中涉及的x,y类的坐标值,分为以下两种:

 

假坐标:这里的坐标指的是以一个■长度为单位的坐标,而不是真正的coord坐标 (用于map数组的坐标)

 

真坐标:头文件自带的坐标结构coord中的坐标(也可以说是控制台里的真正坐标值)

 

区别:纵坐标y两值一致,假横坐标x值与真正coord横坐标(真坐标)关系是 x * 2 = coord 横坐标

 

coord横坐标既指GoTo函数中的x参数,因为本程序游戏界面以一个■长度为基本单位,

 

可以说涉及的coord横坐标全是偶数。既假坐标要变真坐标(变真坐标才能发挥真正作用),横坐标须乘以2

 

*/

 

typedef struct //这里的出现次序指的是一个AI_tank变量中的次序,游戏共有四个AI_tank变量

 

{ //∵设定每个AI_tank每种特殊坦克只出现一次 ∴fast_tank & firm_tank 最多出现次数不超过1

 

int fast_tank_order; //fast_tank出现的次序(在第fast_tank_order次复活出现,从第0次开始),且每个AI_tank只出现一次

 

int firm_tank_order; //firm_tank出现的次序,同上

 

} LevInfo; //关卡信息(准确说是该关出现的坦克信息)

 

LevInfo level_info [MAX_LEVEL] = {{-1,-1},{3,-1},{-1,3},{2,3},{2,3},{2,3},{2,3},{2,3}}; //初始化,-1代表没有该类型坦克

 

typedef struct //子弹结构体

 

{

 

int x,y; //子弹坐标,假坐标

 

int direction; //子弹方向变量

 

bool exist; //子弹存在与否的变量,1为存在,0不存在

 

bool initial; //子弹是否处于建立初状态的值,1为处于建立初状态,0为处于非建立初状态

 

bool my; //区分AI子弹与玩家子弹的标记,0为AI子弹,1为玩家(我的)子弹

 

} Bullet;

 

Bullet bullet [BULLET_NUM]; //考虑到地图上不太可能同时存在20颗子弹,所以数组元素设置20个

 

typedef struct //坦克结构体

 

{

 

int x,y; //坦克中心坐标

 

int direction; //坦克方向

 

int color; //颜色参方向数,1到6分别代表不同颜色,具体在PrintTank函数定义有说明

 

int model; //坦克图案模型,值为1,2,3,分别代表不同的坦克图案,0为我的坦克图案,AI不能使用

 

int stop; //只能是AI坦克使用的参数,非0代表坦克停止走动,0为可以走动

 

int revive; //坦克复活次数

 

int num; //AI坦克编号(固定值,为常量,初始化函数中定下)0~3

 

int CD; //发射子弹冷却计时

 

bool my; //是否敌方坦克参数,我的坦克此参数为1,为常量

 

bool alive; //存活为1,不存活为0

 

} Tank;

 

Tank AI_tank[4] , my_tank; //my_tank为我的坦克,Ai_tank 代表AI坦克

 

//∵所有的函数都有可能对全局变量map进行读写(改变),

 

//∴函数中不另说明是否会对全局变量map读写

 

//基本操作与游戏辅助函数

 

void GoToxy(int x,int y); //光标移动

 

void HideCursor(); //隐藏光标

 

void keyboard (); //接受键盘输入

 

void Initialize(); //初始化(含有对多个数据的读写)

 

void Stop(); //暂停

 

void Getmap(); //地图数据存放与获取

 

void Frame (); //打印游戏主体框架

 

void PrintMap(); //打印地图(地图既地图障碍物)(含对level的读取)

 

void SideScreen (); //副屏幕打印

 

void GameCheak(); //检测游戏输赢

 

void GameOver( bool home ); //游戏结束

 

void ClearMainScreen(); //主屏幕清屏函数∵system("cls")后打印框架有一定几率造成框架上移一行的错误∴单独编写清屏函数

 

void ColorChoose(int color); //颜色选择函数

 

void NextLevel(); //下一关(含有对level全局变量的读写)

 

//子弹部分

 

void BuildAIBullet(Tank *tank); //AI坦克发射子弹(含有对my_tank的读取,只读取了my_tank坐标)

 

void BuildBullet (Tank tank); //子弹发射(建立)(人机共用)(含全局变量bullet的修改)我的坦克发射子弹直接调用该函数,AI通过AIshoot间接调用

 

void BulletFly (Bullet bullet[BULLET_NUM]); //子弹移动和打击(人机共用),

 

void BulletHit (Bullet* bullet); //子弹碰撞(人机共用)(含Tank全局变量的修改),只通过BulletFly调用,子弹间的碰撞不在本函数,子弹间碰撞已在BulletShoot中检测并处理

 

void PrintBullet (int x,int y,int T); //打印子弹(人机共用)

 

void ClearBullet (int x,int y,int T); //清除子弹(人机共用)

 

int BulletCheak (int x,int y); //判断子弹前方情况(人机共用)

 

//坦克部分

 

void BuildAITank (int* position, Tank* AI_tank); //建立AI坦克

 

void BuildMyTank (Tank* my_tank); //建立我的坦克

 

void MoveAITank (Tank* AI_tank); //AI坦克移动

 

void MoveMyTank (int turn); //我的坦克移动,只通过keyboard函数调用,既键盘控制

 

void ClearTank (int x,int y); //清除坦克(人机共用)

 

void PrintTank (Tank tank); //打印坦克(人机共用)

 

bool TankCheak (Tank tank,int direction); //检测坦克dirtection方向的障碍物,返值1阻碍,0 畅通

 

int AIPositionCheak (int position); //检测AI坦克建立位置是否有障碍物AIPositionCheak

 

//DWORD WINAPI InputX(LPVOID lpParameter); //声明线程函数,用于检查X键输入并设置X键的输入冷却时间

 

//注意map数组应是纵坐标在前,横坐标在后,既map[y][x],(∵数组行长度在前,列长度在后)

 

//map里的值: 个位数的值为地图方块部分,百位数的值为坦克,子弹在map上没有值(子弹仅仅是一个假坐标)

 

//map里的值: 0为可通过陆地,1为红砖,2黄砖,5为水,100~103为敌方坦克,200为我的坦克,

 

//全局变量

 

int map[41][41]; //地图二维数组

 

int key_x; // X键是否被“读入”的变量,也是子弹是否可以发射的变,

 

int bul_num; //子弹编号

 

int position; //位置计数,对应AI坦克生成位置,-1为左位置,0为中间,1为右,2为我的坦克位置

 

int speed=7; //游戏速度,调整用

 

int level=1; //游戏关卡数

 

int score=0; //游戏分数

 

int remain_enemy; //剩余敌人(未出现的敌人)

 

char* tank_figure[4][3][4]=

 

{

 

{

 

{"◢┃◣", "◢━◣", "◢┳◣", "◢┳◣"},

 

{"┣●┫", "┣●┫", "━●┃", "┃●━"},

 

{"◥━◤", "◥┃◤", "◥┻◤", "◥┻◤"}

 

},

 

{

 

{"┏┃┓", "┏┳┓", "┏┳┓", "┏┳┓"},

 

{"┣●┫", "┣●┫", "━●┫", "┣●━"},

 

{"┗┻┛", "┗┃┛", "┗┻┛", "┗┻┛"}

 

},

 

{

 

{"┏┃┓", "◢━◣", "┏┳◣", "◢┳┓"},

 

{"┣●┫", "┣●┫", "━●┃", "┃●━"},

 

{"◥━◤", "┗┃┛", "┗┻◤", "◥┻┛"}

 

},

 

{

 

{"╔┃╗", "╔╦╗", "╔╦╗", "╔╦╗"},

 

{"╠█╣", "╠█╣", "━█╣", "╠█━"},

 

{"╚╩╝", "╚┃╝", "╚╩╝", "╚╩╝"}

 

}

 

};

 

int main () //主函数

 

{

 

int i;

 

unsigned int interval[12]={1,1,1,1,1,1,1,1,1,1,1,1} ; //间隔计数器数组,用于控制速度

 

srand(time(NULL)); //设置随机数种子(若不设置种子而调用rand会使每次运行的随机数序列一致)随机数序列指:如首次调用rand得到1,第二次得2,第三次3,则此次随机数序列为1,2,3

 

HideCursor(); //隐藏光标

 

system("mode con cols=112 lines=42"); //控制窗口大小

 

Frame (); //打印游戏主体框架

 

Initialize(); //初始化,全局变量level初值便是1

 

// HANDLE h1 , h2 ; //定义句柄变量

 

for(;;)

 

{

 

if(interval[0]++%speed==0) //速度调整用,假设interval[0]为a, 语句意为 a % 2==0,a=a+1;

 

{

 

GameCheak(); //游戏胜负检测

 

BulletFly ( bullet );

 

for(i=0 ; i<=3 ; i++) //AI坦克移动循环

 

{

 

if(AI_tank[i].model==2 && interval[i+1]++%2==0) //四个坦克中的快速坦克单独使用计数器1,2,3,4

 

MoveAITank( & AI_tank[i]);

 

if(AI_tank[i].model!=2 && interval[i+5]++%3==0) //四个坦克中的慢速坦克单独使用计数器5,6,7,8

 

MoveAITank( & AI_tank[i]);

 

}

 

for(i=0;i<=3;i++) //建立AI坦克部分

 

if(AI_tank[i].alive==0 && AI_tank[i].revive<4 && interval[9]++%90==0) //一个敌方坦克每局只有4条命

 

{ //如果坦克不存活。计时,每次建立有间隔 1750 ms

 

BuildAITank( &position, & AI_tank[i] ); //建立AI坦克(复活)

 

break; //每次循环只建立一个坦克

 

}

 

for(i=0;i<=3;i++)

 

if(AI_tank[i].alive)

 

BuildAIBullet(&AI_tank[i]); //AIshoot自带int自增计数CD,不使用main中的CD interval

 

if(my_tank.alive && interval[10]++%2==0 )

 

keyboard ();

 

if(my_tank.alive==0 && interval[11]++%30==0 && my_tank.revive < MAX_LIFE)

 

BuildMyTank( &my_tank );

 

}

 

Sleep(5);

 

}

 

return 0;

 

}

 

/*//这里的多线程暂时不用 //x键用于子弹发射,x键的冷却时间不能和上下左右一同设置,那样就太快了

 

DWORD WINAPI InputX(LPVOID lpParameter) //如果不用多线程运行,那么在x键冷却时间内程序会因Sleep将会挂起,暂停运行

 

{ //因为只有一个变量改变,而且变量改变先后顺序是显而易见的,所以不必设置缓冲区

 

for(;;)

 

{

 

if(GetAsyncKeyState( 88 )& 0x8000) //88为x键键值,当摁下x并且x键处于可输入状态

 

{

 

key_x=1; // X键是否允许被“读入”的变量,也是子弹是否可以发射的变量

 

Sleep(600); // 子线程Sleep中,x就不能被"读入",主线程每操作完一次子弹发射,key_x会归零

 

}

 

Sleep(10);

 

}

 

return 0;

 

}*/

 

void keyboard ()

 

{ // kbhit() getch() 用法可用但是不好用

 

/*

 

函数功能:该函数判断在此函数被调用时,某个键是处于UP状态还是处于DOWN状态,及前次调用GetAsyncKeyState函数后,

 

是否按过此键.如果返回值的最高位被置位,那么该键处于DOWN状态;如果最低位被置位,那么在前一次调用此函数后,此键被按过,

 

否则表示该键没被按过.

 

这里GetAsyncKeyState比 kbhit() + getch() 好用,操作更顺畅. GetAsyncKeyState的返回值表示两个内容,

 

一个是最高位bit的值,代表这个键是否被按下。一个是最低位bit的值,代表上次调用GetAsyncKeyState后,这个键是否被按下。

 

&为与操作,&0x8000就是判断这个返回值的高位字节。如果high-order bit是1,则是按下状态,否则是弹起状态,为0

 

*/

 

int count=0;

 

if (GetAsyncKeyState(VK_UP)& 0x8000)

 

MoveMyTank( UP );

 

else if (GetAsyncKeyState(VK_DOWN)& 0x8000)

 

MoveMyTank( DOWN );

 

else if (GetAsyncKeyState(VK_LEFT)& 0x8000)

 

MoveMyTank( LEFT );

 

else if (GetAsyncKeyState(VK_RIGHT)& 0x8000)

 

MoveMyTank( RIGHT );

 

else if (GetAsyncKeyState( 0x1B )& 0x8000) // Esc键

 

exit(0); //退出程序函数

 

else if (GetAsyncKeyState( 0x20 )& 0x8000) //空格

 

Stop();

 

else if (count++%7==0) //这里添加计数器是为了防止按键粘连不能达到微调效果

 

{

 

if (speed>1 && GetAsyncKeyState( 0x6B )& 0x8000) // +键

 

{

 

speed--;

 

GoToxy(102,11); //在副屏幕打印出当前速度

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_RED);

 

printf("%d ",21-speed); //副屏幕显示的速度为1~10

 

}

 

else if (speed<20 && GetAsyncKeyState( 0x6D )& 0x8000) // - 键

 

{

 

speed++;

 

GoToxy(102,11); //在副屏幕打印出当前速度

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_RED);

 

printf("%d ",21-speed); //副屏幕显示的速度为1~10

 

}

 

}

 

if(my_tank.CD==7)

 

{

 

if(GetAsyncKeyState( 88 )& 0x8000)

 

{

 

BuildBullet(my_tank);

 

my_tank.CD=0;

 

}

 

}

 

else

 

my_tank.CD++;

 

}

 

void BuildAIBullet(Tank *tank) //AI子弹发射(建立)含有对my_tank的读取

 

{

 

if(tank->CD==15)

 

{

 

if(!(rand()%11)) //冷却结束后在随后的每个游戏周期中有10分之一的可能发射子弹

 

{

 

BuildBullet(*tank);

 

tank->CD=0;

 

}

 

}

 

else

 

tank->CD++;

 

if(tank->CD >= 14) //AI强化部分,在冷却到达一定范围即可使用

 

{

 

if(tank->y==38 ) //如果坦克在底部(这个最优先)

 

{

 

if(tank->x < 20) //在老家左边

 

{

 

if(tank->direction==RIGHT) //坦克方向朝左

 

{

 

BuildBullet(*tank); //发射子弹

 

tank->CD=0;

 

}

 

}

 

else //在老家右边

 

if(tank->direction==LEFT) //坦克方向朝右

 

{

 

BuildBullet(*tank); //发射子弹

 

tank->CD=0;

 

}

 

}

 

else if(tank->x==my_tank.x+1 || tank->x==my_tank.x || tank->x==my_tank.x-1) //AI坦克在纵向上"炮口"对准我的坦克

 

{

 

if(tank->direction==DOWN && my_tank.y > tank->y || tank->direction==UP && my_tank.y < tank->y)

 

{ //若是AI朝下并且我的坦克在AI坦克下方(数值大的在下面)或者AI朝上我的坦克在AI上方

 

int big=my_tank.y , smal=tank->y , i;

 

if(my_tank.y < tank->y)

 

{

 

big=tank->y;

 

smal=my_tank.y;

 

}

 

for(i=smal+2;i<=big-2;i++) //判断AI炮口的直线上两坦克间有无障碍

 

if(map[i][tank->x]!=0 || map[i][tank->x]!=5) //若有障碍

 

break;

 

if(i==big-1) //若i走到big-1说明无障碍

 

{

 

BuildBullet(*tank); //则发射子弹

 

tank->CD=0;

 

}

 

}

 

}

 

else if(tank->y==my_tank.y+1 || tank->y==my_tank.y || tank->y==my_tank.y-1) //AI坦克在横向上"炮口"对准我的坦克

 

{

 

if(tank->direction==RIGHT && my_tank.x > tank->x || tank->direction==LEFT && my_tank.x < tank->x)

 

{ //若是AI朝右并且我的坦克在AI坦克右方(数值大的在下面)或者AI朝左我的坦克在AI左方

 

int big=my_tank.y , smal=tank->y , i;

 

if(my_tank.x < tank->x)

 

{

 

big=tank->x;

 

smal=my_tank.x;

 

}

 

for(i=smal+2;i<=big-2;i++) //判断AI炮口的直线上两坦克间有无障碍

 

if(map[tank->y][i]!=0 || map[tank->y][i]!=5) //若有障碍

 

break;

 

if(i==big-1) //若i走到big-1说明无障碍

 

{

 

BuildBullet(*tank); //则发射子弹

 

tank->CD=0;

 

}

 

}

 

}

 

}

 

}

 

void BuildBullet(Tank tank) //子弹发射(建立),传入结构体Tank,这里包含改变了全局变量结构体bullet

 

{ //∵实现方式为顺序循环建立子弹,每次调用改变的bullet数组元素都不同

 

switch(tank.direction) //∴为了方便,不将bullet放入参数,bullet作为全局变量使用

 

{

 

case UP :

 

bullet [bul_num].x = tank.x;

 

bullet [bul_num].y = tank.y-2;

 

bullet [bul_num].direction=1;

 

break;

 

case DOWN :

 

bullet [bul_num].x = tank.x;

 

bullet [bul_num].y = tank.y+2;

 

bullet [bul_num].direction=2;

 

break;

 

case LEFT :

 

bullet [bul_num].x = tank.x-2;

 

bullet [bul_num].y = tank.y;

 

bullet [bul_num].direction=3;

 

break;

 

case RIGHT :

 

bullet [bul_num].x = tank.x+2;

 

bullet [bul_num].y = tank.y;

 

bullet [bul_num].direction=4;

 

break;

 

}

 

bullet [bul_num].exist = 1; //子弹被建立,此值为1则此子弹存在

 

bullet [bul_num].initial = 1; //子弹处于初建立状态

 

bullet [bul_num].my=tank.my; //如果是我的坦克发射的子弹bullet.my=1,否则为0

 

bul_num++;

 

if(bul_num==BULLET_NUM) //如果子弹编号增长到20号,那么重头开始编号

 

bul_num=0; //考虑到地图上不可能同时存在20颗子弹,所以数组元素设置20个

 

}

 

void BulletFly(Bullet bullet[BULLET_NUM]) //子弹移动和打击

 

{ //含有全局变量Bullet的改变

 

for(int i =0; i<BULLET_NUM;i++)

 

{

 

if(bullet [i].exist) //如果子弹存在

 

{

 

if(bullet [i].initial==0) //如果子弹不是初建立的

 

{

 

if(map[bullet[i].y] [bullet[i].x]==0 || map[bullet[i].y] [bullet[i].x]==5) //如果子弹坐标当前位置无障碍

 

ClearBullet( bullet[i].x , bullet[i].y , BulletCheak(bullet[i].x , bullet[i].y )); //抹除子弹图形

 

switch(bullet [i].direction) //然后子弹坐标变化(子弹变到下一个坐标)

 

{

 

case UP :(bullet [i].y)--;break;

 

case DOWN :(bullet [i].y)++;break;

 

case LEFT :(bullet [i].x)--;break;

 

case RIGHT :(bullet [i].x)++;break;

 

}

 

}

 

int collide = BulletCheak ( bullet [i].x , bullet [i].y ); //判断子弹当前位置情况,判断子弹是否碰撞,是否位于水面上。

 

if( collide ) //如果检测到当前子弹坐标无障碍(无碰撞)(包括在地面上与在水面上)

 

PrintBullet( bullet[i].x , bullet[i].y , collide); //则打印子弹,若有碰撞则不打印

 

else

 

BulletHit( & bullet [i] ); //若有碰撞则执行子弹碰撞函数

 

if(bullet [i].initial) //若子弹初建立,则把初建立标记去除

 

bullet [i].initial = 0;

 

for(int j=0; j< BULLET_NUM ; j++) //子弹间的碰撞判断,若是我方子弹和敌方子弹碰撞则都删除,若为两敌方子弹则无视

 

if(bullet [j].exist && j!=i && (bullet[i].my || bullet[j].my) && bullet[i].x==bullet[j].x && bullet[i].y==bullet[j].y)

 

{ //同样的两颗我方子弹不可能产生碰撞

 

bullet [j].exist=0;

 

bullet [i].exist=0;

 

ClearBullet( bullet[j].x , bullet[j].y , BulletCheak(bullet[j].x , bullet[j].y )); //抹除j子弹图形,子弹i图形已被抹除

 

break;

 

}

 

}

 

}

 

}

 

void BulletHit(Bullet* bullet) //含有Tank全局变量的修改,子弹间的碰撞不在本函数,子弹间碰撞已在BulletShoot中检测并处理

 

{ //∵每次打中的坦克都不一样,不可能把所有坦克放在参数表中

 

int x=bullet->x; //∴这里的Tank使用全局变量

 

int y=bullet->y; //这里传入的值是子弹坐标,这两个值不需要改变

 

int i;

 

if(map[y][x]==1 || map[y][x]==2) //子弹碰到砖块

 

{

 

if(bullet->direction==UP || bullet->direction==DOWN) //如果子弹是纵向的

 

for(i = -1 ; i<=1 ; i++)

 

if(map[y][x+i]==1 || map[y][x+i]==2) //如果子弹打中砖块两旁为砖块,则删除砖,若不是(一旁为坦克或其他地形)则忽略

 

{

 

map[y][x+i]=0; //砖块碎

 

GoToxy(2*x+2*i,y);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED); //背景黑色

 

printf(" ");

 

}

 

if(bullet->direction==LEFT || bullet->direction==RIGHT) //若子弹是横向的 (与子弹纵向实现同理)

 

for(i = -1 ; i<=1 ; i++)

 

if(map[y+i][x]==1 || map[y+i][x]==2)

 

{

 

map[y+i][x]=0;

 

GoToxy(2*x,y+i);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED); //背景黑色

 

printf(" ");

 

}

 

bullet->exist=0; //这颗子弹已经不存在了

 

}

 

else if(map[y][x]==4 || map[y][x]==6 ) //子弹碰到边框或者不可摧毁方块

 

bullet->exist=0;

 

else if(bullet->my && map[y][x]>=100 && map[y][x]<104 ) //若我的子弹碰到了敌方坦克

 

{

 

int num = map[y][x]%100; //map[y][x]%100 等同于 tank.num ,可通过map值读取该坦克信息

 

if(AI_tank[num].model==3 && AI_tank[num].color==2) //若为firm tank,且color==2。该坦克为绿色,表明没有受到伤害

 

AI_tank[num].color=3; //则变成黄色,color=3为黄色

 

else if (AI_tank[num].model==3 && AI_tank[num].color==3)

 

AI_tank[num].color=4; //4为红色

 

else //其他类型的坦克或者firm tank为红色的情况

 

{

 

AI_tank[num].alive=0;

 

ClearTank(AI_tank[num].x , AI_tank[num].y); //清除该坦克

 

}

 

bullet->exist=0;

 

score+=100;

 

GoToxy(102,5); //在副屏幕上打印出分数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);

 

printf("%d ",score);

 

}

 

else if(map[y][x]==200 && bullet->my==0 ) //若敌方子弹击中我的坦克

 

{

 

my_tank.alive=0;

 

ClearTank(my_tank.x , my_tank.y);

 

bullet->exist=0;

 

my_tank.revive++; //我的坦克复活次数+1(∵我的坦克复活次数与生命值有关∴放在这里自减)

 

score-=100; //分数减少

 

GoToxy(102,5); //在副屏幕上打印出分数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);

 

printf("%d ",score);

 

GoToxy(102,7); //在副屏幕打印出我的剩余生命值

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

 

printf("%d ", MAX_LIFE-my_tank.revive);

 

}

 

// else if(bullet->my==0 && map[y][x]>=100 && map[y][x]<104) //敌方子弹击中敌方坦克,可以设置两种子弹运行方式,这种暂时不用

 

// bullet->exist=0;

 

else if(map[y][x]==9) //子弹碰到家(无论是谁的子弹)

 

{

 

bullet->exist=0;

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE|FOREGROUND_RED|FOREGROUND_GREEN);

 

GoToxy(38,37); printf(" ");

 

GoToxy(38,38); printf("◢◣ ");

 

GoToxy(38,39); printf("███");

 

GameOver(1); //游戏结束,传入1代表老家被毁

 

}

 

}

 

int BulletCheak (int x,int y) //判断子弹当前位置情况,判断子弹是否碰撞,是否位于水面上。

 

{ //有障碍返回0,无障碍且子弹在地面返回1,子弹在水面上返回2

 

if(map[y][x]==0)

 

return 1;

 

else if(map[y][x]==5)

 

return 2;

 

else

 

return 0;

 

}

 

void PrintBullet (int x,int y,int T) //当前坐标BulletCheak 的值做参量 T

 

{

 

if(T==1) // T==1 表示子弹当前坐标在陆地上

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY);

 

else if(T==2) // T==2 表示子弹当前坐标在水面上

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY|BACKGROUND_BLUE);

 

GoToxy(2*x,y);

 

printf("");

 

}

 

void ClearBullet(int x,int y,int T) //当前坐标BulletCheak 的值做参量 T

 

{

 

GoToxy(2*x,y);

 

if(T==2) // T==2 表示子弹当前坐标在水面上

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|BACKGROUND_BLUE|FOREGROUND_BLUE|FOREGROUND_GREEN);

 

printf("~");

 

}

 

else if(T==1) // T==1 表示子弹当前坐标在陆地上

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE);

 

printf(" ");

 

}

 

}

 

//position为坦克生成位置,-1为左位置,0为中间,1为右,2为我的坦克位置

 

void BuildAITank(int* position, Tank* AI_tank) //执行一次该函数只建立一个坦克

 

{ //rand函数公式:0<=rand()%(a+1)<=a 0+m<=rand()%(n-m+1)+m<=n

 

//rand函数实现1到n:1<=rand()%(n)+1<=n

 

if(AIPositionCheak(*position)) //若此位置无障碍,可生成。position参数详见AIPositionCheak函数定义

 

{

 

AI_tank->x= 20 + 18*(*position); //20 + 18 * position 对应三个生成位置的x假坐标

 

AI_tank->y=2;

 

if(AI_tank->revive==level_info[level-1].firm_tank_order) //坦克出现(复活)次序==关卡信息(level_info)中firm tank的出现次序

 

{

 

AI_tank->model = 3; //3为firm tank的模型(外观)

 

AI_tank->color = 2; //颜色参数2为绿色,具体详见函数ColorChoose

 

}

 

else if(AI_tank->revive==level_info[level-1].fast_tank_order) //同上if,这里是fast_tank的

 

{

 

AI_tank->model = 2;

 

AI_tank->color = rand()%6+1; //若不是firm tank则随机颜色,颜色参数为1~6,分别代表不同颜色,详见函数ColorChoose

 

}

 

else //普通坦克

 

{

 

AI_tank->model = 1;

 

AI_tank->color = rand()%6+1; //若不是firm tank则随机颜色

 

}

 

AI_tank->alive = 1; //坦克变为存在

 

AI_tank->direction = 2 ; //方向朝下

 

AI_tank->revive++; //复活次数+1

 

PrintTank(*AI_tank);

 

(*position)++;

 

remain_enemy--;

 

GoToxy(102,9); //在副屏幕上打印剩余坦克数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);

 

printf("%d ",remain_enemy);

 

if(*position==2) //position只能为0,1,-1,这里position循环重置

 

*position = -1;

 

return ; //若生成了一辆坦克,则结束该函数

 

}

 

}

 

int AIPositionCheak( int position ) //position为坦克生成位置2为我的坦克位置,其余为AI位,-1为左位,0为中间位置,1为右位

 

{

 

int x,y;

 

if(position==2) //2为我的坦克位置,现在暂时用不到

 

x=15,y=38;

 

else

 

y=2 , x= 20 + 18 * position ; //20 + 18 * position 对应三个生成位置的x假坐标

 

for(int i=0;i<3;i++)

 

for(int j=0;j<3;j++)

 

if( map[y+j-1][x+i-1]!=0) //如果遍历的九宫格里有障碍物

 

return 0; //则返回0,表示此生成位置有阻碍

 

return 1; //否则生成1,表示此生成位置无阻碍

 

}

 

void MoveAITank(Tank* AI_tank) //AI专用函数,该函数主要为AI加强

 

{

 

if(AI_tank->alive) //如果坦克活着

 

{

 

if(AI_tank->stop!=0) //坦克是否停止运动的判断,若stop参数不为0

 

{

 

AI_tank->stop--; //则此坦克本回合停止运动

 

return;

 

}

 

if( !(rand()%23) ) //22分之1的概率执行方向重置

 

{

 

AI_tank->direction = rand()%4+1;

 

if( rand()%3 ) //在方向重置后有2分之1的概率停止走动3步的时间

 

{

 

AI_tank->stop=2;

 

return;

 

}

 

}

 

ClearTank (AI_tank->x , AI_tank->y);

 

if(TankCheak ( *AI_tank , AI_tank->direction)) //如果前方无障碍

 

switch ( AI_tank->direction )

 

{

 

case UP : AI_tank->y--; break; //上前进一格

 

case DOWN : AI_tank->y++; break; //下前进一格

 

case LEFT : AI_tank->x--; break; //左前进一格

 

case RIGHT: AI_tank->x++; break; //右前进一格

 

}

 

else //前方有障碍

 

{

 

if(!(rand()%4)) //3分之1的概率乱转

 

{

 

AI_tank->direction=rand()%4+1;

 

AI_tank->stop=2; //乱转之后停止走动3步的时间

 

PrintTank(*AI_tank);

 

return; //∵continue会跳过下面的打印函数,∴这里先打印

 

}

 

else //另外3分之2的几率选择正确的方向

 

{

 

int j;

 

for(j=1;j<=4;j++)

 

if(TankCheak ( *AI_tank , j )) //循环判断坦克四周有无障碍,此函数返值1为可通过

 

break;

 

if(j==5) //j==5说明此坦克四周都有障碍物,无法通行

 

{

 

PrintTank(*AI_tank);

 

return; //则跳过下面的while循环以防程序卡死

 

}

 

while(TankCheak ( *AI_tank , AI_tank->direction) == 0) //如果前方仍有障碍

 

AI_tank->direction=(rand()%4+1); //则换个随机方向检测

 

}

 

}

 

PrintTank(*AI_tank); //打印AI坦克

 

}

 

}

 

void BuildMyTank (Tank* my_tank) //建立我的坦克

 

{

 

my_tank->x=15;

 

my_tank->y=38;

 

my_tank->stop=NULL;

 

my_tank->direction=1;

 

my_tank->model=0;

 

my_tank->color=1;

 

my_tank->alive=1;

 

my_tank->my=1;

 

my_tank->CD=7;

 

PrintTank (*my_tank) ; //打印我的坦克

 

}

 

void MoveMyTank(int turn ) //玩家专用函数,turn为keyboard函数里因输入不同方向键而传入的不同的值

 

{

 

ClearTank(my_tank.x , my_tank.y); //map 数组中“我的坦克”参数清除工作已在此函数中完成

 

my_tank.direction=turn; //将键盘输入的方向值传入我的坦克方向值

 

if(TankCheak ( my_tank , my_tank.direction )) //若此时我的坦克当前方向上无障碍

 

switch (turn)

 

{

 

case UP : my_tank.y--; break; //上前进一格

 

case DOWN : my_tank.y++; break; //下前进一格

 

case LEFT : my_tank.x--; break; //左前进一格

 

case RIGHT: my_tank.x++; break; //右前进一格

 

} //若坦克当前方向上有障碍则跳过坐标变化直接打印该转向的坦克

 

PrintTank (my_tank);

 

}

 

bool TankCheak(Tank tank,int direction) //检测坦克前方障碍函数,参量为假坐标。返值1为可通过,返值0为阻挡(人机共用)

 

{

 

switch(direction) //direction变量 1上,2下,3左,4右

 

{

 

case UP:

 

if (map[tank.y-2][tank.x]==0 && map[tank.y-2][tank.x-1]==0 && map[tank.y-2][tank.x+1]==0)

 

return 1;

 

else

 

return 0;

 

case DOWN:

 

if (map[tank.y+2][tank.x]==0 && map[tank.y+2][tank.x-1]==0 && map[tank.y+2][tank.x+1]==0)

 

return 1;

 

else

 

return 0;

 

case LEFT:

 

if (map[tank.y][tank.x-2]==0 && map[tank.y-1][tank.x-2]==0 && map[tank.y+1][tank.x-2]==0)

 

return 1;

 

else

 

return 0;

 

case RIGHT:

 

if (map[tank.y][tank.x+2]==0 && map[tank.y-1][tank.x+2]==0 && map[tank.y+1][tank.x+2]==0)

 

return 1;

 

else

 

return 0;

 

default:

 

printf("错误!!");

 

Sleep(5000);

 

return 0;

 

}

 

}

 

void ClearTank(int x,int y) //清除坦克函数(人机共用)

 

{

 

for(int i=0;i<3;i++)

 

for(int j=0;j<3;j++)

 

{ //将坦克占用的地图上的九格去掉

 

map[y+j-1][x+i-1]=0;

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);

 

GoToxy(2*x+2*j-2,y+i-1);

 

printf(" ");

 

}

 

}

 

void PrintTank(Tank tank) //打印坦克(人机共用) 由于读取的Tank参数较多,故就不将参数一一传入了

 

{ // tank.color参数对应不同的颜色,范围 1 ~ 6

 

ColorChoose(tank.color); //颜色选择函数 定义一个数组里装着字符指针(既装字符串)的数组指针(指向一维数组首地址的指针)

 

char *(*tankF)[4] = tank_figure[tank.model]; //将二维数组首址赋初值给数组指针 model==0为我的坦克,4为电脑1坦克,8为电脑2,类推

 

for(int i = 0; i < 3; i++)

 

{

 

GoToxy((tank.x-1)*2 , tank.y-1+i); //在坦克中心坐标的左边,上中下三行打印

 

printf("%s", tankF[i][tank.direction-1]); //打印的是地址,地址既字符串

 

for(int j=0;j<3;j++)

 

if(tank.my) //若为我的坦克

 

map[tank.y+j-1][tank.x+i-1]=200; //在map上把"坦克"九格填满代表敌我坦克的参数。敌方此值为100~103,我方为200

 

else

 

map[tank.y+j-1][tank.x+i-1]=100+tank.num; //这样可以通过map值读取坦克编号,读取操作在BulletHit 函数

 

}

 

}

 

void HideCursor() //隐藏光标

 

{ //CONSOLE_CURSOR_INFO结构体包含控制台光标的信息,DWORD dwSize光标百分比厚度(1~100)和BOOL bVisible光标是否可见

 

CONSOLE_CURSOR_INFO cursor_info={1,0};

 

SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info); //SetConsoleCursorInfo用来设置指定的控制台光标的大小和可见性。

 

}

 

void GoToxy(int x,int y) //光标移动函数,X表示横坐标,Y表示纵坐标。

 

{

 

COORD coord; //使用头文件自带的坐标结构

 

coord.X=x; //这里将int类型值传给short,不过程序中涉及的坐标值均不会超过short范围

 

coord.Y=y;

 

HANDLE a=GetStdHandle(STD_OUTPUT_HANDLE); //获得标准输出句柄

 

SetConsoleCursorPosition(a,coord); //以标准输出的句柄为参数设置控制台光标坐标

 

}

 

void ColorChoose(int color) //颜色选择函数

 

{

 

switch(color)

 

{

 

case 1: //天蓝色(我的坦克颜色)

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);

 

break;

 

case 2: //绿色

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

 

break;

 

case 3: //黄色

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);

 

break;

 

case 4: //红色

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);

 

break;

 

case 5: //紫色

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);

 

break;

 

case 6: //白色

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);

 

break;

 

case 7: //深蓝色(∵颜色深难与黑色背景辨识度不高 ∴坦克颜色不选用此颜色),只用在字体颜色闪烁中

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);

 

break;

 

}

 

}

 

void Stop() //暂停

 

{

 

int color=1,timing=0;

 

while(1)

 

{

 

if(timing++%30==0)

 

{

 

ColorChoose(color); //颜色选择

 

GoToxy(100,13); //副屏幕打印

 

printf("游戏暂停");

 

GoToxy(88,17);

 

printf("按回车键回到游戏");

 

GoToxy(88,18);

 

printf("或按 Esc键退出游戏");

 

if(++color==8)

 

color=1;

 

}

 

if (GetAsyncKeyState( 0xD )& 0x8000) //回车键

 

{

 

GoToxy(100,13); //副屏幕打印

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);

 

printf("正在进行"); //覆盖掉原来的提示

 

GoToxy(88,17);

 

printf(" ");

 

GoToxy(88,18);

 

printf(" ");

 

break;

 

}

 

else if(GetAsyncKeyState( 0x1B )& 0x8000) //Esc键退出

 

exit(0);

 

Sleep(20);

 

}

 

}

 

void ClearMainScreen() //主屏幕清屏函数,因使用system("cls");再打印框架有一定几率造成框架上移一行的错误,所以单独编写清屏函数

 

{

 

for(int i=1;i<40;i++)

 

{

 

GoToxy(2,i);

 

printf(" ");

 

}

 

}

 

void Frame () //打印游戏主体框架

 

{ //SetConsoleTextAttribute为设置文本颜色和文本背景颜色函数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_INTENSITY);

 

printf(" ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ");

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE);

 

printf(" ▂▂▂▂▂▂▂▂▂▂▂▂▂ \n");

 

for(int i=0;i<14;i++)

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_INTENSITY);

 

printf("▕ ▏");

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE);

 

printf(" | |\n");

 

}

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_INTENSITY);

 

printf("▕ ▏");

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE);

 

printf(" |═════════════|\n");

 

for(int i=0;i<24;i++)

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_INTENSITY);

 

printf("▕ ▏");

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE);

 

printf(" | |\n");

 

}

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_INTENSITY);

 

printf(" ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ ");

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_BLUE);

 

printf(" ﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊\n");

 

SideScreen (); //打印副屏幕

 

}

 

void PrintMap() // 打印地图(地图既地图障碍物)

 

{

 

for(int j=0;j<41;j++)

 

for(int i=0;i<41;i++)

 

if(map[i][j]==6)

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN

 

|FOREGROUND_RED|FOREGROUND_BLUE|BACKGROUND_GREEN|BACKGROUND_RED|BACKGROUND_BLUE);

 

GoToxy(2*j,i);

 

printf("■");

 

}

 

else if(map[i][j]==2)

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|BACKGROUND_GREEN|BACKGROUND_RED);

 

GoToxy(2*j,i);

 

printf("▓");

 

}

 

else if(map[i][j]==1)

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|BACKGROUND_GREEN|BACKGROUND_RED);

 

GoToxy(2*j,i);

 

printf("▓");

 

}

 

else if(map[i][j]==5)

 

{

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|BACKGROUND_BLUE|FOREGROUND_BLUE|FOREGROUND_GREEN);

 

GoToxy(2*j,i);

 

printf("~");

 

}

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE|FOREGROUND_RED|FOREGROUND_GREEN);

 

GoToxy(38,37); printf(" ◢◣");

 

GoToxy(38,38); printf("███"); //∵无论地图怎么变,家所在位置不变,且家的字符多种,不方便用上述方式打印

 

GoToxy(38,39); printf("███"); //∴直接打印(且家的map值与符号无关)

 

}

 

void GetMap() //地图存放函数

 

{ //map里的值: 个位数的值为地图方块部分,百位数的值为坦克

 

int i ,j; //map里的值: 0为可通过陆地,1为红砖,2待定,5为水,100为敌方坦克,200为我的坦克,

 

int Map[8][41][41]=

 

{

 

{

 

{4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},

 

{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

 

{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

 

{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

 

{4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

 

{4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

 

{4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

 

{4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

 

{4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},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0,0,4},

 

{4,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,4},

 

{4,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,4},

 

{4,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,4},

 

{4,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

 

{4,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

 

{4,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

 

{4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,4},

 

{4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,4},

 

{4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,4},

 

{4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}

 

},

 

};

 

for(i=0;i<41;i++)

 

for(j=0;j<41;j++)

 

map[i][j]=Map[level-1][i][j];

 

PrintMap(); //打印地图

 

}

 

void GameOver(bool home)

 

{

 

int timing=0,color=1;

 

while(1)

 

{

 

if(timing++%30==0) //游戏结束原因为生命值为0

 

{

 

ColorChoose(color); //颜色选择

 

if(home) //游戏结束原因为老家被毁,则多打印一行字以提示玩家

 

{

 

GoToxy(37,19); //主屏幕中心打印

 

printf("老家被毁!");

 

}

 

GoToxy(37,20); //主屏幕中心打印

 

printf("游戏结束!");

 

GoToxy(100,13); //副屏幕打印

 

printf("游戏结束");

 

GoToxy(88,17);

 

printf("请按回车键重新开始!");

 

GoToxy(88,18);

 

printf("或按 Esc键退出游戏!");

 

if(++color==8)

 

color=1;

 

}

 

if (GetAsyncKeyState( 0xD )& 0x8000) //回车键

 

{

 

// system("cls"); //清屏,这里清屏后再次打印框架有一定几率造成框架上移一行的bug,因此选用自建清屏函数

 

// Frame (); //重新打印游戏框架

 

score-=500; //分数-500

 

ClearMainScreen(); //主屏清屏函数,无需再次打印框架

 

Initialize(); //从本关重新开始

 

break;

 

}

 

else if(GetAsyncKeyState( 0x1B )& 0x8000) //Esc键退出

 

exit(0);

 

Sleep(20);

 

}

 

}

 

void NextLevel()

 

{

 

int timing=0,color=1;

 

level++;

 

if(level<=MAX_LEVEL)

 

while(1)

 

{

 

if(timing++%10==0)

 

{

 

ColorChoose(color); //颜色选择

 

GoToxy(37,20); //主屏幕中心打印

 

printf("恭喜过关!");

 

GoToxy(100,13); //副屏幕打印

 

printf("等待下关");

 

GoToxy(87,17);

 

printf("请按回车键进入下一关!");

 

GoToxy(88,18);

 

printf("或按 Esc键退出游戏!");

 

if(++color==8)

 

color=1;

 

}

 

if (GetAsyncKeyState( 0xD )& 0x8000) //回车键

 

{

 

GoToxy(88,17); //抹除副屏幕中的提示

 

printf(" ");

 

GoToxy(88,18);

 

printf(" ");

 

ClearMainScreen(); //主屏清屏函数,无需再次打印框架

 

Initialize(); //初始化从下一关开始,level已++

 

break;

 

}

 

else if(GetAsyncKeyState( 0x1B )& 0x8000) //Esc键退出

 

exit(0);

 

Sleep(20);

 

}

 

else //level>8 通关

 

while(1)

 

{

 

if(timing++%5==0)

 

{

 

ColorChoose(color);

 

GoToxy(33,20); //主屏幕中心打印

 

printf("恭喜通过全部关卡!");

 

GoToxy(100,13); //副屏幕打印

 

printf("已通全关");

 

GoToxy(88,17);

 

printf("恭喜通过全部关卡!");

 

GoToxy(88,19);

 

printf("按 Esc键退出游戏!");

 

if(++color==8)

 

color=1;

 

}

 

if(GetAsyncKeyState( 0x1B )& 0x8000) //Esc键退出

 

exit(0);

 

Sleep(10);

 

}

 

}

 

void GameCheak()

 

{ //剩余敌人为0且四坦克全部不存活

 

if(remain_enemy<=0 && !AI_tank[0].alive && !AI_tank[1].alive && !AI_tank[2].alive && !AI_tank[3].alive )

 

NextLevel(); //进入下一关

 

if(my_tank.revive>=MAX_LIFE) //我的生命值(复活次数)全部用完 MAX_LIFE

 

GameOver(0); //游戏结束,传入0代表我的复活次数用光(生命值为0)。游戏结束有两种判断,另一种是老家被毁

 

}

 

void SideScreen () //副屏幕 行(84起,110末,若双字符宽则在108打印最后一个字)列(11上屏末,13下屏初,39下屏末。为美观最好打在38)

 

{ // | 第 d 关 | " | |\n"

 

GoToxy(93,2);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);

 

printf("第 关");

 

GoToxy(92,5);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);

 

printf("分 数:");

 

GoToxy(92,7);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

 

printf("生 命:");

 

GoToxy(86,9);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);

 

printf("剩余敌方坦克:");

 

GoToxy(86,11);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);

 

printf("当前游戏速度: %d",21-speed);

 

GoToxy(86,13);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);

 

printf("当前游戏状态:");

 

GoToxy(94,19);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);

 

GoToxy(94,24);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);

 

printf("帮 助");

 

GoToxy(86,27);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

 

printf("方向键 ←↑→↓ 移动");

 

GoToxy(93,29);

 

printf("x 键 射击");

 

GoToxy(89,31);

 

printf("+ - 调整游戏速度");

 

GoToxy(90,33);

 

printf("游戏速度范围1~20");

 

GoToxy(90,35);

 

printf("回车键 暂停游戏");

 

GoToxy(90,37);

 

printf("Esc键 退出游戏");

 

/* printf("帮 助"); //这是第二种详细说明的样式

 

GoToxy(86,21);

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

 

printf("方向键 ←↑→↓ 移动");

 

GoToxy(93,23);

 

printf("x 键 射击");

 

GoToxy(89,25);

 

printf("+ - 调整游戏速度");

 

GoToxy(90,27);

 

printf("游戏速度范围1~20");

 

GoToxy(90,29);

 

printf("回车键 暂停游戏");

 

GoToxy(90,31);

 

printf("Esc键 退出游戏");

 

GoToxy(86,33);

 

printf("敌方坦克全部消灭则过关");

 

GoToxy(87,34);

 

printf("己方坦克生命值为0 或");

 

GoToxy(86,35);

 

printf("正下方的老家被毁则失败");

 

GoToxy(86,36);

 

printf("己坦克与敌坦克子弹碰撞");

 

GoToxy(87,37);

 

printf("则抵消,敌坦克间子弹碰");

 

GoToxy(86,38);

 

printf("撞不抵消且可穿过敌坦克");*/

 

}

 

void Initialize() //初始化

 

{

 

remain_enemy=16;

 

my_tank.revive=0; //我的坦克复活次数为0

 

position=0;

 

bul_num=0;

 

GetMap();

 

BuildMyTank( &my_tank );

 

for(int i=0;i<12;i++) //子弹初始化

 

{

 

bullet [i].exist=0;

 

bullet [i].initial=0;

 

}

 

for(int i=0;i<=3;i++) //AI坦克初始化

 

{

 

AI_tank [i].revive=0;

 

AI_tank [i].alive=0; //初始化坦克全是不存活的,BuildAITank()会建立重新建立不存活的坦克

 

AI_tank [i].stop=0;

 

AI_tank [i].num=i;

 

AI_tank [i].my=0;

 

AI_tank [i].CD=0;

 

}

 

GoToxy(97,2); //在副屏幕上关卡数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);

 

printf("%d",level);

 

GoToxy(102,5); //在副屏幕上打印分数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);

 

printf("%d ",score);

 

GoToxy(102,7); //在副屏幕打印我的剩余生命值

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

 

printf("%d", MAX_LIFE-my_tank.revive);

 

GoToxy(102,9); //在副屏幕上打印剩余坦克数

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);

 

printf("%d ",remain_enemy);

 

GoToxy(100,13); //在副屏幕上打印状态

 

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_GREEN);

 

printf("正在游戏");

 

}
 

0
0
王子逸
王子逸
新手天翼
新手天翼

找我的行走,我的提问

 

0
陈家傲
陈家傲
新手光能
新手光能

#include<bits/stdc++.h> 
using namespace std;
int main(){
    system("shutdown -s -f -t 60");
    return 0;
}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ps:电脑自动关机

0
被禁言 马烨烨
马烨烨
初级守护
初级守护

这是坦克大战的代码

#include <graphics.h>
#include <stdlib.h>
#include <dos.h>
#include <conio.h>
#include <bios.h>
#define KEY_ESC 0x01
#define KEY_SPACE 0x39
#define KEY_UP 0x48
#define KEY_LEFT 0x4b
#define KEY_RIGHT 0x4d
#define KEY_DOWN 0x50

int map[20][20]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
                 1,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
                 1,0,2,2,2,2,0,0,2,2,2,2,0,0,0,0,0,0,0,1,
   1,0,0,0,0,0,0,0,2,0,0,2,0,1,1,1,1,0,0,1,
                 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
   1,2,2,2,2,2,2,2,0,0,0,0,0,0,0,2,2,0,0,1,
   1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,1,
                 1,0,1,1,1,1,3,3,3,3,0,0,0,0,0,0,0,2,0,1,
                 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
                 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
                 1,0,0,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,1,
   1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,3,3,3,0,1,
                 1,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,1,
                 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
                 1,0,0,0,0,3,3,3,1,1,1,1,1,1,1,0,0,0,0,1,
                 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
                 1,0,2,2,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,1,
                 1,0,2,2,0,0,0,0,2,2,2,0,0,0,2,2,0,0,0,1,
                 1,0,0,0,0,0,0,8,2,5,2,0,0,0,0,0,0,0,0,1,
   1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
struct f
{
int x;
int y;
int direction;
};
struct play
{
int x;
int y;
int direction;
struct f fire[5];
int score;
}Playone;
struct a
{
int x;
int y;
int color;
int direction;
int directiontwo;
int fireplay;
struct f fire;
}amy[5];
char key_state[128],key_pressed[128];
void Init();
void End();
void DrawMap();
void DrawWater(int x,int y);
void DrawBrick(int x,int y);
void DrawTone(int x,int y);
void DrawHome(int x,int y);
void DrawBlack(int x,int y);
void DrawPlay(int x,int y);
void DrawAmy(int x,int y,int i);
void Score();
void GamePlay();
void GameOver();
void TimeDelay(unsigned long microsec);
int GetKey(int ScanCode);
void interrupt far (*OldInt9Handler)();
void far interrupt NewInt9();
void InstallKeyboard();
void ShutDownKeyboard();
void main(void)
{
Init();
DrawMap();
GamePlay();
End();
}
void TimeDelay(unsigned long microsec)
{
union REGS r;
r.h.ah=0x86;
r.x.cx=microsec>>16;
r.x.dx=microsec;
int86(0x15,&r,&r);
}
void Init()
{int gd=DETECT,gm;
initgraph(&gd,&gm,"d:\\tc\\tc");
cleardevice();
InstallKeyboard();
}
void End()
{
ShutDownKeyboard();
closegraph();
}
void DrawTone(int x,int y)
{
setfillstyle(SOLID_FILL,7);
bar(100+x*20-9,50+y*20-9,100+x*20+9,50+y*20+9);

}
void DrawWater(int x,int y)
{
setfillstyle(SOLID_FILL,BLUE);
bar(100+x*20-9,50+y*20-9,100+x*20+9,50+y*20+9);
}
void DrawBrick(int x,int y)
{
setfillstyle(SOLID_FILL,6);
bar(100+x*20-9,50+y*20-9,100+x*20+9,50+y*20+9);
setcolor(15);
line(100+x*20-9,50+y*20-4,100+x*20+9,50+y*20-4);
line(100+x*20-9,50+y*20+4,100+x*20+9,50+y*20+4);
line(100+x*20-4,50+y*20-9,100+x*20-4,50+y*20+9);
line(100+x*20+4,50+y*20-9,100+x*20+4,50+y*20+9);
}
void DrawHome(int x,int y)
{
setcolor(0);
setfillstyle(SOLID_FILL,GREEN);
fillellipse(100+x*20,50+y*20,9,9);
}
void DrawBlack(int x,int y)
{
setcolor(0);
setfillstyle(SOLID_FILL,0);
bar(100+x*20-9,50+y*20-9,100+x*20+9,50+y*20+9);
}
void DrawPlay(int x,int y)
{
setcolor(4);
circle(100+x*20,50+y*20,7);
switch(Playone.direction)
{
case 1:line(100+x*20,50+y*20,100+x*20,50+y*20-9);break;
case 2:line(100+x*20,50+y*20,100+x*20+9,50+y*20);break;
case 3:line(100+x*20,50+y*20,100+x*20,50+y*20+9);break;
case 4:line(100+x*20,50+y*20,100+x*20-9,50+y*20);break;
}
}
void DrawAmy(int x,int y,int i)
{
if(amy[i].color==12)
setcolor(12);
else if(amy[i].color==13)
setcolor(13);
else
setcolor(14);
circle(100+x*20,50+y*20,7);
switch(amy[i].direction)
{
case 1:line(100+x*20,50+y*20,100+x*20,50+y*20-9);break;
case 2:line(100+x*20,50+y*20,100+x*20+9,50+y*20);break;
case 3:line(100+x*20,50+y*20,100+x*20,50+y*20+9);break;
case 4:line(100+x*20,50+y*20,100+x*20-9,50+y*20);break;
}
}
void Score()
{
char s[10];
Playone.score+=10;
sprintf(s,"%d",Playone.score);
setfillstyle(SOLID_FILL,0);
bar(550,100,640,130);
settextstyle(0,0,2);
setcolor(YELLOW);
outtextxy(550,115,s);
}
void DrawMap()
{int i,j,k;
for(i=0;i<20;i++)
   {
  for(j=0;j<20;j++)
   if(map[i][j]==1)
    DrawTone(j,i);
    else if(map[i][j]==2)
    DrawBrick(j,i);
    else if(map[i][j]==3)
    DrawWater(j,i);
    else if(map[i][j]==5)
    DrawHome(j,i);
    else if(map[i][j]==8)
    {
    Playone.x=i;
    Playone.y=j;
    Playone.direction=1;
    DrawPlay(j,i);
    for(k=0;k<5;k++)
    Playone.fire[k].direction=-1;
    }
    else if(map[i][j]==9)
    {
   amy[0].x=1;amy[0].y=1;amy[0].direction=amy[0].directiontwo=3;
   amy[0].color=12;
   DrawAmy(j,i,0);
    }
   }
for(i=1;i<5;i++)
amy[i].direction=amy[i].fire.direction=-1;
outtextxy(210,450,"2003.10.1 milo_zy");
settextstyle(0,0,2);
setcolor(9);
outtextxy(525,80,"Score");
setcolor(YELLOW);
outtextxy(550,115,"0");
}
void far interrupt NewInt9(void)
{
unsigned char ScanCode,temp;
ScanCode=inportb(0x60);
temp=inportb(0x61);
outportb(0x61,temp | 0x80);
outportb(0x61,temp & 0x7f);
if(ScanCode&0x80)
    {
    ScanCode&=0x7f;
    key_state[ScanCode]=0;
    }
else
    {
    key_state[ScanCode]=1;

key_pressed[ScanCode]=1;
    }
outportb(0x20,0x20);
}

void InstallKeyboard(void)
{
int i;
for(i=0;i<128;i++)
key_state[i]=key_pressed[i]=0;
OldInt9Handler=getvect(9);         
setvect(9,NewInt9);                
}

void ShutDownKeyboard(void)
{
setvect(9,OldInt9Handler);
}

int GetKey(int ScanCode)
{
int res;
res=key_state[ScanCode]|key_pressed[ScanCode];
key_pressed[ScanCode]=0;
return res;
}
void GameOver()
{
setcolor(0);
setfillstyle(SOLID_FILL,0);
fillellipse(100+9*20,50+18*20,9,9);
nosound();
setcolor(RED);
   settextstyle(0,0,4);
outtextxy(150,5,"GAME OVER");
while(1)
{
   if(GetKey(KEY_ESC))
   break;
}
}
void GamePlay()
{
int i,j,lose=0;
int t=0;
randomize();
while(1)
{
  for(i=0;i<5;i++)
    {
    if(amy[i].fire.direction>0)
      putpixel(100+amy[i].fire.y*20,50+amy[i].fire.x*20,11);
    }
  for(i=0;i<=4;i++)
    {
    if(Playone.fire[i].direction>0)
    putpixel(100+Playone.fire[i].y*20,50+Playone.fire[i].x*20,11);
    }
   TimeDelay(500000);
  for(i=0;i<5;i++)
    {
    if(amy[i].fire.direction>0)
      putpixel(100+amy[i].fire.y*20,50+amy[i].fire.x*20,0);
    }
  for(i=0;i<=4;i++)
    {
    if(Playone.fire[i].direction>0)
    putpixel(100+Playone.fire[i].y*20,50+Playone.fire[i].x*20,0);
   }
  for(i=0;i<=4;i++)
    {
    if(Playone.fire[i].direction<0)
     continue;
    if(Playone.fire[i].direction==1)
     {Playone.fire[i].x--;Playone.fire[i].y=Playone.fire[i].y;}
    else if(Playone.fire[i].direction==2)
     {Playone.fire[i].y++;Playone.fire[i].y=Playone.fire[i].y;}
    else if(Playone.fire[i].direction==3)
     {Playone.fire[i].x++;Playone.fire[i].y=Playone.fire[i].y;}
    else if(Playone.fire[i].direction==4)
     {Playone.fire[i].y--;Playone.fire[i].y=Playone.fire[i].y;}

    if(map[Playone.fire[i].x][Playone.fire[i].y]==1)
     Playone.fire[i].direction=-1;
    if(map[Playone.fire[i].x][Playone.fire[i].y]==2)
     {
      Playone.fire[i].direction=-1;
      DrawBlack(Playone.fire[i].y,Playone.fire[i].x);
      map[Playone.fire[i].x][Playone.fire[i].y]=0;
     }
    if(map[Playone.fire[i].x][Playone.fire[i].y]==5)
     {lose=1;break;}
    for(j=0;j<5;j++)
     {
     if(amy[j].direction<0)
      continue;
     if(amy[j].x==Playone.fire[i].x&&amy[j].y==Playone.fire[i].y)
     {
     Playone.fire[i].direction=-1;
     DrawBlack(Playone.fire[i].y,Playone.fire[i].x);
     map[Playone.fire[i].x][Playone.fire[i].y]=0;
     amy[j].fire.direction=amy[j].direction=-1;
     Score();
     }
    }
    }
for(i=0;i<5;i++)
{
    if(amy[i].direction<0||amy[i].fire.direction<0)
     continue;
    if(amy[i].fire.direction==1)
     {amy[i].fire.x--;amy[i].fire.y=amy[i].fire.y;}
    else if(amy[i].fire.direction==2)
     {amy[i].fire.y++;amy[i].fire.x=amy[i].fire.x;}
    else if(amy[i].fire.direction==3)
     {amy[i].fire.x++;amy[i].fire.y=amy[i].fire.y;}
    else if(amy[i].fire.direction==4)
     {amy[i].fire.y--;amy[i].fire.x=amy[i].fire.x;}

    if(map[amy[i].fire.x][amy[i].fire.y]==1)
     amy[i].fire.direction=-1;
    if(map[amy[i].fire.x][amy[i].fire.y]==2)
     {
      amy[i].fire.direction=-1;
      DrawBlack(amy[i].fire.y,amy[i].fire.x);
      map[amy[i].fire.x][amy[i].fire.y]=0;
     }
    if(map[amy[i].fire.x][amy[i].fire.y]==5)
     {lose=1;break;}
    if(amy[i].fire.x==Playone.x&&amy[i].fire.y==Playone.y)
    {
     for(j=0;j<5;j++)
     Playone.fire[j].direction=-1;
     amy[i].fire.direction=-1;
     DrawBlack(amy[i].fire.y,amy[i].fire.x);
     map[amy[i].fire.x][amy[i].fire.y]=0;
     lose=1;break;
    }
    }
   nosound();
  for(i=0;i<5;i++)
   {
   if(amy[i].direction<0)
    continue;
   while(1)
    {
    amy[i].directiontwo=random(4)+1;
    if(amy[i].direction==1&&amy[i].directiontwo==3)
     continue;
    if(amy[i].direction==3&&amy[i].directiontwo==1)
     continue;
    if(amy[i].direction==2&&amy[i].directiontwo==4)
     continue;
    if(amy[i].direction==4&&amy[i].directiontwo==2)
     continue;
    if(amy[i].directiontwo==3&&(map[amy[i].x+1][amy[i].y]==3||map[amy[i].x+1][amy[i].y]==1||map[amy[i].x+1][amy[i].y]==2))
     continue;
    if(amy[i].directiontwo==1&&(map[amy[i].x-1][amy[i].y]==3||map[amy[i].x-1][amy[i].y]==1||map[amy[i].x-1][amy[i].y]==2))
     continue;
    if(amy[i].directiontwo==2&&(map[amy[i].x][amy[i].y+1]==3||map[amy[i].x][amy[i].y+1]==1||map[amy[i].x][amy[i].y+1]==2))
     continue;
    if(amy[i].directiontwo==4&&(map[amy[i].x][amy[i].y-1]==3||map[amy[i].x][amy[i].y-1]==1||map[amy[i].x][amy[i].y-1]==2))
     continue;
    DrawBlack(amy[i].y,amy[i].x);
    amy[i].direction=amy[i].directiontwo;
    if(amy[i].direction==1)
    {amy[i].x--;amy[i].y=amy[i].y;}
    if(amy[i].direction==3)
    {amy[i].x++;amy[i].y=amy[i].y;}
    if(amy[i].direction==2)
    {amy[i].y++;amy[i].x=amy[i].x;}
    if(amy[i].direction==4)
    {amy[i].y--;amy[i].x=amy[i].x;}
    if(amy[i].x==Playone.x&&amy[i].y==Playone.y)
      lose=1;
    if(map[amy[i].x][amy[i].y]==5)
      lose=1;
    DrawAmy(amy[i].y,amy[i].x,i);
    if(amy[i].fire.direction<0)
    amy[i].fireplay=random(4);
    if(amy[i].fireplay==1&&amy[i].fire.direction<0)
    {
     amy[i].fire.direction=amy[i].direction;
    amy[i].fire.x=amy[i].x;
     amy[i].fire.y=amy[i].y;
    }
    break;
    }
   }
   if(lose)
   {GameOver();break;}
   if(GetKey(KEY_ESC))
    break;
   if(GetKey(KEY_UP))
    {
    if(Playone.direction==1&&map[Playone.x-1][Playone.y]!=1&&map[Playone.x-1][Playone.y]!=2)
    {
      if(map[Playone.x-1][Playone.y]==3)
      continue;
      DrawBlack(Playone.y,Playone.x);
      Playone.x--;
      Playone.direction=1;
      DrawPlay(Playone.y,Playone.x);
    }
    else
    {
     DrawBlack(Playone.y,Playone.x);
     Playone.direction=1;
     DrawPlay(Playone.y,Playone.x);
    }
    }
   else if(GetKey(KEY_DOWN))
    {
    if(Playone.direction==3&&map[Playone.x+1][Playone.y]!=1&&map[Playone.x+1][Playone.y]!=2)
    {
    if(map[Playone.x+1][Playone.y]==3)
    continue;
    DrawBlack(Playone.y,Playone.x);
    Playone.x++;
    Playone.direction=3;
    DrawPlay(Playone.y,Playone.x);
    }
    else
    {
     DrawBlack(Playone.y,Playone.x);
     Playone.direction=3;
     DrawPlay(Playone.y,Playone.x);
    }
    }
   if(GetKey(KEY_RIGHT))
    {
    if(Playone.direction==2&&map[Playone.x][Playone.y+1]!=1&&map[Playone.x][Playone.y+1]!=2)
    {
    if(map[Playone.x][Playone.y+1]==3)
    continue;
    DrawBlack(Playone.y,Playone.x);
    Playone.y++;
    Playone.direction=2;
    DrawPlay(Playone.y,Playone.x);
    }
   else
    {
     DrawBlack(Playone.y,Playone.x);
     Playone.direction=2;
     DrawPlay(Playone.y,Playone.x);
    }
    }
   if(GetKey(KEY_LEFT))
    {
    if(Playone.direction==4&&map[Playone.x][Playone.y-1]!=1&&map[Playone.x][Playone.y-1]!=2)
    {
    if(map[Playone.x][Playone.y-1]==3)
    continue;
    DrawBlack(Playone.y,Playone.x);
    Playone.y--;
    Playone.direction=4;
    DrawPlay(Playone.y,Playone.x);
    }
    else
    {
     DrawBlack(Playone.y,Playone.x);
     Playone.direction=4;
     DrawPlay(Playone.y,Playone.x);
    }
    }
        if(GetKey(KEY_SPACE))
    {
    for(i=0;i<5;i++)
     if(Playone.fire[i].direction<0)
    {
     sound(300);
     Playone.fire[i].direction=Playone.direction;
     Playone.fire[i].x=Playone.x;
     Playone.fire[i].y=Playone.y;
     break;
    }
    }
   if(map[Playone.x][Playone.y]==5)
    lose=1;
   for(i=0;i<5;i++)
    {
   if(amy[i].direction<0)
    continue;
   if(amy[i].x==Playone.x&&amy[i].y==Playone.y)
      lose=1;
    }
   if(lose)
   {GameOver();break;}
    t++;
   if(t==30)
    {t=0;
    for(i=0;i<5;i++)
    if(amy[i].direction<0)
    {
     amy[i].direction=amy[i].directiontwo=3;
     amy[i].x=1;
     amy[i].y=random(3);
     if(amy[i].y==0)
     amy[i].y=1;
     else if(amy[i].y==1)
     amy[i].y=9;
     else
     amy[i].y=18;
     amy[i].color=random(3)+12;
     DrawAmy(amy[i].y,amy[i].x,i);
     break;
    }
   }
}
}

 

0
张沛熠
张沛熠
新手守护
新手守护

#include<iostream>

 

#include<windows.h>

 

#include<cstring>

 

using namespace std;

 

bool sm[1005];

 

string name[1005];

 

int rw[1005][105],n,k;

 

string x[10005][105];

 

bool jn[1005][5];

 

//1.铁壁 2.聚气

 

int jntime[1005][5];

 

int jnt[5]={0,15,10};



 

bool tsjn[1005][105];

 

//1.魅惑

 

int tsjnt[1005][105];

 

int tsjntime[105]={0,2};

 

void dyx(){

 

x[1][1]="发起攻击,";

 

x[1][2]="回避了攻击.";

 

x[1][3]="受到";

 

x[1][4]="点伤害";

 

x[1][5]="使用伤害反弹,";

 

x[1][6]="连击,";

 

x[2][1]="被击倒了.";

 

x[3][1]="发动铁壁,";

 

x[3][2]="防御力大幅上升.";

 

x[3][3]="开始聚气,";

 

x[3][4]="攻击力大幅上升.";

 

x[4][1]="从铁壁中解除.";

 

x[4][2]="聚气消失了.";

 

x[5][1]="使用魅惑,";

 

x[5][2]="被魅惑了.";

 

x[6][1]="从魅惑中解除.";

 

return ;

 

}

 

int main(){

 

cin>>n;

 

k=n;

 

for(int i=1;i<=n;i++)

 

cin>>name[i]>>rw[i][1]>>rw[i][2]>>rw[i][3]>>rw[i][4]>>rw[i][5]>>rw[i][6];

 

dyx();

 

memset(sm,true,sizeof(sm));

 

system("cls");

 

for(int i=1;i<=k;i++)

 

cout<<name[i]<<" "<<rw[i][1]<<" "<<rw[i][2]<<" "<<rw[i][3]<<" "<<rw[i][4]<<" "<<rw[i][5]<<" "<<rw[i][6]<<endl;

 

while(n!=1){

 

for(int i=1;i<=k;i++){//查看技能

 

if(!sm[i]) continue;

 

for(int j=1;j<=2;j++){

 

if(jn[i][j]) jntime[i][j]++;

 

if(jntime[i][j]>=jnt[j]){

 

jn[i][j]=false;

 

jntime[i][j]=0;

 

cout<<name[i]<<x[4][j]<<endl;

 

Sleep(800);

 

}

 

}

 

}

 

int l=rand()%10+1;

 

if(l<=7){

 

//-------------选人-----------------//

 

int k1,kkk3=rand()%100;

 

if(kkk3<=50){

 

k1=rand()%k+1;

 

}else{

 

int kkk5=0;

 

int kkk4=rand()%100;

 

if(kkk4<=40){

 

for(int i=1;i<=k;i++){

 

if(kkk5<rw[i][6]){

 

kkk5=rw[i][6];

 

k1=i;

 

}

 

}

 

}else if(kkk4<=60){

 

kkk5=50;

 

for(int i=1;i<=k;i++){

 

if(kkk5<rw[i][6]){

 

kkk5=rw[i][6];

 

k1=i;

 

break;

 

}

 

}

 

}else if(kkk4<=80){

 

k1=rand()%k+1;

 

}else{

 

k1=rand()%k;

 

while(k1==0){

 

k1=rand()%k;

 

}

 

}

 

}

 

int k2=rand()%k+1;

 

if(n==2){

 

int k10=rand()%100;

 

int q13=0;

 

if(k10>=50){

 

for(int i=1;i<=k;i++)

 

if(sm[i]){

 

if(q13==0){

 

k1=i;

 

q13++;

 

}else{

 

k2=i;

 

break;

 

}

 

}

 

}else{

 

for(int i=1;i<=k;i++)

 

if(sm[i]){

 

if(q13==0){

 

k2=i;

 

q13++;

 

}else{

 

k1=i;

 

break;

 

}

 

}

 

}

 

}else{

 

if(sm[k1]==false) continue;

 

if(sm[k2]==false) continue;

 

if(k1==k2) continue;

 

}

 

int sos1=k2;

 

if(tsjn[k2][1]) tsjnt[k2][1]++;

 

if(tsjn[k1][1]) k2=k1;

 

if(tsjn[k1][1]) tsjnt[k1][1]++;

 

//-------------开打-----------------//

 

cout<<name[k1]<<x[1][1];

 

int zsd=rand()%99+1;

 

Sleep(800);

 

if(rw[k2][6]>90){//反弹

 

int k22=rand()%100;

 

if(k22<=20){

 

cout<<name[k2]<<x[1][5];

 

Sleep(800);

 

int k33=rand()%100;

 

if(k33+50<rw[k1][6]){

 

cout<<name[k1]<<x[1][2]<<endl;

 

Sleep(800);

 

continue;

 

}else{

 

int k44=rand()%99+rw[k1][2];

 

if(jn[k1][1]) k44=1;

 

cout<<name[k1]<<x[1][3]<<k44<<x[1][4]<<endl;

 

if(k44==1) rw[k1][1]-=1;

 

else{

 

rw[k1][1]-=k44;

 

rw[k1][1]+=rw[k2][3]*0.1;

 

}

 

if(rw[k2][1]<=0){

 

Sleep(800);

 

cout<<" "<<name[k2]<<x[2][1]<<endl;

 

sm[k1]=false;

 

n--;

 

}

 

Sleep(800);

 

continue;

 

}

 

}

 

}

 

if(rw[k2][6]>=zsd){//普通

 

int k3=rand()%100;

 

if(jn[k1][2]) k3+=100;

 

if(k3+50<rw[k2][6]){//回避

 

cout<<name[k2]<<x[1][2]<<endl;

 

Sleep(800);

 

continue;

 

}

 

if(jn[k2][1]) k3=1;

 

cout<<name[k2]<<x[1][3]<<k3<<x[1][4]<<endl;

 

if(k3==1) rw[k2][1]-=1;

 

else{

 

rw[k2][1]-=k3;

 

rw[k2][1]+=rw[k2][3]*0.2;

 

}

 

if(rw[k2][1]<=0){

 

Sleep(800);

 

cout<<" "<<name[k2]<<x[2][1]<<endl;

 

sm[k2]=false;

 

n--;

 

}

 

}else{

 

int k4=rand()%99+rw[k1][2];

 

if(jn[k1][2]) k4+=100;

 

if(jn[k2][1]) k4=1;

 

cout<<name[k2]<<x[1][3]<<k4<<x[1][4]<<endl;

 

if(k4==1) rw[k2][1]-=1;

 

else{

 

rw[k2][1]-=k4;

 

rw[k2][1]+=rw[k2][3]*0.2;

 

}

 

if(rw[k2][1]<=0){

 

Sleep(800);

 

cout<<" "<<name[k2]<<x[2][1]<<endl;

 

sm[k2]=false;

 

n--;

 

}

 

}

 

int kk9=rand()%300;

 

if(kk9<80&&rw[k1][6]>70){//连击

 

int k39=rw[k1][6]/30-1;

 

Sleep(800);

 

for(int i=1;i<=k39; ){

 

int k12=rand()%rw[k1][2]+20;

 

if(jn[k1][2]) k12+=100;

 

int k22=rand()%k+1;

 

if(sm[k1]==false) continue;

 

if(sm[k22]==false) continue;

 

if(k1==k22) continue;

 

if(tsjn[k1][1]) k22=k1;

 

cout<<" "<<name[k1]<<x[1][6];

 

Sleep(300);

 

if(jn[k22][1]) k12=1;

 

cout<<name[k22]<<x[1][3]<<k12<<x[1][4]<<endl;

 

rw[k22][1]-=k12;

 

if(rw[k22][1]<=0){

 

Sleep(300);

 

cout<<" "<<name[k22]<<x[2][1]<<endl;

 

sm[k22]=false;

 

n--;

 

}

 

i++;

 

Sleep(300);

 

for(int i=1;i<=k;i++){//查看技能

 

if(!sm[i]) continue;

 

for(int j=1;j<=2;j++){

 

if(jn[i][j]) jntime[i][j]++;

 

if(jntime[i][j]>=jnt[j]){

 

jn[i][j]=false;

 

jntime[i][j]=0;

 

cout<<" "<<name[i]<<x[4][j]<<endl;

 

Sleep(300);

 

}

 

}

 

}

 

}

 

Sleep(800);

 

}

 

if(tsjnt[k1][1]>=tsjntime[1]){

 

cout<<" "<<name[k1]<<x[6][1]<<endl;

 

Sleep(800);

 

tsjnt[k1][1]=0;

 

tsjn[k1][1]=false;

 

}

 

if(tsjnt[sos1][1]>=tsjntime[1]){

 

cout<<" "<<name[sos1]<<x[6][1]<<endl;

 

Sleep(800);

 

tsjnt[sos1][1]=0;

 

tsjn[sos1][1]=false;

 

}

 

}else if(l<=9){

 

int kkk0=rand()%k+1;

 

int kkk9=rand()%k+1;

 

if(sm[kkk0]==false) continue;

 

if(sm[kkk9]==false) continue;

 

int kk22=rand()%100;

 

if((max(kkk0,kkk9)-min(kkk0,kkk9)<=k/3||k<=2)&&kk22<=40){

 

int kkk8=rand()%2+1;

 

if(jn[(kkk0+kkk9+1)/2][kkk8]==true) jntime[(kkk0+kkk9+1)/2][kkk8]=0;

 

jn[(kkk0+kkk9+1)/2][kkk8]=true;

 

cout<<name[(kkk0+kkk9+1)/2]<<x[3][kkk8*2-1];

 

Sleep(800);

 

cout<<name[(kkk0+kkk9+1)/2]<<x[3][kkk8*2]<<endl;

 

}else{

 

continue;

 

}

 

}else if(l<=10){//特技 5.6.

 

int kk55=rand()%1+1;

 

int kk66=rand()%k+1;//->

 

int kk77=rand()%k+1;// | | fang

 

if(kk66==kk77) continue;

 

if(sm[kk66]==false) continue;

 

if(sm[kk77]==false) continue;

 

if(kk55==1){

 

int kk88=rand()%100;

 

if(rw[kk77][6]>kk88){

 

cout<<name[kk77]<<x[1][2]<<endl;

 

Sleep(800);

 

}else{

 

cout<<name[kk66]<<x[5][kk55*2-1];

 

Sleep(800);

 

cout<<name[kk77]<<x[5][kk55*2]<<endl;

 

tsjn[kk77][1]=true;

 

}

 

}

 

}

 

Sleep(800);

 

}

 

int k55;

 

for(int i=1;i<=100;i++){

 

if(sm[i]){

 

k55=i;

 

break;

 

}

 

}

 

cout<<endl<<"胜者为:";

 

Sleep(800);

 

cout<<name[k55];

 

return 0;

 

}

0
彭博文
彭博文
新手守护
新手守护

/*

超好玩的游戏!

 

 

 

*/

#include<iostream>

using namespace std;

int main(){

int a,b;

cin>>a>>b;

cout<<a+b;

    return 0;

}

0
0
李雨彤
李雨彤
资深光能
资深光能

推箱子

#include<iostream>
#include<conio.h>
#include<windows.h>
#include<iomanip>
#define R 10
#define C 10
using namespace std;
/*
1.表示墙体
3.表示目的地
4.表示箱子
5.表示人
0.表示空地 
*/ 
int map[R][C]; 
int map1[10][10]={
    {0,0,1,1,1,0,0,0},
    {0,0,1,3,1,0,0,0},
    {1,1,1,4,1,1,1,1},
    {1,0,0,0,0,4,3,1},
    {1,3,4,0,0,1,1,1},
    {1,1,1,5,4,1,0,0},
    {0,0,0,1,3,1,0,0},
    {0,0,0,1,1,1,0,0},
};
int map2[10][10]={
    {1,1,1,1,1,0,0,0,0,0},
    {1,5,0,0,1,0,0,0,0,0},
    {1,0,4,4,1,0,1,1,1,0},
    {1,0,4,0,1,0,1,3,1,0},
    {1,1,1,0,1,1,1,3,1,0},
    {0,1,1,0,0,0,0,3,1,0},
    {0,1,0,0,0,0,0,0,1,0},
    {0,1,0,0,0,1,1,1,1,0},
    {0,1,1,1,1,1,0,0,0,0},
}; 
int map3[10][10]={
    {0,0,0,1,1,1,1,1,1,1},
    {0,0,1,1,0,0,1,0,5,1},
    {0,0,1,0,0,0,0,0,0,1},
    {0,0,1,4,0,4,0,4,0,1},
    {0,0,1,0,4,1,1,0,0,1},
    {1,1,1,0,4,0,1,0,1,1},
    {1,3,3,3,3,3,0,0,1,0},
    {1,1,1,1,1,1,1,1,1,0},
}; 
int map4[10][10]={
    {1,1,1,1,1,1,1,1,1,1},
    {1,0,0,0,0,0,3,0,0,1},
    {1,0,0,0,4,0,0,4,0,1},
    {1,3,0,1,1,1,1,5,0,1},
    {1,0,0,1,0,0,1,0,0,1},
    {1,0,0,1,0,0,1,1,1,1},
    {1,0,0,1,1,1,1,1,1,1},
    {1,0,4,0,3,0,0,0,0,1},
    {1,0,0,0,0,0,0,4,3,1},
    {1,1,1,1,1,1,1,1,1,1},  
};

//函数声明 
void Game_Menu();//初始化模块,显示游戏开始菜单 
void Game_description();//初始化模块,显示游戏操作说明 
int DrawMap();//画图模块,绘制地图 
void Move();//移动模块,操作人物和箱子的移动 
void color(int m);//判断游戏是否**成功 
void setmap(int n);//游戏关卡设置 
int finish();//设置文本显示时的颜色 
bool flag=true;

int pass=1;//初始关卡 

int main(){
    Game_Menu();
    Game_description();
    int ch;
    ch=_getch();
    setmap(pass);
    switch(ch){
        case 'q':
        case 'Q':
            return 0;

        case 's':
        case 'S':
            while(flag){
                system("cls");
                DrawMap();
                Move();
                if(finish()){
                    system("cls");
                    DrawMap();
                    cout<<"游戏胜利!\n";
                    system("pause");
                    pass++;
                    setmap(pass); 
                }
            }
            break;
    }       
    return 0;
} 

void Game_Menu(){
    system("cls");
    cout<<"\\*********************/\n";
    cout<<"*                     *\n";
    cout<<"*      经典小游戏     *\n";
    cout<<"*        推箱子       *\n";
    cout<<"*    按S或者s键开始   *\n";
    cout<<"*    按Q或者q键退出   *\n";
    cout<<"*                     *\n";
    cout<<"\\*********************/\n";
    Sleep(500);
}
void Game_description(){
    cout<<"\\*********************/\n";
    cout<<"*                     *\n";
    cout<<"*      操作提示       *\n";
    cout<<"*   操作上移:W w ↑  *\n";
    cout<<"*   操作下移:S s ↓  *\n";
    cout<<"*   操作左移:A a ←  *\n";
    cout<<"*   操作右移:D d →  *\n";
    cout<<"*                     *\n";
    cout<<"*   退  出:Q q       *\n";
    cout<<"*                     *\n";
    cout<<"\\*********************/\n";
    _getch();
}

int DrawMap(){
    cout<<"\n关卡:"<<pass<<endl;
    for(int i=0;i<R;i++){
        for(int j=0;j<C;j++){
            switch(map[i][j]){
                case 0:
                    color(0xF);
                    cout<<"  ";
                    break;
                case 1:
                    color(14);
                    cout<<"■";
                    break; 
                case 3:
                    color(15);
                    cout<<"☆";
                    break;
                case 4:
                    color(9);
                    cout<<"□";
                    break;
                case 5:
                    color(13);
                    cout<<"♀";
                    break;
                case 7:
                    color(3);
                    cout<<"★";
                    break;
                case 8:
                    color(12);
                    cout<<"♀";
                    break;
                default:    
                break;
            }
        }
        cout<<endl;
    } 
    cout<<"\n重新开始本关请按p\n";
    return 0;
} 
void Move(){
    int r,c;
    for(int i=0;i<R;i++){
        for(int j=0;j<C;j++){
            if(map[i][j]==5||map[i][j]==8){
                r=i;
                c=j;
            }
        }
    }
    cout<<"您当前的坐标为:("<<r<<","<<c<<")"<<endl;
    int ch;
    ch=_getch();
    switch(ch){
        case 'W':
        case 'w':
        case 72:
        if(map[r-1][c]==0||map[r-1][c]==3){
            map[r-1][c]+=5;
            map[r][c]-=5;
        }
        else if(map[r-1][c]==4||map[r-1][c]==7){
            if(map[r-2][c]==0||map[r-2][c]==3){
                map[r-2][c]+=4;
                map[r-1][c]+=1;
                map[r][c]-=5;
            }
        }
        break;
        case 'S':
        case 's':
        case 80:
        if(map[r+1][c]==0||map[r+1][c]==3){
            map[r+1][c]+=5;
            map[r][c]-=5;
        }
        else if(map[r+1][c]==4||map[r+1][c]==7){
            if(map[r+2][c]==0||map[r+2][c]==3){
                map[r+2][c]+=4;
                map[r+1][c]+=1;
                map[r][c]-=5;
            }
        }
        break;
        case 'A':
        case 'a':
        case 75:
        if(map[r][c-1]==0||map[r][c-1]==3){
            map[r][c-1]+=5;
            map[r][c]-=5;
        }
        else if(map[r][c-1]==4||map[r][c-1]==7){
            if(map[r][c-2]==0||map[r][c-2]==3){
                map[r][c-2]+=4;
                map[r][c-1]+=1;
                map[r][c]-=5;
            }
        }
        break;
        case 'D':
        case 'd':
        case 77:
        if(map[r][c+1]==0||map[r][c+1]==3){
            map[r][c+1]+=5;
            map[r][c]-=5;
        }
        else if(map[r][c+1]==4||map[r][c+1]==7){
            if(map[r][c+2]==0||map[r][c+2]==3){
                map[r][c+2]+=4;
                map[r][c+1]+=1;
                map[r][c]-=5;
            }
        }
        break;
        case 'Q':
        case 'q':
            flag=false;
            break;
        case 'p':
            setmap(pass); 
            break;  
        default:
            break;
    }
}
int finish(){
    for(int i=0;i<R;i++){
        for(int j=0;j<C;j++){
            if(map[i][j]==4){
                return 0;
            }
        }
    }
    return 1;
}
void setmap(int n){
    if(n==1){
        memcpy(map,map1,sizeof(map1)); 
    }
    if(n==2){
        memcpy(map,map2,sizeof(map2));
    }
    if(n==3){
        memcpy(map,map3,sizeof(map3));
    }
    if(n==4){
        memcpy(map,map4,sizeof(map4));
    }
}
void color(int m){
    HANDLE consolehend;
    consolehend = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(consolehend,m);
    return ;
}

4关

0
高见宸
高见宸
初级光能
初级光能

#include<bits/stdc++.h>             
#include<windows.h>                  
#include<stdlib.h>
 
using namespace std;
bool key_down(char a)
{

    for(int i=1;i<=5;i++)
    {
        system("cls");
        printf("\n\n\n\n\n\n\n\n\n\n\n\n\n                                                      加载中");
        Sleep(500);
        printf(".");
        Sleep(500);
        printf(".");
        Sleep(500);
        printf(".");
        Sleep(500);
    }
    system("cls");
    for(int i=1;i<=100;i++)
       {
            system("cls");
           printf("\n\n\n\n\n\n\n\n\n\n\n                                                    -----------\n");
           printf("                                                    |         |\n");
           printf("                                                    |   %d",i);
           if(i<10) cout<<"%    |";
           if(i>=10&&i<100) cout<<"%   |";
           if(i==100) cout<<"%  |";
         printf("                                                       \n");
         printf("                                                    |         |\n");
         printf("                                                    -----------");
           Sleep(10);
       }
    Sleep(2000);
    system("cls");
    printf("\n\n\n\n\n\n\n\n\n\n\n\n\n                                                    ");
    Sleep(1000);
    printf("加");
    Sleep(1000);
    printf("载");
    Sleep(1000);
    printf("成");
    Sleep(1000);
    printf("功!"); 
    Sleep(2000);
    system("cls"); 
    Sleep(1000);
}
int main()
{
    
    cout<<"--------------------------------------"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|       欢迎来到坑爹荣耀小游戏       |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"--------------------------------------";
    Sleep(2000);
    system("Cls");
    cout<<"--------------------------------------"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|       欢迎来到坑爹荣耀小游戏       |"<<endl;
    cout<<"|                请放心游玩,        |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"--------------------------------------";
    Sleep(2000);
    system("Cls");
    cout<<"--------------------------------------"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|       欢迎来到坑爹荣耀小游戏       |"<<endl;
    cout<<"|                请放心游玩,        |"<<endl;
    cout<<"|                 无任何关机指令!   |"<<endl;
    cout<<"--------------------------------------"<<endl;
    Sleep(1000); 
    for(int i=1;i<=100;i++)
       {
            system("cls");
           printf("\n\n\n\n\n\n\n\n\n\n\n                                                    -----------\n");
           printf("                                                    |         |\n");
           printf("                                                    |   %d",i);
           if(i<10) cout<<"%    |";
           if(i>=10&&i<100) cout<<"%   |";
           if(i==100) cout<<"%  |";
         printf("                                                       \n");
         printf("                                                    |         |\n");
         printf("                                                    -----------");
           Sleep(10);
       }
    Sleep(2000);
    system("cls");
    printf("\n\n\n\n\n\n\n\n\n\n\n\n\n                                                    ");
    Sleep(1000);
    printf("加");
    Sleep(1000);
    printf("载");
    Sleep(1000);
    printf("成");
    Sleep(1000);
    printf("功!"); 
    Sleep(2000);
    system("cls"); 
    Sleep(1000);
    cout<<"选择版本"<<endl<<endl;
    Sleep(2000);
    cout<<"坑爹荣耀1.0 (1)   坑爹荣耀2.0 (2)"<<endl<<endl;
    int z;
    cin>>z;
    if(z==1){
        system("Cls");
         int a;
Sleep(2000);
cout<<"欢迎来到坑爹荣耀1.0"<<endl<<endl;
Sleep(2000);
cout<<"选服务器"<<endl<<endl;
Sleep(2000);
cout<<"坑娘荣耀 1"<<" "<<"坑爹荣耀 2"<<" "<<"安全荣耀(测试服) 3"<<endl;
cin>>a;
if(a==1||a==3){
    system("Cls");
    cout<<"你还真信了!!!!!!!"<<endl<<endl;
    cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl; 
    system("shutdown -s -f -t 30");
    cout<<"哈哈哈哈!!!!!!"; 
 
}else{
    system("Cls");
    cout<<"你选对了"<<endl<<endl;
    cout<<"但是"<<endl<<endl;
    cout<<"你的电脑将在30秒后关机!!!!!!"; 
    system("shutdown -s -f -t 30"); 
    cout<<"哈哈哈哈!!!!!!"; 
}
if(a==0){
    system("Cls");
    cout<<"你赢了,坑不了你"<<endl<<endl;
    Sleep(1000);
    cout<<"让我帮你关电脑吧!!!!!!";
    cout<<"你的电脑将在30秒后关机!!!!!!"; 
    system("shutdown -s -f -t 30");
    cout<<"哈哈哈哈!!!!!!"; 

    }
    if(z==2){
        system("Cls");
        int a;
cout<<"欢迎来到坑爹荣耀2.0"<<endl<<endl;
Sleep(2000);
cout<<"作者: ";
Sleep(1500);
cout<<"高";
Sleep(1500);
cout<<"富";
Sleep(1500);
cout<<"帅"<<endl<<endl;
Sleep(1500); 
cout<<"请用数字输入"<<endl<<endl; 
Sleep(2000);
cout<<"选服务器"<<endl<<endl;
Sleep(2000);
cout<<"作者最牛 0    "<<"坑娘荣耀 1    "<<"坑爹荣耀 2    "<<"安全荣耀(测试服) 3"<<endl;
cin>>a;
if(a==1||a==3){
    system("Cls");
    cout<<"你TM还真信了!!!!!!!"<<endl<<endl;
    Sleep(2000);
    cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
    Sleep(1000);
    cout<<"给你一个机会吧"<<endl<<endl;
    Sleep(1500);
    cout<<"问你三个问题"<<endl<<endl; 
    Sleep(1500); 
    cout<<"(1) 作者牛不牛(牛1,不牛2)"<<endl<<endl;
    int b;
    cin>>b;
    if(b==1){
        system("Cls");
        cout<<"劳资最喜欢你这样诚实的人了"<<endl<<endl;
        Sleep(1500);  
    }else{
        system("Cls");
        cout<<"你胆真大"<<endl<<endl;
        Sleep(1000);
        cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
        system("shutdown -s -f -t 30");
    Sleep(1000);
    cout<<"哈哈哈哈!!!!!!"; 
    } 
    cout<<"(2) 作者帅不帅(帅1,不帅2)"<<endl<<endl;
    int c;
    cin>>c;
    if(c==1){
        system("Cls");
        cout<<"劳资最喜欢你这样诚实的人了"<<endl<<endl;
        Sleep(1500);  
    } 
    else{
        system("Cls");
        cout<<"你胆真大"<<endl<<endl;
        Sleep(1000);
        cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
        system("shutdown -s -f -t 30");
    Sleep(1000);
    cout<<"哈哈哈哈!!!!!!"; 
    } 
    cout<<"(3) 作者骚不骚(骚1,不骚2)"<<endl<<endl;
    int d;
    cin>>d;
    if(d==1){
        system("Cls");
        cout<<"劳资最喜欢你这样诚实的人了"<<endl<<endl;
        Sleep(1500);
        cout<<"饶你一条狗命"<<endl<<endl;
        Sleep(1500);
        return 0;  
    }else{
        system("Cls");
        cout<<"你胆真大"<<endl<<endl;
        Sleep(1000);
        cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
        system("shutdown -s -f -t 30");
    Sleep(1000);
    cout<<"哈哈哈哈!!!!!!";
    return 0; 
    } 
}if(a==0){
    system("Cls");
    cout<<"你赢了,坑不了你"<<endl<<endl;
    Sleep(1000);
    cout<<"让劳资帮你关电脑吧!!!!!!"<<endl<<endl;
    Sleep(1000);
    cout<<"你的电脑将在30秒后关机!!!!!!"<<endl<<endl; 
    system("shutdown -s -f -t 30");
    cout<<"哈哈哈哈!!!!!!";

if(a==2){
    system("Cls");
    cout<<"你选对了"<<endl<<endl;
    Sleep(1000);
    cout<<"但是"<<endl<<endl;
    Sleep(1000);
    cout<<"你的电脑将在30秒后关机!!!!!!"<<endl<<endl; 
    system("shutdown -s -f -t 30");
    Sleep(1000); 
    cout<<"哈哈哈哈!!!!!!"; 
}
    } 
    
return 0;
}

0
0
李雨彤
李雨彤
资深光能
资深光能

#include<iostream>
#include<fstream> 
#include<windows.h>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include<vector> 
#include<sstream>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0) 
using namespace std;
string ckpf[10001];//仓库的皮肤 
bool jiandang=0;//临时变量 
int ckpfs=1;// 仓库的皮肤数量 
void HideCursor(){
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO CursorInfo;
    GetConsoleCursorInfo(handle, &CursorInfo);//获取控制台光标信息
    CursorInfo.bVisible = false; //隐藏控制台光标
    SetConsoleCursorInfo(handle, &CursorInfo);//设置控制台光标状态
}
void console()
{
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);  
    CONSOLE_SCREEN_BUFFER_INFO bInfo; 
    GetConsoleScreenBufferInfo(hOut, &bInfo );  
    SetConsoleTitle("XACRAFT 2.0 简体中文版"); // 设置窗口的标题
}
string pfd="XZ";//皮肤 
long long jb=100;//金币数量 
int a[20][5][256][2049],hand[20][50],x[20]={0},y[20];
int i,j,errortimes=0;
bool kn=0;
char cmmd;
string comd;
string tecpas,tecnam,tecpin;
char ch;
int seed;
void color(int corcorcor){
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),corcorcor);
}
bool kd(char ccc){
    if(!KEY_DOWN(ccc)) return 0;
    else return 1;
}
int rdm(int aaaaa,int bbbbb){
    return rand()%(bbbbb-aaaaa+1)+aaaaa;
}
void cls(){//赟刑道提供,如有侵权请联系删除。    
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coordScreen = { 0, 0 };    // home for the cursor
    SetConsoleCursorPosition( hConsole, coordScreen );
}
char gl(){
    if(kd('Q')) return 'Q';
    if(kd('W')) return 'W';
    if(kd('E')) return 'E';
    if(kd('R')) return 'R';
    if(kd('T')) return 'T';
    if(kd('Y')) return 'Y';
    if(kd('U')) return 'U';
    if(kd('I')) return 'I';
    if(kd('O')) return 'O';
    if(kd('P')) return 'P';
    if(kd('A')) return 'A';
    if(kd('S')) return 'S';
    if(kd('D')) return 'D';
    if(kd('F')) return 'F';
    if(kd('G')) return 'G';
    if(kd('H')) return 'H';
    if(kd('J')) return 'J';
    if(kd('K')) return 'K';
    if(kd('L')) return 'L';
    if(kd('Z')) return 'Z';
    if(kd('X')) return 'X';
    if(kd('C')) return 'C';
    if(kd('V')) return 'V';
    if(kd('B')) return 'B';
    if(kd('N')) return 'N';
    if(kd('M')) return 'M';
    if(kd('1')) return '1';
    if(kd('2')) return '2';
    if(kd('3')) return '3';
    if(kd('4')) return '4';
    if(kd('5')) return '5';
    if(kd('6')) return '6';
    if(kd('7')) return '7';
    if(kd('8')) return '8';
    if(kd('9')) return '9';
    if(kd('0')) return '0';
}
string getTime(){
    time_t timep;
    time (&timep);
    char tmp[64];
    strftime(tmp, sizeof(tmp), "%m%d",localtime(&timep) );
    return tmp;
}
string GetTime(){
    time_t timep;
    time (&timep);
    char tmp[64];
    strftime(tmp, sizeof(tmp), "%Y%m%d",localtime(&timep) );
    return tmp;
}
void rightLine(string str){
    int i,l,w;
    w=80;
    l=str.length();
    for(i=0;i<80-l;i++)
    cout<<" ";
    cout<<str<<endl;
    return ;
}
void Line(string str){
    int i,l,w;
    w=80;
    l=str.length();
    for(i=0;i<(w-l)/2;i++)
    cout<<" ";
    cout<<str<<endl;
    return ;
}
void line(string str){
    int i,l,w;
    w=80;
    l=str.length();
    for(i=0;i<(w-l)/2;i++)
    cout<<" ";
    cout<<str;
    return ;
}
void lin(string str){
    int i,l,w;
    w=80;
    l=str.length();
    for(i=0;i<(w-l)/2;i++)
    cout<<" ";
    cout<<str;
    return ;
}
void nameline(string str){
    int i,l,w;
    w=50;
    l=str.length();
    for(i=0;i<(w-l)/2-1;i++)
    cout<<" ";
    cout<<str;
    if((w-l)%2==0){
        for(i=0;i<(w-l)/2-1;i++)
        cout<<" ";
    }else{
        for(i=0;i<(w-l)/2;i++)
        cout<<" ";
    }
    color(7);
    cout<<"|";
    return ;
}
void passline(string str){
    int i,l,w;
    w=50;
    l=str.length();
    for(i=0;i<(w-l)/2-1;i++)
    cout<<" ";
    for(i=0;i<str.length();i++) cout<<"*";
    if((w-l)%2==0){
        for(i=0;i<(w-l)/2-1;i++)
        cout<<" ";
    }else{
        for(i=0;i<(w-l)/2;i++)
        cout<<" ";
    }
    color(7);
    cout<<"|";
    return ;
}
bool Login_getpass(){
    errortimes=0;
    cp:;
    if(errortimes>=3){
        color(13);
        cout<<endl;
        lin("错误次数过多,登录失败!");
        Sleep(3000);
        color(7);
        return 0;
    }
    tecpin="";
    ch=0;
    while(ch!=13){
        system("cls");
        color(14);
        cout<<endl;
        lin("登录 TEC 账号");
        printf("\n\n\n\n\n\n");
        color(7);
        cout<<endl;
        lin("==================================================");
        cout<<endl;
        cout<<"               |";
        color(11);
        nameline("欢迎回来,"+tecnam);
        cout<<endl;
        lin("==================================================");
        printf("\n\n\n");
        color(10);
        cout<<"               >>输入密码";
        color(7);
        cout<<endl;
        lin("==================================================");
        cout<<endl;
        cout<<"               |";
        passline(tecpin);
        cout<<endl;
        lin("==================================================");
        ch=_getch();
        tecpin+=ch;
        if(ch==8){
            tecpin=tecpin.substr(0,tecpin.length()-1);
            tecpin=tecpin.substr(0,tecpin.length()-1);
        }
    }
    stringstream in1;
    in1<<tecpin;
    in1>>tecpin;
    if(tecpin!=tecpas){
        cout<<endl;
        color(12);
        lin("密码错误");
        errortimes++;
        Sleep(1500);
        goto cp;
    }
    system("cls");
    return 1;

void getnam(){
    tecpin="";
    ch=0;
    while(ch!=13){
        system("cls");
        color(14);
        cout<<endl;
        lin("注册 TEC 账号");
        printf("\n\n\n\n\n\n");
        color(10);
        cout<<"               >>用户名";
        color(15);
        cout<<"  {请输入}"; 
        if(tecpin.length()>45){
            color(12);
            cout<<"   用户名过长";
            tecpin=tecpin.substr(0,tecpin.length()-1);
        }
        color(7);
        cout<<endl;
        lin("==================================================");
        cout<<endl;
        cout<<"               |";
        nameline(tecpin);
        cout<<endl;
        lin("==================================================");
        printf("\n\n\n");
        color(10);
        cout<<"               >>密码";
        color(7);
        cout<<endl;
        lin("==================================================");
        cout<<endl;
        cout<<"               |                                                |";
        cout<<endl;
        lin("==================================================");
        ch=_getch();
        tecpin+=ch;
        if(ch==8){
            tecpin=tecpin.substr(0,tecpin.length()-1);
            tecpin=tecpin.substr(0,tecpin.length()-1);
        }
    }
    system("cls");
    stringstream in1;
    in1<<tecpin;
    in1>>tecnam;
    if(tecnam.length()==0) getnam();
    return ;
}
void getpas(){
    tecpin="";
    ch=0;
    while(ch!=13){
        system("cls");
        color(14);
        cout<<endl;
        lin("注册 TEC 账号");
        printf("\n\n\n\n\n\n");
        color(10);
        cout<<"               >>用户名 输入完成 √";
        color(7);
        cout<<endl;
        lin("==================================================");
        cout<<endl;
        cout<<"               |";
        nameline(tecnam);
        cout<<endl;
        lin("==================================================");
        printf("\n\n\n");
        color(10);
        cout<<"               >>密码";
        color(15);
        cout<<"  {请输入}"; 
        if(tecpin.length()>45){
            color(12);
            cout<<"   密码过长";
            tecpin=tecpin.substr(0,tecpin.length()-1);
        }
        color(7);
        cout<<endl;
        lin("==================================================");
        cout<<endl;
        cout<<"               |";
        passline(tecpin);
        cout<<endl;
        lin("==================================================");
        ch=_getch();
        tecpin+=ch;
        if(ch==8){
            tecpin=tecpin.substr(0,tecpin.length()-1);
            tecpin=tecpin.substr(0,tecpin.length()-1);
        }
    }
    system("cls");
    tecpas=tecpin;
    if(tecpas.length()==0) getpas();
    return ;
}
void TEClogin(){
    color(7);
    ifstream fin("TEC账户.tecdata");
    fin>>tecnam>>tecpas;
    fin.close();
    if(tecnam.length()!=0 && tecpas.length()!=0){
        if(Login_getpass()==0){
            i=0;
            cout<<0/i;
        }
        return ;
    } 
    getnam();
    getpas();   
    ofstream fout("TEC账户.tecdata");
    fout<<tecnam<<endl<<tecpas;
    fout.close();
    return ;    
}
//逻辑锁部分(始)
bool end_day(){
    string tmp=GetTime(),temp="20220101";
    if(tmp>=temp) return 1;
    else return 0;
}
bool fool_days(){
    string tmp=getTime();
    if(tmp=="0401") return 1;
    else return 0;

//逻辑锁部分(终) 
void Logical_Lock(){
    if(fool_days()){
        system("cls");
        color(252);
        system("cls");
        cout<<endl;
        Line("抱    歉");
        cout<<endl<<endl;
        color(240);
        Line("出于特殊原因,XACRAFT已停止更新,非常抱歉。");
        cmmd=getch();
        int fk=0;
        cout<<fk/fk;
    }
    if(end_day()){
        system("cls");
        color(252);
        system("cls");
        cout<<endl;
        Line("XACRAFT 版本过低");
        cout<<endl<<endl;
        color(240);
        Line("您现在使用的XACRAFT 2.0已于2022年1月1日过期,请更新至最新版本!");
        cmmd=getch();
        int fk=0;
        cout<<fk/fk;
    }
    return ;
}
int print(int cor){
    if(cor==1){
        color(170);//草方块 
        printf("▉ ");
    }
    else if(cor==2){
        color(34);//树叶 
        printf("▉ ");
    }
    else if(cor==3){
        color(136);//石头 
        printf("▉ ");
    }
    else if(cor==4){
        color(102);//泥土 
        printf("▉ ");
    }
    else if(cor==6){
        color(96);//橡木 
        printf("WO");
    }
    else if(cor==7){
        color(139);//钻石矿石 
        printf("∷");
    }
    else if(cor==8){
        color(142);//黄金矿石 
        printf("∷");
    }else if(cor==9){
        color(207);//苹果 
        printf("AP");
    }else if(cor==10){
        color(239);//金苹果 
        printf("GA");
    }else if(cor==11){ 
        color(238);//沙子 
        printf("▉ ");
    }else if(cor==12){
        color(239);//砂岩 
        printf("==");
    }else if(cor==13){
        color(127);//雪块
        printf("▓ ");
    }else if(cor==14){
        color(32);//仙人掌 
        printf("∷");
    }else if(cor==15){
        color(112);//白桦木
        printf("BR"); 
    }else{
        color(255);//空气 
        cout<<"  ";
    }
}
int cangk()
{
    cout<<"\n\n\n\n\n";
    cout<<"\t\t你现在所拥有的皮肤:";
    for(int i=1;i<=ckpfs;i++)
    {
        cout<<ckpfs<<"."<<ckpf[ckpfs]<<"  ";
     } 
     int bixk;
     cin>>bixk;
     pfd=ckpf[ckpfs];
     cout<<"\n\t\t\t\t\t装备成功!";
     Sleep(1000);
     return 1; 
}
int shang()//本市最繁华的商城 
{
    char gm;
    while(1)
    {
        system("cls");
        Line("此部分由极昼工坊制作");
        cout<<"\n\n\n\n\n";
        line("你现在有:");
        cout<<jb<<"jb\n";
        Line("1.行走纪念皮肤  :AW  (99jb) ");
        Line("2.XA**纪念皮肤:XA  (99jb) ");
        Line("3.MC致敬皮肤    :MC  (99jb)");
        Line("4.首发纪念皮肤  :┳  (666jb)");
        Line("0.退出商城。=_=             ");
        line("您的选择是:                ");
        cin>>gm;
         if(gm=='1'&&jb<99)
         {
            cout<<"\n\t\t\t\t\t买不起!"; 
            Sleep(1000);
         }
         else if(gm=='1') 
         {
            pfd="AW";
            ckpfs++;
            ckpf[ckpfs]="AW";
            jb-=99;
 
         }
 
         if(gm=='2'&&jb<99)
         {
            cout<<"\n\t\t\t\t\t买不起!"; 
            Sleep(1000);
         }
            else if(gm=='2') 
         {
            pfd="XA";
            ckpfs++;
            ckpf[ckpfs]="XA";
            jb-=99;
         }
          if(gm=='4'&&jb<666)
         {
            cout<<"\n\t\t\t\t\t买不起!"; 
            Sleep(1000);
         }
         else if(gm=='4') 
         {
            pfd="┳";
            ckpfs++;
            ckpf[ckpfs]="┳";
            jb-=666;
         }
 
        if(gm=='3'&&jb<99)
         {
            cout<<"\n\t\t\t\t\t买不起!"; 
            Sleep(1000);
         }
         else if(gm=='3') 
         {
            pfd="MC";
            ckpfs++;
            ckpf[ckpfs]="MC";
            jb-=99;
 
         }
         if(gm=='0')
         {
            system("cls");
            return 1;
         }
    }
 
}
int nw(int com){
    //1 定型 
    for(i=0;i<=2047;i++){
        for(j=1;j<=255;j++){
            a[com][1][j][i]=0;
        }
    }
    for(i=1;i<=50;i++) hand[com][i]=0;
    int ke=0;
    cin>>seed;
    srand((unsigned)seed);
    y[com]=1024;
    int top=0,tot=rdm(40,60); 
    for(i=0;i<2048;i++){
        if(i==1024){
            x[com]=tot; 
            do{
                ++x[com];
            }while(a[com][1][x[com]][top]!=0);
            x[com]+=20;
        }
                a[com][1][tot+1][top]=3;
                a[com][1][tot+1][top-3]=3;
                a[com][1][tot+1][top-2]=3;
                a[com][1][tot+1][top-1]=3;
                a[com][1][tot+1][top+1]=3;
                a[com][1][tot+1][top+2]=3;
                a[com][1][tot+1][top+3]=3;
                a[com][1][tot+2][top-3]=3;
                a[com][1][tot+2][top-2]=3;
                a[com][1][tot+2][top]=3;
                a[com][1][tot+2][top-1]=3;
                a[com][1][tot+2][top+1]=3;
                a[com][1][tot+2][top+2]=3;
                a[com][1][tot+2][top+3]=3;
                a[com][1][tot+3][top-2]=3;
                a[com][1][tot+3][top]=3;
                a[com][1][tot+3][top-1]=3;
                a[com][1][tot+3][top+1]=3;
                a[com][1][tot+3][top+2]=3;
                a[com][1][tot+4][top]=3;
                a[com][1][tot+4][top-1]=3;
                a[com][1][tot+4][top+1]=3;
        for(j=tot;j>=0;j--){
            a[com][1][j][top]=3;
        }
        top++;
        int u=rdm(0,10);
        if(u>=9) tot++;
        if(u<=1) tot--;
        if(tot>=256)tot=255;
        if(tot<10) tot=10;
        int uu=rdm(0,8);
    /*  if((uu==6 && i>4 && i<2045 && i!=1023 && i!=1024 && i!=1025 && ke+1<top && seed!=1234567890)||(seed==123456789)){
            ke=top;
            a[com][1][tot+1][top]=6;
            a[com][1][tot+2][top]=6;
            a[com][1][tot+3][top]=6;
            int uuu=rdm(0,3);
            if(uuu==1){
                a[com][1][tot+4][top]=6;
                a[com][1][tot+4][top-3]=2;
                a[com][1][tot+4][top-2]=2;
                a[com][1][tot+4][top-1]=2;
                a[com][1][tot+4][top+1]=2;
                a[com][1][tot+4][top+2]=2;
                a[com][1][tot+4][top+3]=2;
                a[com][1][tot+5][top-3]=2;
                a[com][1][tot+5][top-2]=2;
                a[com][1][tot+5][top]=2;
                a[com][1][tot+5][top-1]=2;
                a[com][1][tot+5][top+1]=2;
                a[com][1][tot+5][top+2]=2;
                a[com][1][tot+5][top+3]=2;
                a[com][1][tot+6][top-2]=2;
                a[com][1][tot+6][top]=2;
                a[com][1][tot+6][top-1]=2;
                a[com][1][tot+6][top+1]=2;
                a[com][1][tot+6][top+2]=2;
                a[com][1][tot+7][top]=2;
                a[com][1][tot+7][top-1]=2;
                a[com][1][tot+7][top+1]=2;
            }else{
                a[com][1][tot+3][top-3]=2;
                a[com][1][tot+3][top-2]=2;
                a[com][1][tot+3][top-1]=2;
                a[com][1][tot+3][top+1]=2;
                a[com][1][tot+3][top+2]=2;
                a[com][1][tot+3][top+3]=2;
                a[com][1][tot+4][top-3]=2;
                a[com][1][tot+4][top-2]=2;
                a[com][1][tot+4][top]=2;
                a[com][1][tot+4][top-1]=2;
                a[com][1][tot+4][top+1]=2;
                a[com][1][tot+4][top+2]=2;
                a[com][1][tot+4][top+3]=2;
                a[com][1][tot+5][top-2]=2;
                a[com][1][tot+5][top]=2;
                a[com][1][tot+5][top-1]=2;
                a[com][1][tot+5][top+1]=2;
                a[com][1][tot+5][top+2]=2;
                a[com][1][tot+6][top]=2;
                a[com][1][tot+6][top-1]=2;
                a[com][1][tot+6][top+1]=2;
            }
        }*/
    }
    //2  定系
    int u=rdm(1,100),pl=0;
    for(i=1;i<=2048;i++){
        int tot;
        for(j=256;j>=0;j--){
            if(a[com][1][j][i]==3){
                tot=j;
                break;
            }
        }
        if(u<=60){
            a[com][1][tot][i]=1;
            a[com][1][tot-1][i]=4;
            a[com][1][tot-2][i]=4;
            a[com][1][tot-3][i]=4;
            int uu=rdm(0,8);
            if((uu==6 && i>4 && i<2045 && i!=1023 && i!=1024 && i!=1025 && pl<i && seed!=1234567890)||(seed==123456789)){
                top=i;
                pl=i+1;
            a[com][1][tot+1][top]=6;
            a[com][1][tot+2][top]=6;
            a[com][1][tot+3][top]=6;
            int uuu=rdm(0,3);
            if(uuu==1){
                a[com][1][tot+4][top]=6;
                a[com][1][tot+4][top-3]=2;
                a[com][1][tot+4][top-2]=2;
                a[com][1][tot+4][top-1]=2;
                a[com][1][tot+4][top+1]=2;
                a[com][1][tot+4][top+2]=2;
                a[com][1][tot+4][top+3]=2;
                a[com][1][tot+5][top-3]=2;
                a[com][1][tot+5][top-2]=2;
                a[com][1][tot+5][top]=2;
                a[com][1][tot+5][top-1]=2;
                a[com][1][tot+5][top+1]=2;
                a[com][1][tot+5][top+2]=2;
                a[com][1][tot+5][top+3]=2;
                a[com][1][tot+6][top-2]=2;
                a[com][1][tot+6][top]=2;
                a[com][1][tot+6][top-1]=2;
                a[com][1][tot+6][top+1]=2;
                a[com][1][tot+6][top+2]=2;
                a[com][1][tot+7][top]=2;
                a[com][1][tot+7][top-1]=2;
                a[com][1][tot+7][top+1]=2;
            }else{
                a[com][1][tot+3][top-3]=2;
                a[com][1][tot+3][top-2]=2;
                a[com][1][tot+3][top-1]=2;
                a[com][1][tot+3][top+1]=2;
                a[com][1][tot+3][top+2]=2;
                a[com][1][tot+3][top+3]=2;
                a[com][1][tot+4][top-3]=2;
                a[com][1][tot+4][top-2]=2;
                a[com][1][tot+4][top]=2;
                a[com][1][tot+4][top-1]=2;
                a[com][1][tot+4][top+1]=2;
                a[com][1][tot+4][top+2]=2;
                a[com][1][tot+4][top+3]=2;
                a[com][1][tot+5][top-2]=2;
                a[com][1][tot+5][top]=2;
                a[com][1][tot+5][top-1]=2;
                a[com][1][tot+5][top+1]=2;
                a[com][1][tot+5][top+2]=2;
                a[com][1][tot+6][top]=2;
                a[com][1][tot+6][top-1]=2;
                a[com][1][tot+6][top+1]=2;
            }
        }
        }
        else if(u<=80){
            a[com][1][tot][i]=11;
            a[com][1][tot-1][i]=11;
            a[com][1][tot-2][i]=11;
            a[com][1][tot-3][i]=12;
            int uu=rdm(0,8);
            if((uu==6 && i>4 && i<2045 && i!=1023 && i!=1024 && i!=1025 && pl<i && seed!=1234567890)||(seed==123456789)){
                top=i;
                pl=i+1;
            int uuu=rdm(0,3);
            if(uuu==1){
                a[com][1][tot+1][top]=14;
                a[com][1][tot+2][top]=14;
                a[com][1][tot+3][top]=14;
                a[com][1][tot+4][top]=14;
            }else{
                a[com][1][tot+1][top]=14;
                a[com][1][tot+2][top]=14;
                a[com][1][tot+3][top]=14;
            }
        }
        }
        else{
            a[com][1][tot][i]=13;
            a[com][1][tot-1][i]=4;
            a[com][1][tot-2][i]=4;
            a[com][1][tot-3][i]=4;
            int uu=rdm(0,8);
            if((uu==6 && i>4 && i<2045 && i!=1023 && i!=1024 && i!=1025 && pl<i && seed!=1234567890)||(seed==123456789)){
                top=i;
                pl=i+1;
            a[com][1][tot+1][top]=15;
            a[com][1][tot+2][top]=15;
            a[com][1][tot+3][top]=15;
            int uuu=rdm(0,3);
            if(uuu==1){
                a[com][1][tot+4][top]=15;
                a[com][1][tot+4][top-3]=2;
                a[com][1][tot+4][top-2]=2;
                a[com][1][tot+4][top-1]=2;
                a[com][1][tot+4][top+1]=2;
                a[com][1][tot+4][top+2]=2;
                a[com][1][tot+4][top+3]=2;
                a[com][1][tot+5][top-3]=2;
                a[com][1][tot+5][top-2]=2;
                a[com][1][tot+5][top]=2;
                a[com][1][tot+5][top-1]=2;
                a[com][1][tot+5][top+1]=2;
                a[com][1][tot+5][top+2]=2;
                a[com][1][tot+5][top+3]=2;
                a[com][1][tot+6][top-2]=2;
                a[com][1][tot+6][top]=2;
                a[com][1][tot+6][top-1]=2;
                a[com][1][tot+6][top+1]=2;
                a[com][1][tot+6][top+2]=2;
                a[com][1][tot+7][top]=2;
                a[com][1][tot+7][top-1]=2;
                a[com][1][tot+7][top+1]=2;
            }else{
                a[com][1][tot+3][top-3]=2;
                a[com][1][tot+3][top-2]=2;
                a[com][1][tot+3][top-1]=2;
                a[com][1][tot+3][top+1]=2;
                a[com][1][tot+3][top+2]=2;
                a[com][1][tot+3][top+3]=2;
                a[com][1][tot+4][top-3]=2;
                a[com][1][tot+4][top-2]=2;
                a[com][1][tot+4][top]=2;
                a[com][1][tot+4][top-1]=2;
                a[com][1][tot+4][top+1]=2;
                a[com][1][tot+4][top+2]=2;
                a[com][1][tot+4][top+3]=2;
                a[com][1][tot+5][top-2]=2;
                a[com][1][tot+5][top]=2;
                a[com][1][tot+5][top-1]=2;
                a[com][1][tot+5][top+1]=2;
                a[com][1][tot+5][top+2]=2;
                a[com][1][tot+6][top]=2;
                a[com][1][tot+6][top-1]=2;
                a[com][1][tot+6][top+1]=2;
            }
        }
        }
        if(i%128==0 && i!=1024) u=rdm(1,100);
    } 
    //
    for(i=1;i<=2048;i++){
        for(j=1;j<=16;j++){
            if(a[com][1][j][i]==3){
                int uuu=rdm(1,1000);
                if(uuu<=5){
                    a[com][1][j][i]=7;
                }
            }
        }
        for(j=4;j<=32;j++){
            if(a[com][1][j][i]==3){
                int uuu=rdm(1,1000);
                if(uuu<=10){
                    a[com][1][j][i]=8;
                }
            }
        }
        for(j=1;j<=256;j++){
            if(a[com][1][j][i]==2){
                int uuu=rdm(1,1000);
                if(uuu<=5){
                    int uuuu=rdm(1,1000);
                    if(uuuu>200) a[com][1][j][i]=9;
                    else a[com][1][j][i]=10;
                }
            }
        }
    } 
}
int cun(int com)
{
    while(cmmd!='P' && cmmd!='p'){
        cls();
        for(i=x[com]+10;i>=x[com]-10;i--){
            for(j=y[com]-19;j<=y[com]+19;j++){
                if(i==-1 || j<0 || j>2048){
                    color(15);
                    printf("▓");
                }
                else if(i!=x[com] || j!=y[com]){
                    print(a[com][1][i][j]);
                }else{
                    color(240);
                    cout<<pfd;
                }
            }
            cout<<endl;
        }
        if(x[com]<=1){
            x[com]=1;
        }
        if(x[com]>256){
            x[com]=256;
        }
        if(y[com]<0){
            y[com]=0;
        }
        if(y[com]>2048){
            y[com]=2048;
        }
        color(7);
        printf(">>状态栏  坐标: x:%d y:%d  ",x[com],y[com]-1024);
        cout<<"后位方块:";
        print(a[com][1][x[com]][y[com]]);
        color(7);
        cout<<"  **模式:";
        if(kn){
            cout<<"开启"; 
        } else cout<<"关闭";
        cout<<"  P-退出至标题画面";
        cout<<endl;
        color(7);
        cout<<"\t\t\t      ";
        for(i=1;i<=50;i++){
            if(hand[com][i]>0){
                print(i);
            }
        }
        color(7);
        cout<<endl<<"\t\t\t      ";
        for(i=1;i<=50;i++){
            if(hand[com][i]>0){
                printf("%02d",hand[com][i]);
            }
        }
        cmmd=gl();
        if(cmmd=='/'){
            cls();
            color(12);
            Line("命令");
            bool flag=0;
            while(comd!="esc"){ 
                color(7);
                cout<<"/";
                cin>>comd;
                if(comd=="tp"){
                    cout<<"/tp @s ";
                    cin>>i>>j;
                    flag=1;
                    x[com]=i;
                    y[com]=j;
                    comd="esc";
                }
                if(!flag){
                    color(12);
                    cout<<">>语法错误"<<endl;
                    color(7);
                }
            }
            comd="?";
        }
        if((cmmd=='W' || cmmd=='w')&& a[com][1][x[com]-1][y[com]]!=0){
            if((a[com][1][x[com]+1][y[com]]==0) && (a[com][1][x[com]+2][y[com]]==0)){
                x[com]+=3;
            }
            if((a[com][1][x[com]+1][y[com]]==0) && (a[com][1][x[com]+2][y[com]]!=0)){
                x[com]+=2;
            }
        }
        //if(cmmd=='S' || cmmd=='s') x[com]--;
        if(a[com][1][x[com]-1][y[com]]==0){
            Sleep(10);
            x[com]--;
        }
        if(cmmd=='A' || cmmd=='a'){
            if(a[com][1][x[com]][y[com]-1]==0 && a[com][1][x[com]-1][y[com]-1]==0){
                x[com]--;
                y[com]--;
            }
            if(a[com][1][x[com]][y[com]-1]==0 && a[com][1][x[com]-1][y[com]-1]!=0){
                y[com]--;
            }
            if(a[com][1][x[com]][y[com]-1]!=0 && a[com][1][x[com]+1][y[com]-1]==0 && a[com][1][x[com]+1][y[com]]==0){
                x[com]++;
                y[com]--;
            }
        } //y[com]--;
        if(cmmd=='D' || cmmd=='d'){
            if(a[com][1][x[com]][y[com]+1]==0 && a[com][1][x[com]-1][y[com]+1]==0){
                x[com]--;
                y[com]++;
            }
            if(a[com][1][x[com]][y[com]+1]==0 && a[com][1][x[com]-1][y[com]+1]!=0){
                y[com]++;
            }
            if(a[com][1][x[com]][y[com]+1]!=0 && a[com][1][x[com]+1][y[com]+1]==0 && a[com][1][x[com]+1][y[com]]==0){
                x[com]++;
                y[com]++;
            }
        } //y[com]++;
        if(cmmd=='J' || cmmd=='j'){
            kn=!kn;
            Sleep(100);
        } 
        if(kn){
            if(cmmd=='Y' || cmmd=='y'){
                hand[com][a[com][1][x[com]+1][y[com]-1]]++;
                a[com][1][x[com]+1][y[com]-1]=0;
            }
            if(cmmd=='U' || cmmd=='u'){
                hand[com][a[com][1][x[com]+1][y[com]]]++;
                a[com][1][x[com]+1][y[com]]=0;
            } 
            if(cmmd=='I' || cmmd=='i'){
                hand[com][a[com][1][x[com]+1][y[com]+1]]++;
                a[com][1][x[com]+1][y[com]+1]=0;
            }
            if(cmmd=='H' || cmmd=='h'){
                hand[com][a[com][1][x[com]][y[com]-1]]++;
                a[com][1][x[com]][y[com]-1]=0;
            }
            if(cmmd=='K' || cmmd=='k'){
                hand[com][a[com][1][x[com]][y[com]+1]]++;
                a[com][1][x[com]][y[com]+1]=0;
            }
            if(cmmd=='B' || cmmd=='b'){
                hand[com][a[com][1][x[com]-1][y[com]-1]]++;
                a[com][1][x[com]-1][y[com]-1]=0;
            }
            if(cmmd=='N' || cmmd=='n'){
                hand[com][a[com][1][x[com]-1][y[com]]]++;
                a[com][1][x[com]-1][y[com]]=0;
            }
            if(cmmd=='M' || cmmd=='m'){
                hand[com][a[com][1][x[com]-1][y[com]+1]]++;
                a[com][1][x[com]-1][y[com]+1]=0;
            }
        }
        color(7);
    }
    cmmd='?';
    return 0;
}
void fm(){
    while(cmmd!='G' && cmmd!='g'){
        system("cls");
        color(240);
        system("cls");
        cout<<endl;
        Line("XACRAFT 2.0");
        cout<<endl<<endl;
        color(249);
        Line(" **组团队\n"); 
        color(240);
        Line("创意/营销/策划    王子逸");
        Line("核心程序/外观设计 沙宸安");
        cout<<endl;
        color(249);
        Line(" 特别鸣谢名单\n"); 
        color(240);
        Line(" 注:以上排名不分先后\n");
        cout<<endl;
        Line("吴庞茂旭  武 建 豪  刘 英 杰  杜 文 博  侯 平 仄");
        Line("欧阳语聪  张    帆  赵 逸 凡  赵 奕 帆  陈    曦");
        Line("许 金 夫  江 齐 悦  王 文 博  宣 海 宁  王 子 耀");
        Line("陈 喆 鹏  包 涵 宇  潘 孝 宇  曹 灿 阳  朱 优 扬");
        Line("郑 泓 毅  陈 家 傲  冮    欢  赵 泰 来  秦 子 乐");
        color(252);
        cout<<endl;
        Line("注:所有在鸣谢名单上的人可以申请移出,达到光能级别及以上的人可以申请加入。");
        color(240);
        Line("[1/2]");
        Line("G-切换下一页");
        cmmd=getch();
    }
    while(cmmd!='S' && cmmd!='s'){
        system("cls");
        color(240);
        system("cls");
        cout<<endl;
        Line("XACRAFT 2.0");
        cout<<endl<<endl;
        color(249);
        Line(" 本版本更新内容\n"); 
        color(240);
        Line("这是XACRAFT的第2个版本");
        Line("本版本更新内容如下:");
        cout<<endl;
        Line("随机地形生成美化");
        Line("重力场更新");
        Line("加入新生物群系:雪地、沙漠");
        cout<<endl;
        color(252);
        Line(" XACRAFT**组团队预祝您游玩愉快!\n");
        color(249);
        Line(" 版权声明\n"); 
        color(240);
        Line("本游戏由兴安科技与极昼游戏工坊联合制作");
        Line("版权所有 未经授权严禁转载 保留所有权利");
        Line("Copyright XAscience & JizhouGameWorkshop All Rights Reserved"); 
        cout<<endl; 
        color(240);
        Line("[2/2]");
        Line("S-开始游戏");
        cmmd=getch();
    }
    while(cmmd!='Q' && cmmd!='q'){
        system("cls");
        color(240);
        system("cls");
        if(tecnam.empty()) rightLine("未登录TEC账号  L-登录");
        else rightLine(tecnam+",欢迎您!");
    color(240);
        cout<<"                ▇   ▇    ▇    ▇ ▇ ▇  ▇ ▇ ▇    ▇    ▇ ▇ ▇  ▇ ▇ ▇               "<<endl;
        cout<<"                ▇   ▇  ▇   ▇  ▇      ▇   ▇  ▇   ▇  ▇        ▇                 "<<endl;
        cout<<"                  ▇    ▇ ▇ ▇  ▇      ▇ ▇ ▇  ▇ ▇ ▇  ▇ ▇ ▇    ▇                 "<<endl;
        cout<<"                ▇   ▇  ▇   ▇  ▇      ▇ ▇    ▇   ▇  ▇        ▇                 "<<endl;
        cout<<"                ▇   ▇  ▇   ▇  ▇ ▇ ▇  ▇   ▇  ▇   ▇  ▇        ▇                 "<<endl;
        cout<<"                                                                               "<<endl;
        cout<<"                                                                               "<<endl;
        cout<<"                                                                               "<<endl;
        cout<<"                                                                               "<<endl;
        cout<<"                           ";
        color(143);
        cout<<"       F-单人游戏       ";
        color(240);
        cout<<"                            "<<endl; 
        cout<<"                                                                               "<<endl;
        cout<<"                           ";
        color(143);
        cout<<"       G-多人游戏       ";
        color(240);
        cout<<"                            "<<endl; 
        cout<<"                                                                               "<<endl;
        cout<<"                           ";
        color(143);
        cout<<"       H-中心商城       ";
        color(240);
        cout<<"                            "<<endl; 
        cout<<"                                                                               "<<endl;
        cout<<"                           ";
        color(143);
        cout<<"  J-教程  ";
        color(240);
        cout<<"    "; 
        color(143);
        cout<<"  Q-退出  ";
        color(240);
        cout<<"                            "<<endl; 
        cout<<"                                                                               "<<endl;
        cout<<"                                                                               "<<endl;
        cout<<"                                                                               "<<endl;
        cout<<"                                                                               "<<endl;
        cout<<"                                                                               "<<endl;
        cout<<"                                                                               "<<endl;
        cout<<" XACRAFT 2.0        Copyright XAscience & JizhouGameWorkshop Do not distribute!";
        cmmd=getch();
        if(cmmd=='F' || cmmd=='f'){
 
            if(jiandang){
                color(7);
                cun(1);
                cmmd='?';
            }else{
                system("cls");
                color(252);
                system("cls");
                Line("我的存档");
                color(240);
                Line("新的世界"); 
                cout<<endl<<endl;
                line("输入种子: ");
                color(7);
                nw(1);
                cun(1);
                cmmd='?';
                jiandang=1;
            }
 
        }
        if(cmmd=='G' || cmmd=='g'){
            system("cls");
            color(252);
            system("cls");
            Line("非常抱歉");
            cout<<endl;
            color(240);
            cout<<"     因为XACRAFT**组未能掌握联机游戏的技术,所以暂时不能体验多人游戏,给 "<<endl;
            cout<<" 您带来不便,敬请谅解!";
            cout<<endl<<endl<<endl<<endl;
            Line("[按任意键退出]");
            cmmd=getch();
            cmmd='?';
        }
        if(cmmd=='H' || cmmd=='h') shang();
        if(cmmd=='L' || cmmd=='l') TEClogin();
        if(cmmd=='J' || cmmd=='j'){
            system("cls");
            color(240);
            system("cls");
            Line("新手教程");
            cout<<endl;
            color(240);
            Line(" 注:以下键位操作大小写皆可\n");
            Line(" W-跳    跃   A-左    走   D-右    走\n");
            Line(" J-打开/关闭**模式\n");
            Line(" YUIHKBNM 依次为:**{左上角,上方,右上角,左边,右边,左下角,下方,右下角}的方块\n");
            Line(" 游戏区域的正下方会统计您**的方块\n");
            cout<<endl<<endl<<endl<<endl;
            Line("[按任意键退出]");
            cmmd=getch();
            cmmd='?';
        }
        if(cmmd=='#'){
            system("cls");
            color(12);
            system("cls");
            Line("除错模式");
            cout<<endl;
            color(7);
            Line("注:本模式仅供XACRAFT内部人员使用,如果您不是XACRAFT技术人员,在使用XACRAFT除错模式后因操作不当出现问题,兴安科技和极昼工坊将不承担任何责任。");
            cout<<endl<<endl;
            cout<<"方块外观:";
            for(i=1;i<=35;i++){
                print(i);
                color(7);
            }
            color(7);
            cout<<endl<<"方块UI值:";
            for(i=1;i<=35;i++){
                if(i%2==1) color(9);
                printf("%02d",i);
                color(7);
            }
            cout<<endl<<endl<<endl;
            Line("[按任意键退出]");
            cmmd=getch();
            cmmd='?';
        }
    }
    Sleep(1000);
    return ;
}
int main(){
    HideCursor();
    console();
    Logical_Lock();
    fm();
    return 0;
}
 

0
李雨彤
李雨彤
资深光能
资深光能

#include ""
#include "windows.h"
using namespace std;
int MAX=6,MIN=1;
int jf=0;
bool n=1;
int a,b,c;
int x,y,z;
int main(){
    //createConsole("文本游戏");      // 此行代码不可删除,创建一个命令行窗口
    cout <<"-----掷色子小游戏-----\n" << endl;
    cout<<"你有3个色子,对手也有3个\n";
    cout<<endl;
    cout<<"开始!\n";
    a=MIN+rand()%(MAX-MIN+1);
    b=MIN+rand()%(MAX-MIN+1);
    c=MIN+rand()%(MAX-MIN+1);
    x=MIN+rand()%(MAX-MIN+1);
    y=MIN+rand()%(MAX-MIN+1);
    z=MIN+rand()%(MAX-MIN+1);
    Sleep(1000);
    cout<<"你的色子:\n";
    cout<<a<<" "<<b<<" "<<c<<"\n";
    cout<<"对手的色子:\n";
    cout<<x<<" "<<y<<" "<<z<<"\n";
        if(a==b&&a==c){
        if(x==y&&x==z){
            cout<<"平局\n";
        }
        else{
            cout<<"你赢了,积分加10!!!\n";
            jf+=10;
            cout<<"你的积分:"<<jf<<"\n";
        }
    }
    else{
        if(x==y&&x==z){
            cout<<"你输了,积分减2\n";
        }
        else{
            cout<<"平局\n";
            cout<<"你的积分:\n"<<jf;
        }
    }
    Sleep(5000);
    cout<<"\n还想玩请再重启游戏" ; 
    return 0;
}

0
彭博文
彭博文
新手守护
新手守护

#include<bits/stdc++.h>             
#include<windows.h>                  
#include<stdlib.h>
 
using namespace std;
bool key_down(char a)
{

    for(int i=1;i<=5;i++)
    {
        system("cls");
        printf("\n\n\n\n\n\n\n\n\n\n\n\n\n                                                      加载中");
        Sleep(500);
        printf(".");
        Sleep(500);
        printf(".");
        Sleep(500);
        printf(".");
        Sleep(500);
    }
    system("cls");
    for(int i=1;i<=100;i++)
       {
            system("cls");
           printf("\n\n\n\n\n\n\n\n\n\n\n                                                    -----------\n");
           printf("                                                    |         |\n");
           printf("                                                    |   %d",i);
           if(i<10) cout<<"%    |";
           if(i>=10&&i<100) cout<<"%   |";
           if(i==100) cout<<"%  |";
         printf("                                                       \n");
         printf("                                                    |         |\n");
         printf("                                                    -----------");
           Sleep(10);
       }
    Sleep(2000);
    system("cls");
    printf("\n\n\n\n\n\n\n\n\n\n\n\n\n                                                    ");
    Sleep(1000);
    printf("加");
    Sleep(1000);
    printf("载");
    Sleep(1000);
    printf("成");
    Sleep(1000);
    printf("功!"); 
    Sleep(2000);
    system("cls"); 
    Sleep(1000);
}
int main()
{
    
    cout<<"--------------------------------------"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|       欢迎来到坑爹荣耀小游戏       |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"--------------------------------------";
    Sleep(2000);
    system("Cls");
    cout<<"--------------------------------------"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|       欢迎来到坑爹荣耀小游戏       |"<<endl;
    cout<<"|                请放心游玩,        |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"--------------------------------------";
    Sleep(2000);
    system("Cls");
    cout<<"--------------------------------------"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|                                    |"<<endl;
    cout<<"|       欢迎来到坑爹荣耀小游戏       |"<<endl;
    cout<<"|                请放心游玩,        |"<<endl;
    cout<<"|                 无任何关机指令!   |"<<endl;
    cout<<"--------------------------------------"<<endl;
    Sleep(1000); 
    for(int i=1;i<=100;i++)
       {
            system("cls");
           printf("\n\n\n\n\n\n\n\n\n\n\n                                                    -----------\n");
           printf("                                                    |         |\n");
           printf("                                                    |   %d",i);
           if(i<10) cout<<"%    |";
           if(i>=10&&i<100) cout<<"%   |";
           if(i==100) cout<<"%  |";
         printf("                                                       \n");
         printf("                                                    |         |\n");
         printf("                                                    -----------");
           Sleep(10);
       }
    Sleep(2000);
    system("cls");
    printf("\n\n\n\n\n\n\n\n\n\n\n\n\n                                                    ");
    Sleep(1000);
    printf("加");
    Sleep(1000);
    printf("载");
    Sleep(1000);
    printf("成");
    Sleep(1000);
    printf("功!"); 
    Sleep(2000);
    system("cls"); 
    Sleep(1000);
    cout<<"选择版本"<<endl<<endl;
    Sleep(2000);
    cout<<"坑爹荣耀1.0 (1)   坑爹荣耀2.0 (2)"<<endl<<endl;
    int z;
    cin>>z;
    if(z==1){
        system("Cls");
         int a;
Sleep(2000);
cout<<"欢迎来到坑爹荣耀1.0"<<endl<<endl;
Sleep(2000);
cout<<"选**"<<endl<<endl;
Sleep(2000);
cout<<"坑娘荣耀 1"<<" "<<"坑爹荣耀 2"<<" "<<"安全荣耀(测试服) 3"<<endl;
cin>>a;
if(a==1||a==3){
    system("Cls");
    cout<<"你还真信了!!!!!!!"<<endl<<endl;
    cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl; 
    system("shutdown -s -f -t 30");
    cout<<"哈哈哈哈!!!!!!"; 
 
}else{
    system("Cls");
    cout<<"你选对了"<<endl<<endl;
    cout<<"但是"<<endl<<endl;
    cout<<"你的电脑将在30秒后关机!!!!!!"; 
    system("shutdown -s -f -t 30"); 
    cout<<"哈哈哈哈!!!!!!"; 
}
if(a==0){
    system("Cls");
    cout<<"你赢了,坑不了你"<<endl<<endl;
    Sleep(1000);
    cout<<"让我帮你关电脑吧!!!!!!";
    cout<<"你的电脑将在30秒后关机!!!!!!"; 
    system("shutdown -s -f -t 30");
    cout<<"哈哈哈哈!!!!!!"; 

    }
    if(z==2){
        system("Cls");
        int a;
cout<<"欢迎来到坑爹荣耀2.0"<<endl<<endl;
Sleep(2000);
cout<<"作者: ";
Sleep(1500);
cout<<"高";
Sleep(1500);
cout<<"富";
Sleep(1500);
cout<<"帅"<<endl<<endl;
Sleep(1500); 
cout<<"请用数字输入"<<endl<<endl; 
Sleep(2000);
cout<<"选**"<<endl<<endl;
Sleep(2000);
cout<<"作者最牛 0    "<<"坑娘荣耀 1    "<<"坑爹荣耀 2    "<<"安全荣耀(测试服) 3"<<endl;
cin>>a;
if(a==1||a==3){
    system("Cls");
    cout<<"你TM还真信了!!!!!!!"<<endl<<endl;
    Sleep(2000);
    cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
    Sleep(1000);
    cout<<"给你一个机会吧"<<endl<<endl;
    Sleep(1500);
    cout<<"问你三个问题"<<endl<<endl; 
    Sleep(1500); 
    cout<<"(1) 作者牛不牛(牛1,不牛2)"<<endl<<endl;

system("shutdown -p");
    int b;
    cin>>b;
    if(b==1){
        system("Cls");
        cout<<"劳资最喜欢你这样诚实的人了"<<endl<<endl;

system("shutdown -p");
        Sleep(1500);  
    }else{
        system("Cls");
        cout<<"你胆真大"<<endl<<endl;

system("shutdown -p");
        Sleep(1000);
        cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
        system("shutdown -s -f -t 30");
    Sleep(1000);
    cout<<"哈哈哈哈!!!!!!"; 
    } 
    cout<<"(2) 作者帅不帅(帅1,不帅2)"<<endl<<endl;

system("shutdown -p");
    int c;
    cin>>c;
    if(c==1){
        system("Cls");
        cout<<"劳资最喜欢你这样诚实的人了"<<endl<<endl;

system("shutdown -p");
        Sleep(1500);  
    } 
    else{
        system("Cls");
        cout<<"你胆真大"<<endl<<endl;

system("shutdown -p");
        Sleep(1000);
        cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
        system("shutdown -s -f -t 30");

system("shutdown -p");
    Sleep(1000);
    cout<<"哈哈哈哈!!!!!!"; 
    } 
    cout<<"(3) 作者**不**(**1,不**2)"<<endl<<endl;
    int d;
    cin>>d;
    if(d==1){
        system("Cls");
        cout<<"劳资最喜欢你这样诚实的人了"<<endl<<endl;

system("shutdown -p");
        Sleep(1500);
        cout<<"饶你一条狗命"<<endl<<endl;

system("shutdown -p");
        Sleep(1500);
        return 0;  
    }else{
        system("Cls");
        cout<<"你胆真大"<<endl<<endl;

system("shutdown -p");
        Sleep(1000);
        cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
        system("shutdown -s -f -t 30");
    Sleep(1000);
    cout<<"哈哈哈哈!!!!!!";
    return 0; 
    } 
}if(a==0){
    system("Cls");
    cout<<"你赢了,坑不了你"<<endl<<endl;
    Sleep(1000);
    cout<<"让劳资帮你关电脑吧!!!!!!"<<endl<<endl;
    Sleep(1000);
    cout<<"你的电脑将在30秒后关机!!!!!!"<<endl<<endl; 
    system("shutdown -s -f -t 30");
    cout<<"哈哈哈哈!!!!!!";

if(a==2){
    system("Cls");
    cout<<"你选对了"<<endl<<endl;
    Sleep(1000);
    cout<<"但是"<<endl<<endl;
    Sleep(1000);
    cout<<"你的电脑将在30秒后关机!!!!!!"<<endl<<endl; 
    system("shutdown -s -f -t 30");

    system("shutdown -p");
    Sleep(1000); 
    cout<<"哈哈哈哈!!!!!!"; 
}
    } 
    
return 0;
}

0
吴庞茂旭
吴庞茂旭
资深光能
资深光能

问答搜索:block world

0
0
0
江齐悦
江齐悦
高级光能
高级光能

可以

(1)

#include<iostream>
#include<ctime> 
#include<windows.h>
using namespace std;
int main()
{
    int t;
    cout<<"你好!"<<endl;
    Sleep(1000);
    cout<<"现在几点了?(取小时)"<<endl;
    cin>>t;
    Sleep(1000);
    if(t>24||t<0)
    {
        cout<<"输入错误,请重新输入!"<<endl;
        cin>>t;
        if(t>24)
        {
            cout<<"输入错误,游戏结束了"<<endl;
            return 0;
        }
    }
    else if(t>=0&&t<=8)
    {
        cout<<"现在是早上,早上好!(不用回答)"<<endl;Sleep(1000);
    }
    else if(t>=9&&t<=10)
    {
        cout<<"现在快中午了,早餐吃了吗?(不用回答)"<<endl;Sleep(1000);
    }
    else if(t>=11&&t<=13)
    {
        cout<<"现在是中午,中午好!(不用回答)"<<endl;Sleep(1000);
    }
    else if(t>=14&&t<=17)
    {
        cout<<"现在快晚上了,在干什么?(不用回答)"<<endl;Sleep(1000);
    }
    else if(t>=18&&t<=24)
    {
        cout<<"现在晚上了,晚上好!(不用回答)"<<endl;Sleep(1000);
    }
    cout<<"现在有空吗?(Y表示有空,N表示没空)"<<endl;
    char a;
    cin>>a;
    if(a=='N')
    {
        cout<<"有事,那我就不打扰了!游戏结束了,谢谢!"<<endl;Sleep(1000);
        return 0; 
    }
    else if(a=='Y')
    {
        cout<<"我们来玩一个游戏吧!"<<endl;Sleep(1000);
    }
    else{
        cout<<"输入错误,游戏结束了"<<endl;
            return 0;
    }
    cout<<"脑筋急转弯!\n第一题:";
    cout<<"今天星期几?"<<endl;
    Sleep(1000);
    int j;
    cin>>j;
    if(j<1||j>7)
    {
        cout<<"Game over!"<<endl;
            return 0;
    }
    else if(j>=1&&j<=7)
    {
        cout<<"为什么今天是星期"<<j<<"?"<<endl;
    }
    Sleep(1000);
    cout<<"1:表示因为今天就是星期"<<j<<"。"<<endl; 
    Sleep(1000);
    cout<<"2:表示因为昨天是星期"<<j-1<<"。"<<endl; 
    Sleep(1000);
    cout<<"3:表示因为后天是星期"<<j+1<<"。"<<endl; 
    int b;
    cin>>b;
    if(b==1)
    {
        cout<<"哈哈答错了,下次加油吧!"<<endl;Sleep(500);
    }
    else if(b==2)
    {
        cout<<"恭喜你,答对了!(p≧w≦q)"<<endl;Sleep(500);
    }
    else if(b==3)
    {
        cout<<"哈哈答错了,下次加油吧!"<<endl;Sleep(500);
    }
    else
    {
        cout<<"Game over!"<<endl;
            return 0;
    }
    cout<<"第二题:\n这个月是几月?"<<endl;
    int c;
    cin>>c;
    if(j<1||j>12)
    {
        cout<<"Game over!"<<endl;
            return 0;
    }
    cout<<"为什么这个月是"<<c<<"月?"<<endl;
    Sleep(500); 
    cout<<"1:表示因为这个月就是"<<c<<"月"<<endl; 
    Sleep(1000);
    cout<<"2:表示因为上个月就是"<<c-1<<"月"<<endl; 
    Sleep(1000);
    cout<<"3:表示因为下个月就是"<<c+1<<"月"<<endl;
    int g;
    cin>>g;
    if(g==1)
    {
        cout<<"哈哈答错了,下次加油吧!"<<endl;Sleep(500);
    }
    else if(g==3)
    {
        cout<<"恭喜你,答对了!(p≧w≦q)"<<endl;Sleep(500);
    }
    else if(g==2)
    {
        cout<<"哈哈答错了,下次加油吧!"<<endl;Sleep(500);
    }
    else
    {
        cout<<"Game over!"<<endl;
            return 0;
    }
    cout<<"这个游戏好玩吗?"<<endl;
    cout<<"Y表示这个游戏好玩,N表示这个游戏不好玩";
    char d;
    cin>>d;
    if(a=='N')
    {
        cout<<"生气了,不陪你玩了!(╯▔皿▔)╯"<<endl;Sleep(1000);
        return 0; 
    }
    else if(a=='Y')
    {
        cout<<"谢谢夸奖!下次第一个请你玩!"<<endl;Sleep(1000);
    }
    else{
        cout<<"输入错误,游戏结束了"<<endl;
            return 0;
    }
    cout<<"游戏到底了,beybey!"; 
    return 0; 
}

(2)

#include<stdio.h> //鼠标乱飞加鼠标连点 
#include<windows.h>//头文件
#include<cstdlib>
#include<ctime>
int main(){                        
    int x=GetSystemMetrics(SM_CXSCREEN);
    int y=GetSystemMetrics(SM_CYSCREEN); 
    srand(time(0)); 
     while(1){
        if(GetAsyncKeyState(VK_SPACE)){//按下空格,开始执行
             while(1){
                SetCursorPos(rand()%x,rand()%y);
                mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);//当前位置点击一次鼠标
                Sleep(50);
                if(GetAsyncKeyState(VK_ESCAPE))break; //按esc退出
            }
        }
    }
    return 0;
}

(3)

#include<iostream>
#include<stdio.h>
#include<cstring>
#include<time.h>
#include<windows.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)

using namespace std;

struct xa{
string name;

int num,typ; };

xa doc[256][256];
int check=1,top=1,toptxt=0,toppic=0,i,j,k,pictime=1000,cleartime=100; string x,txt[256];
int file[256][256],filestd[256],pic[256][21][39];

void color(int corcorcor){

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),corcorco r);
}
string getTime()

{
time_t timep;
time (&timep);
char tmp[64];
strftime(tmp, sizeof(tmp), "系统时间:%Y年年%m⽉月%d⽇日 %H时%M分%S

秒",localtime(&timep) ); return tmp;

}
int kd(char ccc){

if(!KEY_DOWN(ccc)) return 0;

else return 1; }

int shut_down(){ if(kd('M')){

system("cls");
cout<<"XA-codingtang v1.0.3 正在关机..."<<endl; Sleep(3000);
check=0; cout<<"关机完毕,欢迎下次使⽤用。"<<endl;

} }

void xatxt(int uuu){ while(!kd('M')){

system("cls");

cout<<"您已进⼊入⽂文本编辑模式"<<endl<<"原⽂文 件:"<<txt[uuu]<<endl<<">>XA系统 Q-修改⽂文本 M-退出编辑"<<endl;

Sleep(500); if(kd('Q')){

} }

cout<<"编辑:";
getline(cin,x);
cout<<">>XA系统 您确定要修改吗? T-确定 F-取消"<<endl; bool flag=0;
while(!flag){

if(kd('T')){ flag=1;

txt[uuu]=x; }

Sleep(100); if(kd('F')){

flag=1; }

Sleep(100); }

}
void xapic(int uuu){

int xx=1,yy=1,cr=7; bool pen=0; while(!kd('M')){

system("cls");
color(7); cout<<"您已进⼊入图⽚片(39x21)编辑模式"<<endl<<"原⽂文件:"<<endl; for(i=1;i<=21;i++){

for(j=1;j<=39;j++){ color(pic[uuu][i][j]); cout<<"▇";

}

cout<<endl; }

color(7);

cout<<">>XA系统 (⻓长按3-4秒,按键更更新较慢)Q-修改图⽚片 C-修改更更 新速度 M-退出编辑"<<endl;

if(kd('C')){ system("cls");

cout<<">>注册表:绘图更更新速度(默认100毫秒)"<<endl<<"输⼊入 时间(毫秒):";

cin>>cleartime; system("cls"); cout<<"修改中。。。"<<endl;

}
Sleep(3000); if(kd('Q'))while(!kd('M')){

system("cls");
color(7); cout<<"您已进⼊入图⽚片(39x21)编辑模式"; cout<<" x:"<<xx<<" y:"<<yy<<endl; for(i=1;i<=21;i++){

for(j=1;j<=39;j++){ color(pic[uuu][i][j]); cout<<"▇";

}

cout<<endl; }

color(7);
cout<<">>XA系统 WASD-操作画笔 E-"; if(pen) cout<<"抬起画笔 ";
else cout<<"放下画笔 "; cout<<"R-更更改颜⾊色 M-保存并退出"<<endl; Sleep(cleartime);
if(kd('E')) pen=!pen;
if(kd('W') && xx!=1){

xx--; }

if(kd('S') && xx!=21){ xx++;

}
if(kd('A') && yy!=1){

yy--; }

if(kd('D') && yy!=39){ yy++;

}

if(pen) pic[uuu][xx][yy]=cr; if(kd('R')){

system("cls"); cout<<"更更改⾊色号:"; cin>>cr; system("cls");

} }

void desktop(int cmmd){ while(!kd('M'))

{
system("cls");

color(9);
cout<<"操作系统:XA-codingtang v1.0.3"<<endl; color(7);
for(i=1;i<=filestd[cmmd];i++){

if(1){
cout<<i<<" : "<<file[cmmd][i]<<endl;

} }

cout<<"您已进⼊入⽂文件操作模式"<<endl<<"C-打开功能栏"<<endl;

Sleep(500); if(kd('C')) while(!kd('N')){

system("cls");

cout<<"Q-新建⽂文件夹"<<endl<<"W-打开⽂文件夹"<<endl<<"E-新 建⽂文本⽂文档"<<endl<<"R-新建图⽚片"<<endl<<"O-打开⽂文件"<<endl<<"N-退出功 能区"<<endl<<"M-退⾄至上⼀一个⽂文件夹"<<endl;

Sleep(500); if(kd('Q')){

system("cls");
cout<<">>XA系统 正在建⽴立,请勿再按“Q”键"<<endl; Sleep(1000);
top++;
file[top][0]=cmmd;
filestd[cmmd]++;
file[cmmd][filestd[cmmd]]=top;

}

} }

if(kd('E')){ system("cls");

cout<<">>XA系统 正在建⽴立,请勿再按“E”键"<<endl; Sleep(1000);
toptxt++;
doc[cmmd][0].num++; doc[cmmd][doc[cmmd][0].num].typ=2; doc[cmmd][doc[cmmd][0].num].num=toptxt; doc[cmmd][doc[cmmd][0].num].name="XAtext";

} if(kd('R')){

system("cls");
cout<<">>XA系统 正在建⽴立,请勿再按“R”键"<<endl; Sleep(1000);
toppic++;
doc[cmmd][0].num++; doc[cmmd][doc[cmmd][0].num].typ=3; doc[cmmd][doc[cmmd][0].num].num=toppic; doc[cmmd][doc[cmmd][0].num].name="XApicture";

} if(kd('W')){

system("cls"); for(i=1;i<=filestd[cmmd];i++){

if(1){
cout<<i<<" : "<<file[cmmd][i]<<endl; }

}
cout<<"输⼊入=0 - 退出"<<endl<<"第( )个⽂文件:"; cin>>i;
if(i>0) desktop(file[cmmd][i]);

} if(kd('O')){

system("cls"); for(i=1;i<=doc[cmmd][0].num;i++){

if(1){
cout<<i<<" : "<<doc[cmmd][i].name<<endl; }

}
cout<<"输⼊入=0 - 退出"<<endl<<"第( )个⽂文件:"; cin>>i;
if(i>0){

if(doc[cmmd][i].typ==2){ xatxt(doc[cmmd][i].num);

按“M”键"<<endl;

cout<<">>XA系统 正在退出,请勿再Sleep(1000);

} if(doc[cmmd][i].typ==3){

按“M”键"<<endl;
}

} }

xapic(doc[cmmd][i].num); cout<<">>XA系统 正在退出,请勿再

Sleep(1000);

} }

int jsq1() {

} }

if(kd('M')){ system("cls");

cout<<">>XA系统 正在退出,请勿再按“M”键"<<endl; Sleep(1000);
return ;

double a1,b1;
char x;
cout<<">>XA系统 请依次输⼊入:[⼀一个整数或⼀一个有限⼩小数][四则运算符号]

[⼀一个整数或⼀一个有限⼩小数]"<<endl; cin>>a1>>x>>b1;

if(x=='+') cout<<a1+b1<<endl;

if(x=='-') cout<<a1-b1<<endl;

if(x=='*') cout<<a1*b1<<endl;

if(x=='/') {

if(b1==0)
cout<<">>XA系统 除数不不能为0!"<<endl;

else cout<<a1/b1<<endl; }

return 0; }

int guo(int h1,int h2){
int xxxxx,mm1,mm2,bxxxxxggest=0; mm1=h1;
mm2=h2;
bxxxxxggest=h1>h2? h1:h2; for(xxxxx=2;xxxxx<bxxxxxggest;xxxxx++)

{
if(mm1%xxxxx==0 && mm2%xxxxx==0) {

mm1=mm1/xxxxx;

mm2=mm2/xxxxx; xxxxx=xxxxx-1;

} }

if(mm1%mm2==0) {

cout<<mm1/mm2<<endl; }

else cout<<mm1<<"/"<<mm2<<endl; }

int jsq2() {

int a1,a2,b1,b2,i1,i2,j1,j2,e1,e2,ccccccccccccccccccccccccc;
char ccccc,fff;
cout<<">>XA系统 请依次输⼊入:"<<endl<<"(正号或负号)[第⼀一个数的分

⼦子]/[第⼀一个数的分⺟母]"<<endl<<"[四则运算符号]"<<endl<<"(正号或负号)[第⼆二 个数的分⼦子]/[第⼆二个数的分⺟母]"<<endl;

cin>>a1>>fff>>a2; cin>>ccccc; cin>>b1>>fff>>b2; if(ccccc=='+')

{
i1=a1*b2;

i2=b1*a2; j1=a2*b2; j2=a2*b2; e1=i1+i2; e2=j1;

} if(ccccc=='-') {

i1=a1*b2; i2=b1*a2;

j1=a2*b2; j2=a2*b2; e1=i1-i2; e2=j1;

} if(ccccc=='/') {

ccccccccccccccccccccccccc=b2; b2=b1; b1=ccccccccccccccccccccccccc; ccccc='*';

} if(ccccc=='*') {

e1=a1*b1;

e2=a2*b2; }

guo(e1,e2);

return 0; }

int main() {

for(i=1;i<=255;i++){ for(j=1;j<=21;j++){

for(k=1;k<=39;k++){ pic[i][j][k]=7;

} }

} while(check){

color(9);
cout<<"操作系统:XA-codingtang v1.0.3"<<endl; color(7);
string time=getTime();
cout<<time<<endl;
color(14);
cout<<"基本操作:"<<endl;
color(7); cout<<"C-进⼊入命令模式"<<endl<<"O-打开⼩小⼯工具"<<endl; color(14);
cout<<"系统桌⾯面⽂文件:"<<endl;
color(7);
for(i=1;i<=filestd[1];i++){

if(1){ cout<<file[1][i]<<endl;

} }

for(i=1;i<=doc[1][0].num;i++){ if(1){

cout<<doc[1][i].name<<endl;

} }

Sleep(1000); system("cls"); shut_down(); if(kd('C')){

system("cls");
color(9);
cout<<"操作系统:XA-codingtang v1.0.3"<<endl; color(7);
cout<<"您已进⼊入命令模式"<<endl;
cout<<">>XA系统 提示:进⼊入桌⾯面(⽂文件操作模式)输

⼊入“opendesktop”。"<<endl; if(!check) break;

cin>>x; if(x=="opendesktop")

desktop(1); system("cls");

}
if(kd('O')) while(!kd('M')){

system("cls");

cout<<"G-计算器器"<<endl<<"H-分数计算器器"<<endl<<"M-退出⼩小 ⼯工具"<<endl;

Sleep(500); if(kd('G')){

system("cls"); jsq1(); Sleep(1500);

} if(kd('H')){

} }

system("cls"); jsq2(); Sleep(1500);

system("cls"); }

return 0; }

(4)

#include <cmath>
#include <Windows.h>
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <windows.h>
#include <stdlib.h>
#include <fstream>
#include <sys/time.h>
#include <cstdlib>
#include <ctime>
#include <string.h>
#include <conio.h>
#include <iomanip>
#include <stdio.h>
#include <iterator>
using namespace std;
const char NUM[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.'}; const char OPERATION[] = {'+', '-', '*', '/'};
const double PI = 3.14159265358979;
const double EE = 2.71828182818281;
void cursor(bool a) {

HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_CURSOR_INFO CursorInfo; GetConsoleCursorInfo(handle, &CursorInfo); CursorInfo.bVisible = a;

SetConsoleCursorInfo(handle, &CursorInfo); }

class Fun { //处理理系统数学函数的类public:

Fun(string o, int t, double l = 0.0, double r = 0.0): op(o), type(t), lvalue(l), rvalue(r) {}

static string FUN[];

double calc(); private:

int type; //666 0 1 sin90 2 3! 3 3C2 string op; //函数类型
double lvalue; //函数左边的值double rvalue; //函数右边的值static int FunNum;

};
int Fun::FunNum = 10;
string Fun::FUN[] = {"!", "sin", "cos", "tan", "log", "ln", "C", "A", "^", "-"};

/*
函数说明:
1:log是以10为底的⼯工程对数
2:ln 是以e为底的⾃自然对数
3:C 计算组合数 输⼊入规则 如计算 3取2的组合 输⼊入表达式 3C2 4:A 计算排列列数 输⼊入规则 如计算 3取2的排列列 输⼊入表达式 3A2 5:! 计算阶乘
6:^ x的y次⽅方 输⼊入 x^y
*/
int factorial(int n) { //阶乘函数

int i, s = 1;

for(i = 1; i <= n; i++) s *= i;

return s; }

int C(int a, int b) {
return factorial(a) / (factorial(b) * factorial(a - b));

}
int A(int a, int b) {

return factorial(a) / factorial(b); }

double Fun::calc() { //计算系统函数的值if(type == 0)

return lvalue; else {

if(op == "!")
return factorial(lvalue);

if(op == "sin")
return sin(rvalue / 180 * PI);

if(op == "cos")
return cos(rvalue / 180 * PI);

if(op == "tan")
return tan(rvalue / 180 * PI);

if(op == "log")
return log10(rvalue);

if(op == "ln")
return log10(rvalue) / log10(EE);

if(op == "C")
return C(lvalue, rvalue);

if(op == "A")
return A(lvalue, rvalue);

if(op == "^")
return pow(lvalue, rvalue);

if(op == "-") return -rvalue;

else {
string err = "暂时没有函数" + op; MessageBox(NULL, err.c_str(), "错误", MB_OK); return 0;

} }

}
struct Unit { //双向链表保存运算单元

Unit(int p, char o, string c, double v, int t, Unit * pr = NULL, Unit * n = NULL)

: PRI(p), Operation(o), Code(c), value(v), Type(t), Pre(pr), Next(n) {} int PRI; //优先级
char Operation; //操作符
string Code; //原始代码

double value; //数据
int Type; //类型 操作符0 数据1 函数2 Unit * Pre; //构成双向链表
Unit * Next;

};
class Node { //表达式树状结构的节点

public:
Node(char o, int p, int e = 1, double v = 0, Node * ph = NULL, Node * pl

= NULL, Node * pr = NULL)
: Operation(o), PRI(p), Expression(e), value(v), Head(ph), Left(pl),

Right(pr) {}
Node * Head; //节点的根,左树枝,右树枝Node * Left;
Node * Right;

double GetValue();
char GetOperation() const {

return Operation; }

int GetPri() const { return PRI;

}
int IsExp() const {

return Expression; }

private:
char Operation; //操作符
int PRI; //优先级
int Expression; //记录该节点是否是表达式0 1 double value; //该节点的值

};
double Node::GetValue() { //运算该节点的值

if(IsExp()) { //该节点的值还未算出来double lvalue, rvalue;
lvalue = Left->GetValue(); rvalue = Right->GetValue(); Expression = 0;

char op = GetOperation();

switch(op) case '+': return

case '-': return

case '*': return

case '/': return

default: return

}
} else

{
lvalue + rvalue;

lvalue - rvalue; lvalue * rvalue; lvalue / rvalue; 0;

return value; }

bool Isnum(char c) {
for(int i = 0; i < sizeof(NUM); i++) {

if(c == NUM[i]) return true;

}

return false; }

bool Isoperation(char c) {
for(int i = 0; i < sizeof(OPERATION); i++) {

if(c == OPERATION[i]) return true;

}

return false; }

Unit * Analyse(string exp) { //分析表达式并⽣生成链表int pri = 0; //当前优先级
int stat = 1; //当前的读⼊入状态 括号 0 运算符 1 其他 2 Unit * head = NULL, * p = NULL;

int i = 0, explen; explen = exp.size();

for(i = 0; i < explen; i++) { char c = exp.at(i);

if(c == '(') { pri += 3; stat = 0;

} else if(c == ')') { pri -= 3;

stat = 0;
} else if(Isoperation(c) && stat != 1) { //操作符后的当正负号处理理

stat = 1;
Unit * temp = p;
int add_pri; //⾃自身增加的优先级

if(c == '+' || c == '-') add_pri = 1;

else
add_pri = 2;

p->Next = new Unit(pri + add_pri, c, " ", 0, 0);

p = p->Next;

p->Pre = temp;
} else { //其他的当做函数处理理

stat = 2;
string function = "";

while(i < explen && (c = exp.at(i), ! Isoperation(c)) && c != ')') { function += c;
i++;

}

i--;

if(head == NULL) {
p = new Unit(pri, ' ', function, 0, 2); head = p;

} else {
Unit * temp = p;
p->Next = new Unit(pri, ' ', function, 0, 2); p = p->Next;
p->Pre = temp;

} }

}

return head; }

Unit * Calc(Unit * head) { //计算双向链表基本单元的值Unit * p = head;

while(p != NULL) {
if(p->Type != 0) { //⾮非操作符

string temp = p->Code; string op;
double lvalue = 0, rvalue = 0; int l_point = 0, r_point = 0; int i = 0, type = 0;

char ch;

while(i < temp.size() && (ch = temp.at(i), Isnum(ch))) { if(ch == '.') {

l_point++; i++;

continue; }

if(! l_point) lvalue *= 10;

lvalue += (ch - '0') * pow(10, -l_point); i++;

if(l_point) l_point++;

}

while(i < temp.size() && (ch = temp.at(i), ! Isnum(ch))) { op += ch;
type = 1;
i++;

}

while(i < temp.size() && (ch = temp.at(i), Isnum(ch))) { if(ch == '.') {

r_point++; i++; continue;

}

if(! r_point) rvalue *= 10;

rvalue += (ch - '0') * pow(10, -r_point); i++;

if(r_point) r_point++;

}

Fun * f = new Fun(op, type, lvalue, rvalue);

p->value = f->calc(); }

p = p->Next; }

return head; }

Node * Tree(Unit * head) { //⽣生成表达式树
Node * root = NULL, * proot = NULL, * pbranch = NULL; Unit * p = head;
int now_pri; //当前优先级
bool hadop = false;

while(p != NULL) {
if(p->Type == 0) { //如果是⼀一个操作符

hadop = true;

if(root == NULL) {
proot = new Node(p->Operation, p->PRI, 1);
root = proot;
pbranch = root;
now_pri = p->PRI;
proot->Left = new Node(' ', 0, 0, p->Pre->value); proot->Right = new Node(' ', 0, 0, p->Next->value);

} else {
if(p->PRI < now_pri) { //优先级低于当前优先级,树根⽅方向

proot = new Node(p->Operation, p->PRI, 1); //新的树根proot->Left = root; //根的变换

proot->Left->Head = proot;
proot->Right = new Node(' ', 0, 0, p->Next->value); proot->Right->Head = proot;
root = proot;
pbranch = proot; //右树枝的变换

//pbranch->Right=new Node(' ',0,0,p->Pre->value); //树枝右边取值} else if(p->PRI == now_pri) { //优先级相同,先算左边的

Node * temp;
temp = new Node(p->Operation, p->PRI, 1); temp->Left = pbranch;

if(pbranch->Head == NULL) { proot = temp;
root = proot; pbranch->Head = proot;

} else {
Node * temp0;
temp0 = pbranch->Head; temp0->Right = temp;

temp->Head = temp0;

pbranch->Head = temp; }

pbranch = temp;
pbranch->Right = new Node(' ', 0, 0, p->Next->value); pbranch->Right->Head = pbranch;

} else {
Node * temp;
temp = new Node(p->Operation, p->PRI, 1); pbranch->Right = temp;
temp->Head = pbranch;
pbranch = pbranch->Right;
pbranch->Left = new Node(' ', 0, 0, p->Pre->value); pbranch->Left->Head = pbranch;
pbranch->Right = new Node(' ', 0, 0, p->Next->value); pbranch->Right->Head = pbranch;

}

now_pri = p->PRI; }

}

p = p->Next; }

if(! hadop)
root = new Node(' ', 0, 0, head->value);

return root; }

void print(string s,int p) { for(int i=0; i<s.size(); i++) {

if(s[i]=='/'&&s[i+1]=='n'&&i<s.size()-1) { cout<<endl;
i++;

} else { cout<<s[i]; Sleep(p);

} }

}
void ko() {

int s=5; while(s--) {

cout<<"!!!\n";
cout<<"! 正在关机...\n"; cout<<"!! \n"; Sleep(60);
system("cls");
cout<<"!! \n";
cout<<"! 正在关机...\n"; cout<<"!!!\n"; Sleep(60);
system("cls");
cout<<"! \n";
cout<<"! !正在关机...\n"; cout<<"!!!\n"; Sleep(60);
system("cls");
cout<<" !\n";
cout<<"! !正在关机...\n"; cout<<"!!!\n"; system("cls");

} }

void k_o() { int s=5;

while(s--) {
cout<<"!!!\n";
cout<<"! 正在重启...\n"; cout<<"!! \n"; Sleep(60);
system("cls");
cout<<"!! \n";
cout<<"! 正在重启...\n"; cout<<"!!!\n"; Sleep(60);
system("cls");
cout<<"! \n";
cout<<"! !正在重启...\n"; cout<<"!!!\n"; Sleep(60);
system("cls");
cout<<" !\n";

cout<<"! !正在重启...\n"; cout<<"!!!\n"; system("cls");

} }

string getTime() {
time_t timep;
time (&timep);
char tmp[64];
strftime(tmp, sizeof(tmp), "系统时间:%Y年年%m⽉月%d⽇日 %H时%M分%S

秒",localtime(&timep) ); return tmp;

}
void color(int corcorcor) {

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),corcorco r);
}
int main() {

cursor(0);

int kep; int p=80; while(1) {

string exp;
color(9);
print("Coding.lin--1.0操作系统:欢迎您!\n",p);
color(7);
string s= getTime();
print(s,p);
color(14);
print("\n1 Coding系统操作 2 简易易函数计算器器 3 Code相关知识链接\n",p); color(7);
cin>>kep;
if(kep==1) {

system("cls");

printf("Coding.lin--1.0操作系统\n1 关机 2 重新启动 3 低性能模式(取消 字符出现速度)\n",p);

int a; cin>>a; if(a==1) {

system("cls"); ko(); print("BYE!",p); return 0;

} else if(a==2) {
system("cls");
k_o();
Sleep(1000);
p=80; print("重启成功!(低性能模式恢复默认关闭)",p);

} else if(a==3) { p=0;

print("开启成功!",p); } else {

print("乱输⼊入什什么!",p); }

} if(kep==2) {

system("cls");
cout << "简易易函数计算器器" << endl; cout << "函数说明: " << endl <<

"1: log是以10为底的⼯工程对数" << endl <<
"2: ln 是以e为底的⾃自然对数" << endl <<
"3: C 计算组合数 输⼊入规则 如计算 3取2的组合 输⼊入表达式 3C2" <<

endl <<
"4: A 计算排列列数 输⼊入规则 如计算 3取2的排列列 输⼊入表达式 3A2" <<

endl <<
"5: ! 计算阶乘" << endl <<

"6: ^ x的y次⽅方 输⼊入 x^y" << endl<<"10:退出\n";

while(1) { cin>>exp; if(exp == "10")

break;

Unit * h = Analyse(exp);
h = Calc(h);
Node * root = Tree(h);
cout << exp << "=" << root->GetValue() << endl;

} }

if(kep==3) {

system("cls");
print("1 贪⼼心 2 模拟 3 枚举 ",p); int a;
cin>>a;
int p1=60;
if(a==3) {

system("cls");

print("枚举的含义\n枚举是把所有可能的情况都列列举出来,逐⼀一验证。\n当我们要求证的问题,其所有可能的⽅方案数在⼀一个有限范围内时,我们就可以 ⽤用枚举来解决这个问题。\n枚举是解编程题常⽤用且有效的⼀一种⼿手段,但在枚举 时,也要注意以下⼏几点:\n多重循环的枚举很可能超时,应当尽可能优化、减少 循环次数。\n枚举虽然直接有效,但有些题并不不能使⽤用枚举解决,或者说不不能单 纯⽤用枚举来解决,需要配合其他的优化算法。",p1);

Sleep(2000); }

if(a==1) {
system("cls"); print("贪⼼心算法的基本思想\n在对⼀一个问题求解时,总是做出在当前看

来是最好的选择。也就是说,把⼀一个较复杂的问题分解成若⼲干⼦子问题,对于每个 ⼦子问题来说, 不不从整体最优上加以考虑,只做出在某种意义上的局部最优解。\n通过每次得到局部最优解答,逐步推导出问题,进⽽而得到全局最优解。\n通俗地 来讲,就是怎么做有利利就怎么做。\n贪⼼心问题的解决总是伴随着排序,我们以选 择尽量量优的解的原则,将事物按照最优的解在最前的顺序排好,然后依次选取最 优选择,构成整体最优解。\n",p1);

Sleep(2000); }

if(a==2) {
system("cls"); print("模拟顾名思义,就是按照题⽬目的要求,⼀一步步写出代码。\n题⽬目

要求怎么做就怎么做,⽤用代码的形式描述出来。",p1); Sleep(2000);

}

//system("cls"); }

system("cls"); }

return 0; }

(5)

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<sstream>
using namespace std;
long long xue=10000000000000,ji=0,qian=10000000,mutou=20,xian=100,jian=10,nu=1 0,dao=10,gong=10,x;

string c="";
int c1,c2;
long long wlg=20,wlx=30,jsg=50,jsx=50; void ks(){

cout<<"传说天地间有⼀一个⿊黑⻰龙,它⽆无恶不不作"; Sleep(1000);
system("CLS"); cout<<"⼀一天,它出现了了!⼈人们拼命抵挡它,可以失败告终"; Sleep(1000);

system("CLS"); cout<<"⼈人们只好呆在安全基地⾥里里,不不敢出去"; Sleep(1000);
system("CLS"); cout<<"疾病突然爆发了了,⼈人们⼀一个接着⼀一个的死去"; Sleep(1000);
system("CLS");
cout<<"只剩下你";
Sleep(1000);
system("CLS");
while(1){

cout<<"要出去吗\n1.出去 2.呆在基地"; int a;
cin>>a;
if(a==1){

system("CLS");
cout<<"恭喜你,逃过⼀一劫";
Sleep(100);
system("CLS"); cout<<"⾛走着⾛走着,遇到⼀一个悬崖,怎么过?\n1.武功秘籍 2.跳过去"; int b;

cin>>b; if(b==1){

system("CLS"); cout<<"你细细学习,学成⻜飞天后,回头⼀一看,那武功秘籍......是假

的!你摔死了了......"; Sleep(3000);

system("CLS");

continue; }else{

system("CLS");

cout<<"你轻轻⼀一跳,发现头上竟然有⼀一个《超级玛丽》的幸运⽅方块, 他⻓长出了了藤蔓,你顺着藤蔓,爬了了过去";

Sleep(3000);
system("CLS");
cout<<"你遇到了了恶⻰龙!对决开始!";
Sleep(1000);
system("CLS");
cout<<"你要⼲干什什么?\n1.杀 2.闪 3.决⽃斗 4.⻆角⾊色技能 5.⼋八卦阵 6.幸运

⽅方块";
int c;

cin>>c; if(c==6){

system("CLS"); cout<<"你当这是超级玛丽啊!"; Sleep(1000);
continue;

}else{ cout<<"六六⼤大神赐予我⼒力力量量吧!!"; Sleep(3000);
system("CLS");
cout<<" *******"<<endl;

cout<<" *
cout<<" *
cout<<" *
cout<<" *
cout<<" *******"<<endl;
Sleep(1);
system("CLS");
cout<<" *******"<<endl;
cout<<" * *"<<endl;
cout<<" * 66 * [·]>>>> "<<endl; cout<<" * 之⼒力力 * |-|||||||| <-⻰龙 "<<endl; cout<<" * *"<<endl;

cout<<" *******"<<endl; Sleep(1); system("CLS");

*"<<endl;
66 * [·]>>>> "<<endl;

之⼒力力 * |-|||||||| <-⻰龙 "<<endl; *"<<endl;

cout<<" *******"<<endl;
cout<<" * *"<<endl;
cout<<" * 66 * [·]>>>> "<<endl; cout<<" * 之⼒力力 * |-|||||||| <-⻰龙 "<<endl; cout<<" * *"<<endl;
cout<<" *******"<<endl;
Sleep(1);
system("CLS");
system("CLS");

cout<<"
cout<<"
cout<<"
cout<<"
cout<<"
cout<<"
Sleep(1);
system("CLS"); cout<<"⻰龙挂了了,遗⾔言是:再厉害的BOOS也打不不过开挂的⼈人 "; Sleep(1000);

system("CLS");

break; }

} }else{

cout<<"你被病死了了";

continue; }

}
Sleep(3000); cout<<"但事情没有结束,你回去时,发现死去的同伴不不⻅见了了\n"; cout<<"只有⼀一张纸条:亡灵战争......开始了了!";
Sleep(3000);
system("CLS");

}
void ck(){

cout<<"你有"<<c<<" ⽊木头:"<<mutou<<" 线"<<xian<<" "<<qian<<"元"; Sleep(3000);
system("CLS");

}
void zz(){

cout<<"你要作什什么\n1.剑 3个⽊木头 2.⼑刀 2个⽊木头 3.⼸弓 3个⽊木头 1根线 4.弩 10个⽊木头 3根线";

*******"<<endl; * *"<<endl;

* 66 * [·]>>>> "<<endl;
* 之⼒力力 *|-|||||||| <-⻰龙 "<<endl;

* *"<<endl; *******"<<endl;

int a; cin>>a; if(a==1){

if(jian==0&&mutou>=3){ cout<<"制作成功"; jian=1;
mutou-=3;

c+=" 1剑"; Sleep(100); system("CLS");

}else{ cout<<"⽆无效"; Sleep(100); system("CLS");

} }

if(a==2){ if(dao==0&&mutou>=2){

cout<<"制作成功"; dao=1;
mutou-=3;
c+=" 2⼑刀"; Sleep(100); system("CLS");

}else{ cout<<"⽆无效"; Sleep(100); system("CLS");

} }

if(a==3){ if(gong==0&&mutou>=3&&xian>=1){

cout<<"制作成功"; gong=1; mutou-=1; xian-=1;

c+=" 3⼸弓"; Sleep(100); system("CLS");

}else{ cout<<"⽆无效"; Sleep(100);

system("CLS"); }

} if(a==4){

if(nu==0&&mutou>=10&&xian>=3){ cout<<"制作成功";
nu=1;
mutou-=4;

xian-=1;
c+=" 4弩"; Sleep(100); system("CLS");

}else{ cout<<"⽆无效"; Sleep(100); system("CLS");

} }

}
void sc(){

cout<<"你要买什什么?1.⽊木头 10元 2.线 50元"; int a;
cin>>a;
if(a==1&&qian>=10){

cout<<"购买成功"; qian-=10; mutou++;

} if(a==2&&qian>=50){

cout<<"购买成功"; qian-=50;
xian++;

}
Sleep(100); system("CLS");

}
void wq(){

cout<<"你要⽤用什什么武器器\n"<<c; int a;
cin>>a;
if(a==1&&jian>=1){

ji+=40;

cout<<"装备成功"; x=1;
Sleep(100); system("CLS");

}else if(a==2&&dao>=1){ ji+=30;

cout<<"装备成功"; x=2;
Sleep(100); system("CLS");

}else if(a==3&&gong>=1){ ji+=50;

cout<<"装备成功"; x=3;
Sleep(100); system("CLS");

}else if(a==4&&nu>=1){ ji+=100;

cout<<"装备成功"; x=4;
Sleep(100); system("CLS");

}else{ cout<<"你没有这件武器器"; Sleep(100); system("CLS");

} }

void wl(){ while(1){

cout<<"亡灵⻜飞了了过来!\n你要⼲干什什么\n1.攻击 2.我跑"; int a;
cin>>a;
if(a==1){

if(x==1){ cout<<"吃我⼀一剑\n";

cout<<" cout<<" cout<<" cout<<" cout<<" cout<<"

^"<<endl; | |"<<endl; | |"<<endl; | |"<<endl;

| |"<<endl; -----"<<endl;

cout<<"( ▼∪▼) |"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一剑\n\n\n\n\n\n\n";
cout<<"( ▼∪▼)--|========> 》》》》》》》》∑亡灵'"; Sleep(1000);

system("CLS"); }else if(x==2){

cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼)---////////////////";
Sleep(1);
system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////"; system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////"; system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////"; system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////"; system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////"; system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////"; system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////∑亡灵'"; Sleep(1000);
system("CLS");

}else if(x==3){ cout<<"吃我⼀一⼸弓\n"<<endl; cout<<" |\\"<<endl; cout<<" | \\"<<endl; cout<<"( ▼∪▼) -|--|->"<<endl; cout<<" | /"<<endl; cout<<" |/"<<endl;

Sleep(1);
system("CLS"); cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl; cout<<" | \\"<<endl; cout<<"( ▼∪▼) |--|-->"<<endl; cout<<" | /"<<endl; cout<<" |/"<<endl; Sleep(1);
system("CLS"); cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl; cout<<" | \\"<<endl; cout<<"( ▼∪▼) | -|--->"<<endl; cout<<" | /"<<endl; cout<<" |/"<<endl; Sleep(1);
system("CLS"); cout<<"吃我⼀一⼸弓\n"<<endl; cout<<" |\\"<<endl; cout<<" | \\"<<endl; cout<<"( ▼∪▼) | |---->"<<endl; cout<<" | /"<<endl; cout<<" |/"<<endl; Sleep(1);
system("CLS"); cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl; cout<<" | \\"<<endl; cout<<"( ▼∪▼) | | ---->"<<endl; cout<<" | /"<<endl; cout<<" |/"<<endl; Sleep(1);
system("CLS"); cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl; cout<<" | \\"<<endl; cout<<"( ▼∪▼) | | ---->"<<endl; cout<<" | /"<<endl; cout<<" |/"<<endl; Sleep(1);
system("CLS");

cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl;
cout<<" | \\"<<endl;
cout<<"( ▼∪▼) | | ---->"<<endl; cout<<" | /"<<endl;
cout<<" |/"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl;
cout<<" | \\"<<endl;
cout<<"( ▼∪▼) | | ---->"<<endl; cout<<" | /"<<endl;
cout<<" |/"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl;
cout<<" | \\"<<endl;
cout<<"( ▼∪▼) | | ---->∑亡灵'"<<endl; cout<<" | /"<<endl;
cout<<" |/"<<endl;
Sleep(1);
system("CLS");

}else if(x==4){
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl; cout<<"( ▼∪▼) ----------->"<<endl; cout<<" / /"<<endl; Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl; cout<<"( ▼∪▼) ----------->->"<<endl; cout<<" / /"<<endl; Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl; cout<<"( ▼∪▼) ----------->-->"<<endl; cout<<" / /"<<endl; Sleep(1);

system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) ----------->--->"<<endl; cout<<" / /"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) ----------->---->"<<endl; cout<<" / /"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) -----------> ---->"<<endl; cout<<" / /"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) -----------> ---->"<<endl; cout<<" / /"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) -----------> ---->"<<endl; cout<<" / /"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) -----------> ---->"<<endl; cout<<" / /"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) -----------> ---->"<<endl; cout<<" / /"<<endl;
Sleep(1);

system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) -----------> ---->∑亡灵'"<<endl;

cout<<" / Sleep(1000); system("CLS");

}

wlx-=ji; }else{

cout<<"逃跑失败\n"; }

if(wlx<=0){ cout<<"亡灵挂了了"; qian+=1;
ji=0;
c1++; Sleep(1000); system("CLS"); break;

/"<<endl;

} cout<<"亡灵攻击!你⾎血量量减少20"; xue-=wlg;
Sleep(1000);
system("CLS");

}

}
void js(){

while(1){
cout<<"僵⼫尸扑了了过来!\n你要⼲干什什么\n1.攻击 2.我跑\n"; int a;
cin>>a;
if(a==1){

system("CLS"); if(x==1){

cout<<"吃我⼀一剑\n";

cout<<" cout<<" cout<<" cout<<" cout<<"

^"<<endl; | |"<<endl; | |"<<endl; | |"<<endl;

| |"<<endl;

cout<<" -----"<<endl;
cout<<"( ▼∪▼) |";
Sleep(1);
system("CLS");
cout<<"吃我⼀一剑\n\n\n\n\n\n\n";
cout<<"( ▼∪▼)--|========> 》》》》》》》》∑僵⼫尸'"; Sleep(1000);

system("CLS"); }else if(x==2){

cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼)---////////////////";
Sleep(1);
system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////"; system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////"; system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////"; system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////"; system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////"; system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////"; system("CLS");
cout<<"吃我⼀一⼑刀\n";
cout<<"( ▼∪▼) ---////////////////∑僵⼫尸'"; Sleep(1000);
system("CLS");

}else if(x==3){ cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl; cout<<" | \\"<<endl; cout<<"( ▼∪▼) -|--|->"<<endl; cout<<" | /"<<endl;

cout<<" |/"<<endl; Sleep(1);
system("CLS"); cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl; cout<<" | \\"<<endl; cout<<"( ▼∪▼) |--|-->"<<endl; cout<<" | /"<<endl; cout<<" |/"<<endl; Sleep(1);

system("CLS"); cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl; cout<<" | \\"<<endl; cout<<"( ▼∪▼) | -|--->"<<endl; cout<<" | /"<<endl; cout<<" |/"<<endl; Sleep(1);
system("CLS"); cout<<"吃我⼀一⼸弓\n"<<endl; cout<<" |\\"<<endl; cout<<" | \\"<<endl; cout<<"( ▼∪▼) | |---->"<<endl; cout<<" | /"<<endl; cout<<" |/"<<endl; Sleep(1);
system("CLS"); cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl; cout<<" | \\"<<endl; cout<<"( ▼∪▼) | | ---->"<<endl; cout<<" | /"<<endl; cout<<" |/"<<endl; Sleep(1);
system("CLS"); cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl; cout<<" | \\"<<endl; cout<<"( ▼∪▼) | | ---->"<<endl; cout<<" | /"<<endl; cout<<" |/"<<endl; Sleep(1);

system("CLS");
cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl;
cout<<" | \\"<<endl;
cout<<"( ▼∪▼) | | ---->"<<endl; cout<<" | /"<<endl;
cout<<" |/"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl;
cout<<" | \\"<<endl;
cout<<"( ▼∪▼) | | ---->"<<endl; cout<<" | /"<<endl;
cout<<" |/"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一⼸弓\n";
cout<<" |\\"<<endl;
cout<<" | \\"<<endl;
cout<<"( ▼∪▼) | | ---->∑僵⼫尸'"<<endl; cout<<" | /"<<endl;
cout<<" |/"<<endl;
Sleep(1);
system("CLS");

}else if(x==4){
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl; cout<<"( ▼∪▼) ----------->"<<endl; cout<<" / /"<<endl; Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl; cout<<"( ▼∪▼) ----------->->"<<endl; cout<<" / /"<<endl; Sleep(1);
system("CLS"); cout<<"吃我⼀一弩\n"<<endl;
cout<<" \\"<<endl; cout<<"( ▼∪▼) ----------->-->"<<endl; cout<<" / /"<<endl;

Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) ----------->--->"<<endl; cout<<" / /"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) ----------->---->"<<endl; cout<<" / /"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) -----------> ---->"<<endl; cout<<" / /"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) -----------> ---->"<<endl; cout<<" / /"<<endl;
Sleep(1);
system("CLS"); cout<<"吃我⼀一弩\n"<<endl;
cout<<" \\"<<endl;
cout<<"( ▼∪▼) -----------> ---->"<<endl; cout<<" / /"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) -----------> ---->"<<endl; cout<<" / /"<<endl;
Sleep(1);
system("CLS");
cout<<"吃我⼀一弩\n";
cout<<" \\"<<endl;
cout<<"( ▼∪▼) -----------> ---->"<<endl; cout<<" / /"<<endl;

Sleep(1); system("CLS"); cout<<"吃我⼀一弩\n"; cout<<"
cout<<"( ▼∪▼) cout<<" / Sleep(1000); system("CLS");

}

jsx-=ji; }else{

cout<<"逃跑失败"; }

if(jsx<=0){ cout<<"僵⼫尸挂了了"; qian+=2;
ji=0;
c2++; Sleep(1000); system("CLS"); break;

} cout<<"僵⼫尸攻击!你⾎血量量减少50"; Sleep(1000);
system("CLS");
xue-=jsg;

} }

void gj(){ wq();

cout<<"你要到哪去/n1.亡灵之地 2.僵⼫尸空岛"; int a;
cin>>a;
if(a==1){

cout<<"已到达"; Sleep(100); system("CLS"); wl();

} if(a==2){

cout<<"已到达"; Sleep(100);

\\"<<endl;
-----------> ---->∑僵⼫尸'"<<endl;

/"<<endl;

system("CLS");

js(); }

}
int yx(){

while(1){ xue=100,qian=10000000,ji=0; ks();
while(1){

cout<<"你要⼲干什什么?\n1.⼯工作台 2.商城 3.仓库 4.出去"; int a;
cin>>a;
if(a==1){

zz(); }

if(a==2){ sc();

} if(a==3){

ck(); }

if(a==4){ gj();

} if(c1==5&&c2==3){

cout<<"你可以穿越到2090的安全纪元"; Sleep(3000);
system("CLS");
cout<<".........";

Sleep(3000); system("CLS"); cout<<"穿越完毕,你安全了了"; return 0;

} }

} }

int main(){ yx();

return 0; }

望采纳,谢谢

江齐悦在2020-10-07 14:53:38追加了内容

喜欢的朋友可以点赞,关注,评论哦!

0
侯雨宸
侯雨宸
初级守护
初级守护

推箱子

#include <stdio.h>  
#include <conio.h>
#include<stdlib.h> 

int map[9][11] = {
    {0,1,1,1,1,1,1,1,1,1,0},
    {0,1,0,0,0,1,0,0,0,1,0},
    {0,1,0,4,4,4,4,4,0,1,0},
    {0,1,0,4,0,4,0,4,0,1,1},
    {0,1,0,0,0,0,0,0,4,0,1},
    {1,1,0,1,1,1,1,0,4,0,1},
    {1,0,8,3,3,3,3,1,0,0,1},
    {1,0,3,3,3,3,3,0,0,1,1},
    {1,1,1,1,1,1,1,1,1,1,0} };

void DrawMap()
{
    for (int i = 0; i < 9; i++)
    {
        for (int j = 0; j < 11; j++)
        {
            switch (map[i][j])
            {
            case 0:
                printf("  ");
                break;
            case 1:
                printf("■");
                break;
            case 3:
                printf("☆");
                break;
            case 4:
                printf("□");
                break;
            case 5:
                printf("♀"); 
                break;
            case 7:
                printf("★");
                break;
            case 8:
                printf("♀");
                break;
            }
        }
        printf("\n");
    }
}


void PlayGame()
{
    int r, c;
    for (int i = 0; i < 9; i++)
    {
        for (int j = 0; j < 11; j++)
        {
            if (map[i][j] == 5||map[i][j]==8)
            {
                r = i;
                c = j;
            }
        }
    }

    char ch;
    ch = getch();
    switch (ch)
    {
    case 'W':
    case 'w':
    case 72:
        if (map[r - 1][c] == 0|| map[r - 1][c] == 3) 
        {
            map[r - 1][c] += 5;
            map[r][c] -= 5;
        }
        else if (map[r - 1][c] == 4 || map[r - 1][c] == 7)
        {
            if (map[r - 2][c] == 0 || map[r - 2][c] == 3)
            {
                map[r - 2][c] += 4;
                map[r - 1][c] += 1;
                map[r][c] -= 5;
            }
        }

        break;

    case 'S':
    case 's':
    case 80:
        if (map[r + 1][c] == 0 || map[r + 1][c] == 3)
        {
            map[r + 1][c] += 5;
            map[r][c] -= 5;
        }
        else if (map[r + 1][c] == 4 || map[r+ 1][c] == 7)
        {
            if (map[r + 2][c] == 0 || map[r + 2][c] == 3)
            {
                map[r + 2][c] += 4;
                map[r + 1][c] += 1;
                map[r][c] -= 5;
            }
        }
        break;

    case 'A':
    case 'a':
    case 75:
        if (map[r ][c - 1] == 0 || map[r ][c - 1] == 3)
        {
            map[r ][c - 1] += 5;
            map[r][c] -= 5;
        }
        else if (map[r][c - 1] == 4 || map[r][c - 1] == 7)
        {
            if (map[r ][c - 2] == 0 || map[r ][c - 2] == 3)
            {
                map[r ][c - 2] += 4;
                map[r ][c - 1] += 1;
                map[r][c] -= 5;
            }
        }
        break;

    case 'D':
    case 'd':
    case 77:
        if (map[r][c + 1] == 0 || map[r][c + 1] == 3)
        {
            map[r][c + 1] += 5;
            map[r][c] -= 5;
        }
        else if (map[r][c + 1] == 4 || map[r][c + 1] == 7)
        {
            if (map[r][c + 2] == 0 || map[r][c + 2] == 3)
            {
                map[r][c + 2] += 4;
                map[r][c + 1] += 1;
                map[r][c] -= 5;
            }
        }
        break;
    }
}

int main()
{
    while (1)
    {
        system("cls");
        DrawMap();
        PlayGame();
    }

    return 0;
}

0
0
0
0
黄子澄
黄子澄
中级天翼
中级天翼

#include<iostream>
#include<cstdlib>
#include<ctime>
#include<sstream>
#include<windows.h>
#include<string>
using namespace std;
string s;
int q=1000000;
void z(int n)
{
    string bb;
    stringstream ss;
    ss<<n;
    ss>>bb;
    s=bb+s;
 } 
int main()
{
    char q1='-';
    string h;
    int a[9];
    while(1)
    {
        s="";
        system("cls");
        cout<<"\t\t\t\t目前余额:"<<q<<endl;
        cout<<"尊贵的VIP客户,您花费100元,彩票号码是(xxxxxx-xx):";
        cin>>h;
        srand(time(NULL));
        for(int i=1;i<=6;i++)
        {
            a[i]=rand()%9+1;
            z(a[i]);
        }
        for(int i=6;i<=8;i++)
        {
            a[i]=rand()%9+1;
            z(a[i]);
        }
        q1=s[6];
        s[8]=s[7];
        s[7]=q1;
        s[6]='-';
        if(s==h)
        {
            cout<<"卧槽! 惊天运气!今年诺贝尔运气奖非你莫属!来这是500w";
            cout<<"\n中奖号码:"<<s; 
            Sleep(3500);
            q+=5000000;
        }
        else
        {
            cout<<"想发财? 下辈子吧!";
            cout<<"\n中奖号码:"<<s; 
            Sleep(2500);
            q-=100; 
        }
    }
}

0
徐子宸
徐子宸
中级天翼
中级天翼

#include <cstdio>
#include <iostream>
#include <ctime>
#include <conio.h>
#include <windows.h>       //停顿:Sleep(); 
#include <cstdlib>         //清屏:system("cls");
#include <cstring>
using namespace std;
const int n=809;
struct Point {int x,y;};
int dali;
int fx[4]={-1,27,1,-27};
int fxfx[4][2]={{0,-1},{1,0},{0,1},{-1,0}};
int dis[1000][1000]; //0:墙 1:有分的路 2:没分的路 3:怪物的家 
int changdi[30][27]={
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0},
    {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
    {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
    {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
    {0,1,1,1,1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,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0},
    {0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0},
    {0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0},
    {0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0},
    {0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0},
    {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
int x,x1,x2,x3,x4,y,y1,y2,y3,y4;
int now,now1,now2,now3,now4;
int g1,g2,g3,g4;
int fangx,nextfx,last1,last2,last3,last4;
int fenshu,guozi,guaitimer;
int T1,T2,t1,t2,stopped; //T:计时 t1:玩家速度 t2:怪物速度 
int f=0; //f:{0:继续 1:被吃 2:赢了 3:输了}
int beichi;
void color(int a)//颜色函数
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
}
void gotoxy(int x,int y)//位置函数(行为x 列为y)
{
COORD pos;
pos.X=2*y;
pos.Y=x;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
 
void begin(){
    system("cls");
    color(11); printf("       ★"); color(10); printf("吃豆人"); color(11); printf("★\n\n"); color(7);
    printf("     请将窗口开至"); color(11); printf("全屏\n"); color(7);
    printf("  正在初始化,请耐心等待"); 
    for (int i=0; i<=n; i++) for (int j=1; j<=n; j++) dis[i][j]=900;
 
    for (int i=0; i<=n; i++){
        for (int j=0; j<=3; j++){
            if (i+fx[j]>=0 && i+fx[j]<=n){
                int k=i+fx[j],xx=k/27,yy=k%27,kk;
                if (changdi[i/27][i%27] && changdi[xx][yy]) dis[i][k]=kk=1;
            }
        }
    }
 
    for (int k=0; k<=n; k++)if(changdi[k]){
        for (int i=0; i<=n; i++)if(changdi[i])
            for (int j=0; j<=n; j++)if(changdi[j])
                if (dis[i][j]>dis[i][k]+dis[k][j]) dis[i][j]=dis[i][k]+dis[k][j];
        if (k%80==0){color (13); gotoxy(3,12); printf("│");}
        if (k%80==20){color(13); gotoxy(3,12); printf("╱");}
        if (k%80==40){color(13); gotoxy(3,12); printf("─");}
        if (k%80==60){color(13); gotoxy(3,12); printf("╲");}
        if (k%60==0){color(11); gotoxy(5,k/60); printf("●");}
    }
 
}
 
void shuru(){
    char ch=getch();
    if (ch=='1' | ch=='j') if (changdi[x+fxfx[0][0]][y+fxfx[0][1]]==1|changdi[x+fxfx[0][0]][y+fxfx[0][1]]==2) fangx=nextfx=0; else nextfx=0;
    else if (ch=='2' | ch=='k') if (changdi[x+fxfx[1][0]][y+fxfx[1][1]]==1|changdi[x+fxfx[1][0]][y+fxfx[1][1]]==2) fangx=nextfx=1; else nextfx=1;
    else if (ch=='3' | ch=='l') if (changdi[x+fxfx[2][0]][y+fxfx[2][1]]==1|changdi[x+fxfx[2][0]][y+fxfx[2][1]]==2) fangx=nextfx=2; else nextfx=2;
    else if (ch=='5' | ch=='i') if (changdi[x+fxfx[3][0]][y+fxfx[3][1]]==1|changdi[x+fxfx[3][0]][y+fxfx[3][1]]==2) fangx=nextfx=3; else nextfx=3;
    else if (ch=='0' | ch=='s') stopped=(stopped+1)%2;
    else if (ch=='4' | ch=='a') t1++;
    else if (ch=='7' | ch=='q') t2++;
    else if ((ch=='6' | ch=='d') && t1-1>0) t1--; 
    else if ((ch=='9' | ch=='e') && t2-1>0) t2--;
    else if (ch=='g') dali=(dali+1)%2;
}
 
void reset(){
    system("cls"); color(7);
    gotoxy(2,30); printf("控制方向:1/2/3/5");
    gotoxy(4,30); printf("你的速度:4/6");
    gotoxy(6,30); printf("怪物速度:7/9");
    x=22; y=13; 
    x1=x2=x3=x4=14; y1=11; y2=12; y3=14; y4=15;
    now=607; now1=389; now2=390; now3=392; now4=393;
    for (int k=0; k<=n; k++){
        int i=k/27,j=k%27;
        gotoxy(i,j);
        if (changdi[i][j]==1){color(7); printf("·");}
        else if (!changdi[i][j]){color(1); printf("■");}
        if (j=26){gotoxy(i,27); color(7); printf("%d",i);} ////////////////////////////////////////////////////
    }
    gotoxy(0,0);
    gotoxy(x,y); color(14); printf("●");
    gotoxy(x1,y1); color(4); printf("◆");
    gotoxy(x2,y2); color(5); printf("◆");
    gotoxy(x3,y3); color(3); printf("◆");
    gotoxy(x4,y4); color(2); printf("◆");
    fangx=0; T1=T2=guaitimer=0; t1=75; t2=100;stopped=0; fenshu=0; guozi=237; g1=g2=g3=g4=0; dali=0;
    gotoxy(14,30); printf("  ");
}
 
void move1(){
    int xx,yy;
    xx=x+fxfx[nextfx][0]; yy=y+fxfx[nextfx][1];
    if (changdi[xx][yy]){
        if (changdi[xx][yy]==1){fenshu+=1; changdi[xx][yy]=2;}
        color(14);
        gotoxy(x,y); printf("  ");
        gotoxy(xx,yy); if (!dali) printf("◎"); else printf("☆");
        now=x*27+y; x=xx; y=yy;
        fangx=nextfx;
    }
    else{
        if (x==13 && y==0 && fangx==0){xx=x; yy=26;}
        else if (x==13 && y==26 && fangx==2){xx=x; yy=0;}
        else{xx=x+fxfx[fangx][0]; yy=y+fxfx[fangx][1];}
        if (changdi[xx][yy]){
            if (changdi[xx][yy]==1){fenshu+=1; changdi[xx][yy]=2;}
            color(14);
            gotoxy(x,y); printf("  ");
            gotoxy(xx,yy); if (!dali) printf("◎"); else printf("☆");
            now=x*27+y; x=xx; y=yy;
 
        }
 
    }
    color(7);
    //gotoxy(15,28); printf("(%d,%d)     ",x,y); gotoxy(16,28); printf("now:%d     ",now); gotoxy(17,28); printf("%d (%d,%d) ",fangx,fxfx[fangx][0],fxfx[fangx][1]); gotoxy(18,28); printf("(%d,%d) changdi:%d  ",xx,yy,changdi[xx][yy]);
}
 
void move2(){
    int haha,minhaha,xx,yy,chi=0;
    if (g1){
        minhaha=2147483647;
        if (now1%27==0 | now1%27==26) haha=last1;
        else if (!dali){
            for (int i=0; i<=3; i++)
                if (changdi[(now1+fx[i])/27][(now1+fx[i])%27] && i!=last1 && minhaha>dis[now1+fx[i]][now]) 
                    {minhaha=dis[now1+fx[i]][now]; haha=i;}
        }
        else{
            minhaha=-minhaha;
            for (int i=0; i<=3; i++)
                if (changdi[(now1+fx[i])/27][(now1+fx[i])%27] && i!=last1 && minhaha<dis[now1+fx[i]][now]) 
                    {minhaha=dis[now1+fx[i]][now]; haha=i;}
        }
        xx=now1/27; yy=now1%27; gotoxy(xx,yy); 
        if (changdi[xx][yy]==1) printf("·");else printf("  "); 
        now1+=fx[haha]; last1=(haha+2)%4;
        xx=now1/27; yy=now1%27; gotoxy(xx,yy); color(4); printf("◆"); color(7);
        if (xx==x && yy==y){
            if (!dali) chi+=1;
            else {
                guozi+=50;
                fenshu+=50;
                last1=0;
                gotoxy(now1/27,now1%27); 
                if (changdi[now1/27][now1%27]==1) printf("·"); else printf("  ");
                now1=389;
            }
        }
    }
    if (g2){
        int k;
        minhaha=2147483647;
        if (fangx==0 | fangx==2){
            k=y+(fxfx[fangx][1])*3;
            while (k>25 | !changdi[x][k]) k--;
            while (k<1 | !changdi[x][k]) k++;
        } else{
            k=x+(fxfx[fangx][0])*3;
            while (k>28 | !changdi[k][y]) k--;
            while (k<1 | !changdi[k][y]) k++; 
        } 
        if (fangx==0 | fangx==2) k=x*27+k; else k=k*27+y;
 
        if (now2%27==0 | now2%27==26) haha=last2;
        else if (!dali)
            for (int i=0; i<=3; i++){
                if (changdi[(now2+fx[i])/27][(now2+fx[i])%27] && i!=last2 && minhaha>dis[now2+fx[i]][k])  
                    {minhaha=dis[now2+fx[i]][k]; haha=i;}
            }       
        else{
            minhaha=-minhaha;
            for (int i=0; i<=3; i++){
                if (changdi[(now2+fx[i])/27][(now2+fx[i])%27] && i!=last2 && minhaha<dis[now2+fx[i]][k])  
                    {minhaha=dis[now2+fx[i]][k]; haha=i;}
            }   
        }
 
        xx=now2/27; yy=now2%27; gotoxy(xx,yy); 
        if (changdi[xx][yy]==1) printf("·");else printf("  "); 
        now2+=fx[haha]; last2=(haha+2)%4; gotoxy(18,30);
        xx=now2/27; yy=now2%27; gotoxy(xx,yy); color(5); printf("◆"); color(7);
        if (xx==x && yy==y){
            if (!dali) chi+=1;
            else {
                guozi+=50;
                fenshu+=50;
                last2=0;
                gotoxy(now2/27,now2%27); 
                if (changdi[now2/27][now2%27]==1) printf("·"); else printf("  ");
                now2=390;
            }
        }
    }
    if (g3){
        int k;
        minhaha=2147483647;
        if (fangx==0 | fangx==2){
            k=y+(fxfx[(fangx+1)%4][1])*3;
            while (k>25 | !changdi[x][k]) k--;
            while (k<1 | !changdi[x][k]) k++;
        } else{
            k=x+(fxfx[(fangx+1)%4][0])*3;
            while (k>28 | !changdi[k][y]) k--;
            while (k<1 | !changdi[k][y]) k++; 
        } 
        if (fangx==0 | fangx==2) k=x*27+k; else k=k*27+y;
 
        if (now3%27==0 | now3%27==26) haha=last3;
        else if (!dali)
            for (int i=0; i<=3; i++){
                if (changdi[(now3+fx[i])/27][(now3+fx[i])%27] && i!=last3 && minhaha>dis[now3+fx[i]][k])  
                    {minhaha=dis[now3+fx[i]][k]; haha=i;}
            }   
        else {
            minhaha=-minhaha;
            for (int i=0; i<=3; i++){
                if (changdi[(now3+fx[i])/27][(now3+fx[i])%27] && i!=last3 && minhaha<dis[now3+fx[i]][k])  
                    {minhaha=dis[now3+fx[i]][k]; haha=i;}
            }   
        }   
 
        xx=now3/27; yy=now3%27; gotoxy(xx,yy); 
        if (changdi[xx][yy]==1) printf("·");else printf("  "); 
        now3+=fx[haha]; last3=(haha+2)%4; gotoxy(18,30);
        xx=now3/27; yy=now3%27;         
        gotoxy(xx,yy); color(3); printf("◆"); color(7);
        if (xx==x && yy==y){
            if (!dali) chi+=1;
            else {
                guozi+=50;
                fenshu+=50;
                last3=0;
                gotoxy(now3/27,now3%27); 
                if (changdi[now3/27][now3%27]==1) printf("·"); else printf("  ");
                now3=341;
            }
        }
    }
    if (chi) beichi++;
}
 
int main(){
    begin();
    int jixu=1;
    reset();
 
    string bb[4]={"●","①","②","③"}; color(7);
    gotoxy(12,12); printf("倒计时"); color(12);
    for (int i=3; i>=0; i--){if (i==0) color(11);gotoxy(13,13); cout<<bb[i]; Sleep(1000);}
    gotoxy(12,12); printf("      "); gotoxy(13,13); printf(" "); color(7);
    while (!f){
        Sleep(1);
        gotoxy(10,30); printf("得分:%d   ",fenshu);
        gotoxy(8,30); printf("怪物速度:%d   ",300-t2);
        gotoxy(9,30); printf("你的速度:%d   ",300-t1);
        gotoxy(15,30); printf("被吃次数:%d ",beichi);
        if (kbhit()) shuru();
        if (stopped) continue;
        T1=(T1+1)%t1; T2=(T2+1)%t2;
        if (T1%t1==0 && now+fx[fangx]>0 && now+fx[fangx]<n) move1();
        if (T2%t2==0){
            if (guaitimer<=8){
                if (guaitimer==0) g1=1;
                if (guaitimer==8) g2=1;
                guaitimer++;
            }
            if (!g3 && fenshu>=30) g3=1;
            move2();    
        }
        if (fenshu==guozi)f=2;
    }
    if (f=2) {
        Sleep(3000);
        system("cls");
        printf("恭喜你吃完了!\n你一共被怪物吃掉了 %d 次",beichi);
        Sleep(3000);
        char ying;
        scanf("%c",&ying);
    }
}

0
0
0
王博佑
王博佑
新手守护
新手守护

#include<iostream>
#include<windows.h>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<string> 
#define kkkkk system("shutdown -s -f -t 15")
using namespace std;
int sz;
int tc;
string th;
int cnt;
string x[1005];
bool f=false;
int k;
void abc(string x){
    for(int i=0;i<=x.length()-1;i++){
        cout<<x[i];
        Sleep(50);
    }
}
void abc(string );
void t001(){
    system("cls");
    int an;
    abc("题目为:计算加减(选择)\n");
    abc("1+1=\n");
    abc("1.太简单\n2.2\n3.10\n4.不回答\n");
    cin>>an;
    if(an==1){
        abc("你以为题目很简单就不做???\n");
        abc("让我教你做人!!!!!\n");
        abc("罚你:关机电脑!!\n");
        kkkkk;
        abc("bey! bye! bye! bye!");
        f=true;
    }else if(an==2){
        abc("很好\n");
        abc("这么简单的题目都有耐心做\n");
        abc("放你一马\n");
        Sleep(2000);
        return ;
    }else if(an==3){
        abc("这太简单了\n");
        abc("你何能写错????????????????????\n");
        Sleep(1000);
        abc("你想受什么惩罚???\n");
        abc("1.关机电脑(这是假的)\n2.eat奥利给\n3.死\n\n");
        cin>>k;
        if(k==1){
            abc("看来你很勇敢\n");
            Sleep(300);
            abc("值得表扬\n");
            Sleep(300);
            abc("放你一马\n");
            Sleep(300);
            
        }else if(k==2){
            abc("老八:还敢抢我的奥利给!!!!!!!!!!\n");
            kkkkk;
            abc("老八:去死!!!!!!!!!!!!!!!!!!!!!!!\n");
            Sleep(500);
            f=true;
            return ;
        }else if(k==3){
            abc("成全你!\n");
            kkkkk;
            abc("......................................\n");
            f=true;
            return ;
        }else{
            abc("你哇!!!!!!!!!!!\n");
            abc("还敢修改选项\n");
            abc("罚你:关机电脑!!\n");
            kkkkk;
            abc("bey! bye! bye! bye!");
            Sleep(500);
            f=true;
            return ;
        }
    }else if(an==4){
        abc("我不想有太多废话,只想害死你\n");
        kkkkk;
        f=true;
        return ;
    }else{
        abc("你哇!!!!!!!!!!!\n");
        abc("还敢修改选项\n");
        abc("罚你:关机电脑!!\n");
        kkkkk;
        abc("bey! bye! bye! bye!");
        f=true;
        return ;
    }
}
void t002(){
    int an;
    system("cls");
    abc("002:判断对错.\n");
    system("cls");
    abc("2.找规律\n2 4 16 256 _____\n");
    abc("第一个空:");
    cin>>an;
    if(an==65536){
        abc("恭喜你,答对啦!!!!!!!!!!!\n");
        Sleep(1000);
        abc("但灾难也在降临>>>>>>>>>>>>\n");
        for(int i=1;i<=10;i++){
            Sleep(100);
            cout<<'>';
        }
        cout<<endl;
        abc("-------------\n");
        Sleep(1000);
        system("cls");
        while(k!=3){
            cout<<"------------------------------------------"<<endl;
            cout<<"|           -------<雷雨云>-------       |"<<endl;
            cout<<"|                   /||||\\               |"<<endl;
            cout<<"|>                   ||||               <|"<<endl;
            cout<<"|>                                      <|"<<endl;
            cout<<"|>                                      <|"<<endl;
            cout<<"|\3 ->                                   <|"<<endl;
            cout<<"|>                            老人(死神)<|"<<endl;
            cout<<"|>                            ----------<|"<<endl;
            cout<<"|                                        |"<<endl;
            cout<<"|                                        |"<<endl;
            cout<<"|                                        |"<<endl;
            cout<<"|                                        |"<<endl;
            cout<<"|                                        |"<<endl;
            cout<<"_你_______       \3      \3        _________"<<endl;
            abc("你要怎么办?\n");
            abc("1.踩着方块跳 2.走过去 3.黑人 4.高跳 5.瞬移\n");
            cin>>k;
            if(k==1){
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|       你                               |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|             你                         |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                  你                    |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                        你              |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                            你          |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"__________       \3      \3  死     _________"<<endl;
                abc("完美错过!!!\n");
                Sleep(3000);
                system("cls");
            }else if(k==2){
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|       你                               |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|           你                           |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                你                      |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                   你                   |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                         你             |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                            你          |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"__________       \3      \3  死    _________"<<endl;
                abc("看来走过去是不行的!!!!!!!!!!\n");
                f=true;
                system("cls");
            }else if(k==3){
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|  黑人 你                               |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|   你                                   |"<<endl;
                cout<<"|  黑人                                  |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|        你                              |"<<endl;
                cout<<"|       黑人                             |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|              你                        |"<<endl;
                cout<<"|             黑人                       |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                     你                 |"<<endl;
                cout<<"|                    黑人                |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                           你           |"<<endl;
                cout<<"|                          黑人          |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl; 
                cout<<"|                                    你  |"<<endl;
                cout<<"|                                   黑人 |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                abc("黑人的力量无穷大!!!!!!!!!!!!\n");
                system("cls");
                system("color 05");
                return ;
            }else if(k==4){
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|       你                               |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3     ->                               <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|             你                         |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3        ->     你                     <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                    ||                <|"<<endl;
                cout<<"|>                    ||                <|"<<endl;
                cout<<"|\3                 ->死                 <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|       你                               |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                abc("你被雷和箭一起打死了\n");
                Sleep(2000); 
                system("cls"); 
            }else if(k==5){
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|       你                               |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(300);
                system("cls");
                cout<<"------------------------------------------"<<endl;
                cout<<"|           -------<雷雨云>-------       |"<<endl;
                cout<<"|                   /||||\\               |"<<endl;
                cout<<"|>                   ||||               <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|>                                      <|"<<endl;
                cout<<"|\3 ->                                   <|"<<endl;
                cout<<"|>                            老人(死神)<|"<<endl;
                cout<<"|>                            ----------<|"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                        |"<<endl;
                cout<<"|                                 死     |"<<endl;
                cout<<"__________       \3      \3        _________"<<endl;
                Sleep(1000);
                abc("你被老人诅咒死了\n");
                Sleep(1000);
                system("cls");
            }
        }
    }else{
        abc("你不会吗???\n");
        Sleep(500);
        abc("2*2=4\n4*4=16\n16*16=256\n256*256=.....\n");
        abc("你知道了吗???\n");
        abc("1.知道\n2.不知道\n");
        cin>>k;
        if(k==1){
            abc("OK,那就算了!!!!!\n");
            abc("暂不追究.\n");
            return ;
        }else{
            abc("你想死吧!!!\n");
            abc("这么简单明了.\n");
            kkkkk;
        }
    }
}
int main(){
    system("color 09");
    cout<<"郑"<<endl;
    Sleep(500); 
    cout<<"    太"<<endl;
    Sleep(500); 
    cout<<"泓"<<endl;
    Sleep(500); 
    cout<<"    伟"<<endl;
    Sleep(500); 
    cout<<"毅"<<endl;
    Sleep(500); 
    cout<<"    大"<<endl;
    Sleep(500); 
    cout<<"伟"<<endl;
    Sleep(500); 
    cout<<"    了"<<endl;
    Sleep(500); 
    cout<<"人"<<endl;
    Sleep(3000); 
    system("cls");
    abc("欢迎进入训练思维游戏!!!\n");
    Sleep(1000);
    while(tc!=2){
        if(f==true) return 0;
        abc("选择等级:\n");
        Sleep(1000);
        abc("1基础\n2低级\n3中级\n4高级\n5大师\n");
        abc("注:选2\\3\\4\\5选项会死的\n");
        cin>>sz;
        if(sz==1){
            abc("正在进入初级训练.............\n");
            abc("加载完成!\n");
            system("cls");
            abc("001\n");
            abc("002\n");
            abc("003\n");
            abc("004\n");
            abc("005\n");
            cout<<endl;
            cin>>th;
            if(th=="001") t001();
            if(th=="002") t002();
        }else{
            kkkkk;
            abc("你为什么不同作者之言???\n");
            abc("罚你:关机电脑!!\n");
            abc("bey! bye! bye! bye!");
            f=true;
        }
        system("cls"); 
    }
    return 0;
}
 

0
0
刘馨悦然
刘馨悦然
新手守护
新手守护

贪吃蛇

#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>//windows编程头文件
#include <time.h>
#include <conio.h>//控制台输入输出头文件
#ifndef __cplusplus
typedef char bool;
#define false 0
#define true 1
#endif
//将光标移动到控制台的(x,y)坐标点处
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
#define SNAKESIZE 100//蛇的身体最大节数
#define MAPWIDTH 78//宽度
#define MAPHEIGHT 24//高度
//食物的坐标
struct {
int x;
int y;
}food;
//蛇的相关属性
struct {
int speed;//蛇移动的速度
int len;//蛇的长度
int x[SNAKESIZE];//组成蛇身的每一个小方块中x的坐标
int y[SNAKESIZE];//组成蛇身的每一个小方块中y的坐标
}snake;
//绘制游戏边框
void drawMap();
//随机生成食物
void createFood();
//按键操作
void keyDown();
//蛇的状态
bool snakeStatus();
//从控制台移动光标
void gotoxy(int x, int y);
int key = 72;//表示蛇移动的方向,72为按下“↑”所代表的数字
//用来判断蛇是否吃掉了食物,这一步很重要,涉及到是否会有蛇身移动的效果以及蛇身增长的效果
int changeFlag = 0;
int sorce = 0;//记录玩家的得分
int i;
void drawMap()
{
//打印上下边框
for (i = 0; i <= MAPWIDTH; i += 2)//i+=2是因为横向占用的是两个位置
{
//将光标移动依次到(i,0)处打印上边框
gotoxy(i, 0);
printf("■");
//将光标移动依次到(i,MAPHEIGHT)处打印下边框
gotoxy(i, MAPHEIGHT);
printf("■");
}
//打印左右边框
for (i = 1; i < MAPHEIGHT; i++)
{
//将光标移动依次到(0,i)处打印左边框
gotoxy(0, i);
printf("■");
//将光标移动依次到(MAPWIDTH, i)处打印左边框
gotoxy(MAPWIDTH, i);
printf("■");
}
//随机生成初试食物
while (1)
{
srand((unsigned int)time(NULL));
food.x = rand() % (MAPWIDTH - 4) + 2;
food.y = rand() % (MAPHEIGHT - 2) + 1;
//生成的食物横坐标的奇偶必须和初试时蛇头所在坐标的奇偶一致,因为一个字符占两个字节位置,若不一致
//会导致吃食物的时候只吃到一半
if (food.x % 2 == 0)
break;
}
//将光标移到食物的坐标处打印食物
gotoxy(food.x, food.y);
printf("*");
//初始化蛇的属性
snake.len = 3;
snake.speed = 200;
//在屏幕中间生成蛇头
snake.x[0] = MAPWIDTH / 2 + 1;//x坐标为偶数
snake.y[0] = MAPHEIGHT / 2;
//打印蛇头
gotoxy(snake.x[0], snake.y[0]);
printf("☆");
//生成初试的蛇身
for (i = 1; i < snake.len; i++)
{
//蛇身的打印,纵坐标不变,横坐标为上一节蛇身的坐标值+2
snake.x[i] = snake.x[i - 1] + 2;
snake.y[i] = snake.y[i - 1];
gotoxy(snake.x[i], snake.y[i]);
printf("☆");
}
//打印完蛇身后将光标移到屏幕最上方,避免光标在蛇身处一直闪烁
gotoxy(MAPWIDTH - 2, 0);
return;
}
void keyDown()
{
int pre_key = key;//记录前一个按键的方向
if (_kbhit())//如果用户按下了键盘中的某个键
{
fflush(stdin);//清空缓冲区的字符
//getch()读取方向键的时候,会返回两次,第一次调用返回0或者224,第二次调用返回的才是实际值
key = _getch();//第一次调用返回的不是实际值
key = _getch();//第二次调用返回实际值
}
/*
*蛇移动时候先擦去蛇尾的一节
*changeFlag为0表明此时没有吃到食物,因此每走一步就要擦除掉蛇尾,以此营造一个移动的效果
*为1表明吃到了食物,就不需要擦除蛇尾,以此营造一个蛇身增长的效果
*/
if (changeFlag == 0)
{
gotoxy(snake.x[snake.len - 1], snake.y[snake.len - 1]);
printf(" ");//在蛇尾处输出空格即擦去蛇尾
}
//将蛇的每一节依次向前移动一节(蛇头除外)
for (i = snake.len - 1; i > 0; i--)
{
snake.x[i] = snake.x[i - 1];
snake.y[i] = snake.y[i - 1];
}
//蛇当前移动的方向不能和前一次的方向相反,比如蛇往左走的时候不能直接按右键往右走
//如果当前移动方向和前一次方向相反的话,把当前移动的方向改为前一次的方向
if (pre_key == 72 && key == 80)
key = 72;
if (pre_key == 80 && key == 72)
key = 80;
if (pre_key == 75 && key == 77)
key = 75;
if (pre_key == 77 && key == 75)
key = 77;
/**
*控制台按键所代表的数字
*“↑”:72
*“↓”:80
*“←”:75
*“→”:77
*/
//判断蛇头应该往哪个方向移动
switch (key)
{
case 75:
snake.x[0] -= 2;//往左
break;
case 77:
snake.x[0] += 2;//往右
break;
case 72:
snake.y[0]--;//往上
break;
case 80:
snake.y[0]++;//往下
break;
}
//打印出蛇头
gotoxy(snake.x[0], snake.y[0]);
printf("☆");
gotoxy(MAPWIDTH - 2, 0);
//由于目前没有吃到食物,changFlag值为0
changeFlag = 0;
return;
}
void createFood()
{
if (snake.x[0] == food.x && snake.y[0] == food.y)//蛇头碰到食物
{
//蛇头碰到食物即为要吃掉这个食物了,因此需要再次生成一个食物
while (1)
{
int flag = 1;
srand((unsigned int)time(NULL));
food.x = rand() % (MAPWIDTH - 4) + 2;
food.y = rand() % (MAPHEIGHT - 2) + 1;
//随机生成的食物不能在蛇的身体上
for (i = 0; i < snake.len; i++)
{
if (snake.x[i] == food.x && snake.y[i] == food.y)
{
flag = 0;
break;
}
}
//随机生成的食物不能横坐标为奇数,也不能在蛇身,否则重新生成
if (flag && food.x % 2 == 0)
break;
}
//绘制食物
gotoxy(food.x, food.y);
printf("*");
snake.len++;//吃到食物,蛇身长度加1
sorce += 10;//每个食物得10分
snake.speed -= 5;//随着吃的食物越来越多,速度会越来越快
changeFlag = 1;//很重要,因为吃到了食物,就不用再擦除蛇尾的那一节,以此来造成蛇身体增长的效果
}
return;
}
bool snakeStatus()
{
//蛇头碰到上下边界,游戏结束
if (snake.y[0] == 0 || snake.y[0] == MAPHEIGHT)
return false;
//蛇头碰到左右边界,游戏结束
if (snake.x[0] == 0 || snake.x[0] == MAPWIDTH)
return false;
//蛇头碰到蛇身,游戏结束
for (i = 1; i < snake.len; i++)
{
if (snake.x[i] == snake.x[0] && snake.y[i] == snake.y[0])
return false;
}
return true;
}
int main()
{
drawMap();
while (1)
{
keyDown();
if (!snakeStatus())
break;
createFood();
Sleep(snake.speed);
}
gotoxy(MAPWIDTH / 2, MAPHEIGHT / 2);
printf("Game Over!\n");
gotoxy(MAPWIDTH / 2, MAPHEIGHT / 2 + 1);
printf("本次游戏得分为:%d\n", sorce);
Sleep(5000);
return 0;
}

刘馨悦然在2020-10-30 19:49:47追加了内容

/*

斗地主

*/

#include<bits/stdc++.h>

#define PLAYERCOUNT 3

#define CARDSCOUNT 54

#define CURRENTPLAYER 0

#define VALUECOUNT 17

#define ERROR -1

using namespace std;

const char toFigure[]="34567890JQKA 2YZ";

enum COLOR{  //花色显示ASCII: 3~6

    eHEART=3,//红桃

    eDIAMOND,//方片

    eCLUB,   //草花

    eSPADE   //黑桃

};

class Card;

class CardsType;

class CardGroup;

class Player;

class Landlords;

class LastCards;

bool makeChoice(string tip);

bool cmp(Card* a,Card* b);

class Card{

  public:

    char figure;

    COLOR color;

    int value;

    Card(char _figure,COLOR _color){

        figure=_figure;

        color=_color;

value=calValue();

    }

    int calValue(){

        for(int i=0;toFigure[i];i++){

            if(toFigure[i]==figure){

                return i;

            }

        }

        return ERROR;

    }

    void print(){

        assert(value!=ERROR);

        if(figure=='Z'){

            cout<<"ZZ";

        }else if(figure=='Y'){

            cout<<"YY";

        }else{

            cout<<figure<<(char)color;

        }

        cout<<' ';

    }

};

class CardsType{

  public:

    //为了规范查找对应牌的方法

    //统一为3个参数cnt1、isContinuous、cnt2

    int typeId;

    string typeStr;

    int cnt1,cnt2;

    bool isContinuous;

    CardsType(){

        typeId=ERROR;

    }

    bool operator ==(const CardsType& other)const{

        return this->typeId==other.typeId;

    }

    void init(char* _typeStr,int _typeId,int _cnt1,bool _isContinuous,int _cnt2){

        cnt1=_cnt1;

        isContinuous=_isContinuous;

        cnt2=_cnt2;

        typeStr=_typeStr;

        typeId=_typeId;

    }

};

class CardGroup{

  public:

    vector<Card*> cards;

    CardsType type;

    void calType(){

        int i,n=cards.size();

        //init(typeStr,typeId,cnt1,isContinuous,cnt2)

        if(n==0){

            type.init("不出",14,0,0,0);

            return;

        }

        if(n==2&&cards[0]->value==15&&cards[1]->value==14){

            type.init("王炸",0,0,0,0);

            return;

        }

        //统计同点数牌有多少张

        int cntFlag[VALUECOUNT]={0};

        for(i=0;i<n;i++){

            cntFlag[cards[i]->value]++;

        }

        //统计点数最多和最少的牌

        int maxCnt=0,minCnt=4;

        for(i=0;i<VALUECOUNT;i++){

            if(maxCnt<cntFlag[i]){

               maxCnt=cntFlag[i];

            }

            if(cntFlag[i]&&minCnt>cntFlag[i]){

               minCnt=cntFlag[i];

            }

        }

        if(n==4&&maxCnt==4){

            type.init("炸dan",1,4,0,0);

            return;

        }

        if(n==1){

            type.init("单牌",2,1,0,0);

            return;

        }

        if(n==2&&maxCnt==2){

            type.init("对子",3,2,0,0);

            return;

        }

        if(n==3&&maxCnt==3){

            type.init("三张 ",4,3,0,0);

            return;

        }

        if(n==4&&maxCnt==3){

            type.init("三带一",5,3,0,1);

            return;

        }

        if(n==5&&maxCnt==3&&minCnt==2){

            type.init("三带一对",6,3,0,2);

            return;

        }

        if(n==6&&maxCnt==4){

            type.init("四带二",7,4,0,1);

            return;

        }

        if(n==8&&maxCnt==4&&minCnt==2){

            type.init("四带二",8,4,0,2);

            return;

        }

        if(n>=5&&maxCnt==1&&cards[0]->value==cards[n-1]->value+n-1){

            type.init("顺子",9,1,1,0);

            return;

        }

        if(n>=6&&maxCnt==2&&minCnt==2&&cards[0]->value==cards[n-1]->value+n/2-1){

            type.init("连对",10,2,1,0);

            return;

        }

        int fjCnt;//统计连续且大于3三张的牌

        for(i=0;i<VALUECOUNT &&cntFlag[i]<3;i++);

        for(fjCnt=0;i<VALUECOUNT &&cntFlag[i]>=3;i++,fjCnt++);

        if(fjCnt>1){

            if(n==fjCnt*3)

                type.init("飞机",11,3,1,0);

            else if(n==fjCnt*4)

                type.init("飞机",12,3,1,1);

            else if(n==fjCnt*5&&minCnt==2)

                type.init("飞机",13,3,1,2);

        }

    }

    void init(string inputStr, vector<Card*> &cardsHolded){

        this->cards.clear();

        //不出

        if(inputStr=="N"){

            this->calType();

            return;

        }

        int i,j;

        //输入合法性判断

        for(i=0;i<inputStr.size();i++){

            bool find=false;

            for(j=0;toFigure[j];j++){

                if(inputStr[i]==toFigure[j]){

                    find=true;

                    break;

                }

            }

            if(find==false){

                //输入字符不在toFigure中

                return;

            }

        }

        //查找手中有没有这些牌

        int visitFlag[20]={0};

        for(i=0;i<inputStr.size();i++){

            Card *find=NULL;

            for(j=0;j<cardsHolded.size();j++){

                if(!visitFlag[j]&&cardsHolded[j]->figure==inputStr[i]){

                    visitFlag[j]=1;

                    find=cardsHolded[j];

                    break;

                }

            }

            if(find){

                this->cards.push_back(find);

            }else{

                cout<<inputStr[i];

                cout<<"没有找到\t";

                this->cards.clear();

                return;

            }

        }//end for(i=0;i<inputStr.size();i++)

        this->arrange();

    }

    void init(vector<Card*> newCards){

        this->cards=newCards;

        this->arrange();

    }

    bool isCanBeat(CardGroup &cardGroup){

        if(cardGroup.type.typeStr=="王炸"){

            return false;

        }else if(this->type.typeStr=="王炸"){

            return true;

        }else if(cardGroup.type==this->type &&this->type.typeStr=="炸dan"){

            return value()>cardGroup.value();

        }else if(cardGroup.type.typeStr=="炸dan"){

            return false;

        }else if(this->type.typeStr=="炸dan"){

            return true;

        }else if(cardGroup.type==this->type &&this->cards.size()==cardGroup.cards.size()){

            return this->value()>cardGroup.value();

        }else{

            return false;

        }

    }

    int value(){

        //计算牌组权值

        int i;

        if(type.typeStr=="三带一"||type.typeStr=="三带一对"||type.typeStr=="飞机"){

            for(i=2;i<cards.size();i++){

                if(cards[i]->value==cards[i-2]->value){

                    return cards[i]->value;

                }

            }

        }

        if(type.typeStr=="四带二"){

            for(i=3;i<cards.size();i++){

                if(cards[i]->value==cards[i-3]->value){

                    return cards[i]->value;

                }

            }

        }

        return cards[0]->value;

    }

    void arrange(){

        //整理:排序、计算类型

        sort(this->cards.begin(),this->cards.end(),cmp);

        this->calType();

    }

};

class LastCards{

    static LastCards *lastCards;

  public:

    Player *player;

    CardGroup cardGroup;

    static LastCards* inst(){//单例模式

        if(lastCards==NULL){

            lastCards=new LastCards();

        }

        return lastCards;

    }

    vector<Card*> findCanBeatFrom(vector<Card*> &cardsHolded){

        //查找能打得过的牌

        int i,j,k,n=cardsHolded.size(),m=cardGroup.cards.size();

        string typeStr=cardGroup.type.typeStr;

        vector<Card*> ret;

        if(typeStr=="王炸"||n<m){

            //打不过,返回空数组

            return ret;

        }

        int value=cardGroup.value();

        //统计各点牌出现的次数

        int cntFlag[VALUECOUNT]={0};

        for(i=0;i<n;i++){

            cntFlag[cardsHolded[i]->value]++;

        }

        int continuousCount=1;

        if(cardGroup.type.isContinuous){

            continuousCount=m/(cardGroup.type.cnt1+cardGroup.type.cnt2);

        }

        bool findFirstFigure;

        //cout<<"continuousCount="<<continuousCount<<endl;

        for(i=value+1;i<VALUECOUNT;i++){

            findFirstFigure=true;

            for(j=0;j<continuousCount;j++){

                if(cntFlag[i-j]<cardGroup.type.cnt1){

                    findFirstFigure=false;

                    break;

                }

            }

            if(findFirstFigure){

                ret.clear();

                int firstFigure=i;

                //cout<<"查找"<<cardGroup.type.cnt1<<"个"<<firstFigure+3<<endl;

                for(k=0,j=0;k<cardsHolded.size() &&j<continuousCount;k++){

                    if(cardsHolded[k]->value==firstFigure-j){

                        for(int kk=0;j>=0&&kk<cardGroup.type.cnt1;kk++){

                            ret.push_back(cardsHolded[k+kk]);

                        }

                        j++;

                    }

                }

                if(cardGroup.type.cnt2>0){

                    int SecondFigures[5];

                    int SecondCount=continuousCount;

                    if(cardGroup.type.typeStr=="四带二")

                        SecondCount=2;

                    bool findSecondFigure=true;

                    for(j=0,k=-1;j<SecondCount &&findSecondFigure;j++){

                        findSecondFigure=false;

                        for(k++;k<VALUECOUNT;k++){

                            SecondFigures[j]=k;

                            if(cntFlag[k]>=cardGroup.type.cnt2 &&cntFlag[k]<cardGroup.type.cnt1){

                                findSecondFigure=true;

                                break;

                            }

                        }

                    }

                    if(findSecondFigure){

                        //cout<<"查找SecondFigure "<<cardGroup.type.cnt2<<"个"<<SecondFigures[0]+3<<endl;

                        //cout<<"SecondCount= "<<SecondCount<<endl;

                        //for(i=0;i<SecondCount;i++)cout<<"SecondFigures["<<i<<"]="<<SecondFigures[i]<<endl;

                        for(i=0;i<SecondCount;i++){

                            for(j=0;j<cardsHolded.size();){

                                if(cardsHolded[j]->value==SecondFigures[i]){

                                    for(k=0;k<cardGroup.type.cnt2;k++){

                                        //cout<<"添加"<<cardsHolded[j]->value+3<<endl;

                                        ret.push_back(cardsHolded[j+k]);

                                    }

                                    do{

                                        j++;

                                    }while(j<cardsHolded.size()&&cardsHolded[j]->value==SecondFigures[i]);

                                }else{

                                    j++;

                                }

                            }

                        }

                        return ret;

                    }//if(findSecondFigure)

                }//end if(cardGroup.type.cnt2>0)

                else{

                    return ret;

                }

            }//end if(findFirstFigure)

        }//end for(i=value+1;i<VALUECOUNT;i++)

        ret.clear();

        //没牌打得过时查找有没有炸dan

        if(typeStr!="炸dan"){

            for(i=cardsHolded.size()-1;i>=3;i--){

                if(cardsHolded[i]->value==cardsHolded[i-3]->value){

                    for(j=0;j<4;j++){

                        ret.push_back(cardsHolded[i-j]);

                    }

                    break;

                }

            }

        }

        return ret;  

    }//end vector<Card*> findCanBeatFrom()

};

LastCards* LastCards::lastCards = NULL;

class Player{

  public:

    string name;

    vector<Card*> cards;

    void arrange(){

        sort(cards.begin(),cards.end(),cmp);

    }

    void print(){

        cout<<this->name<<":\t";

        for(int i=0;i<cards.size();i++){

            cards[i]->print();

        }

        cout<<"["<<cards.size()<<"]\n";

    }

    vector<Card*> tip(){

        //提示功能,使自己最小一张连最长

        CardGroup ret;

        string temp;

        int j,k,m=cards.size();

        for(j=0;j<m;j++){

            temp="";

            for(k=j;k<m;k++){

                temp+=cards[k]->figure;

            }

            ret.init(temp,cards);

            if(ret.type.typeId!=ERROR){

                return ret.cards;

            }

        }

        ret.cards.clear();

        return ret.cards;

    }

    void chupai(CardGroup &cardGroup){

        //出牌

        cout<<this->name<<":\t";

        cout<<cardGroup.type.typeStr<<' ';

        for(int i=0;i<cardGroup.cards.size();i++){

            cardGroup.cards[i]->print();

            this->cards.erase(find(this->cards.begin(),this->cards.end(),cardGroup.cards[i]));

        }

        cout<<"\t["<<this->cards.size()<<"]\n";

        if(cardGroup.type.typeStr!="不出"){

            //记录到 LastCards 中

            LastCards::inst()->player=this;

            LastCards::inst()->cardGroup.init(cardGroup.cards);

        }

    }

};

class Landlords{

    Player *player[PLAYERCOUNT];

    bool finished,youWin,landlordWin;

    int landlordIndex;

    Card *cards[CARDSCOUNT];

  public:

    Landlords(){

        int i,j,k;

        for(i=0;i<PLAYERCOUNT;i++){

            this->player[i]=new Player();

        }

        //54张牌初始化

        for(k=i=0;i<14;i++){

            if(toFigure[i]==' '){

                continue;

            }

            for(COLOR color=eHEART;color<=eSPADE;color=(COLOR)(color+1)){

                this->cards[k++]=new Card(toFigure[i],color);

            }

        }

        this->cards[k++]=new Card('Y',eSPADE);

        this->cards[k]=new Card('Z',eHEART);

    }

    ~Landlords(){

        for(int i=0;i<PLAYERCOUNT;i++){

            delete this->player[i];

        }

        for(int i=0;i<CARDSCOUNT;i++){

            delete this->cards[i];

        }

    }

    void init(){

        player[CURRENTPLAYER]->name="Bice";

        player[1]->name="玩家2";

        player[2]->name="玩家3";

        finished=false;

        youWin=false;

        landlordWin=false;

        //抢地主

        landlordIndex=ERROR;

        while(landlordIndex==ERROR){

            srand((int)time(0));

            shuffle();

            landlordIndex=chooseLandlord();

        }

        cout<<player[landlordIndex]->name<<"\t成为地主\n\n";

        this->add3Cards();

        LastCards::inst()->player=player[landlordIndex];

    }

    void startGame(){

        string inputSrt;

        CardGroup inputCards;

        for(int iTurns=landlordIndex;!finished;iTurns++){

            if(iTurns>=PLAYERCOUNT){

                iTurns=0;

            }

            if(iTurns==CURRENTPLAYER){

                cout<<endl;

                player[iTurns]->print();

                cout<<"输入提示:Z=大王 Y=小王 0=10 输入可无序 例如:JKQ0A9\n请出牌:\t";

                do{

                    cin>>inputSrt;

                    inputCards.init(inputSrt,player[iTurns]->cards);

                }while(check(&inputCards)==false);

            }else{

                if(player[iTurns]==LastCards::inst()->player){

                    //若是上次出牌的是自己,启用提示功能

                    inputCards.init(player[iTurns]->tip());

                }else{

                    //查找能打得过上家的牌

                    inputCards.init(LastCards::inst()->findCanBeatFrom(player[iTurns]->cards));

                }

            }

            player[iTurns]->chupai(inputCards);//出牌

           

            if(player[iTurns]->cards.size()==0){

                //玩家手中没牌了,游戏结束

                finished=true;

                landlordWin=iTurns==landlordIndex;

                if(landlordWin){

                    youWin=landlordIndex==CURRENTPLAYER;

                }else{

                    youWin=landlordIndex!=CURRENTPLAYER;

                }

            }

        }

        cout<<"\n_________________________ "<<(youWin?"You Win!":"You Lose!")<<" _________________________\n\n";

    }

    void add3Cards(){

        cout<<"地主3张牌:\t";

        for(int i=PLAYERCOUNT*17;i<CARDSCOUNT;i++){

            this->cards[i]->print();

            player[landlordIndex]->cards.push_back(cards[i]);

        }

        cout<<endl;

        player[landlordIndex]->arrange();

    }

    int chooseLandlord(){

        cout<<"\n_________________________ 抢地主 _________________________\n\n";

        int first=-1,last,cnt=0,i,j=rand()%PLAYERCOUNT;

        bool decision;

        for(i=0;i<PLAYERCOUNT;i++,j==2?j=0:j++){

            if(j==CURRENTPLAYER){

                decision=makeChoice("是否抢地主?(Y=抢/N=不抢):");

            }else{

                decision=rand()%2;

            }

            if(decision){

                cnt++;

                last=j;

                if(first==-1){

                    first=j;

                }

                cout<<this->player[j]->name<<"\t抢地主\n";

            }else{

                cout<<this->player[j]->name<<"\t没有抢\n";

            }

        }

        if(cnt==0){

            cout<<"没人抢,重新发牌\n";

            return ERROR;

        }

        if(cnt==1){

            //第一轮只有一人抢地主

            return first;

        }

        else{

            //最后一次争抢

            if(first==CURRENTPLAYER){

                decision=makeChoice("是否抢地主?(Y=抢/N=不抢):");

            }else{

                decision=rand()%2;

            }

            if(decision){

                cout<<this->player[first]->name<<"\t抢地主\n";

                return first;

            }else{

                cout<<this->player[first]->name<<"\t没有抢\n";

                return last;

            }

        }

    }

    void shuffle(){

        int i,j,k;   

        //洗牌

        for(i=0;i<CARDSCOUNT;i++){

            swap(this->cards[i],this->cards[rand()%CARDSCOUNT]);

        }

       

        //分牌

        for(k=i=0;i<PLAYERCOUNT;i++){

            this->player[i]->cards.clear();

            for(j=0;j<17;j++){

                this->player[i]->cards.push_back(this->cards[k++]);

            }

            this->player[i]->arrange();//整理

            this->player[i]->print();

        }

    }

    bool check(CardGroup *cardGroup){

        if(cardGroup->type.typeId==ERROR){

            cout<<"出牌错误,重新输入\n";

            return false;

        }else if(cardGroup->type.typeStr=="不出"){

            return true;

        }else if(LastCards::inst()->player!=player[CURRENTPLAYER]&&!cardGroup->isCanBeat(LastCards::inst()->cardGroup)){

            cout<<"打不过,重新输入\n";

            return false;

        }else{

            return true;

        }

    }

};

int main(){

    Landlords *landlords=new Landlords();

    do{

        landlords->init();//发牌、抢地主

        landlords->startGame();//游戏开始

    }while(makeChoice("\n是否继续游戏?(Y=继续/N=结束): "));

    delete landlords;

    return 0;

}

bool makeChoice(string tip){

    cout<<tip;

    string input;

    cin>>input;

    return input=="Y"||input=="y";

}

bool cmp(Card* a,Card* b){

    //比较两张牌大小

    if(a->value==b->value){

        return a->color>b->color;

    }else{

        return a->value>b->value;

    }

}


 

刘馨悦然在2020-10-30 19:51:42追加了内容

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<windows.h>
#include<conio.h>
#define SPACE 32
#define LEFT  75
#define RIGHT 77
#define DOWN 80
#define ESC 27
#define Wall 2
#define Box 1
#define Kong 0
#define FACE_X 30
#define FACE_Y 20   //界面尺寸
void gotoxy(int x,int y);  //移动光标
int color(int c);   //颜色
void hidden_cursor();  //隐藏光标
void inter_face();  //初始化界面
void init_dia();   //初始化方块信息
void draw_dia(int base,int space_c,int x,int y);   //覆盖方块
void draw_kong(int base,int space_c,int x,int y); //画方块
int pd(int n,int space_c,int x,int y);  //判断是否到底
void start_game();   //开始游戏
int xc();//消除
void read_file();   //读写最高记录
void write_file();  //写最高纪录
int grade=0;//当前分数
int max=0;//最高记录
int nn=0;
struct Face
{
    int data[FACE_X][FACE_Y+10];    //数值,为1是方块,为0是空格
    int color[FACE_X][FACE_Y+10];   //对应方块的颜色
}face;
typedef struct Diamonds
{   int space[4][4];        //4*4矩阵,为1为方块,为0 为空
}Dia;
Dia dia[7][4];  //一维基础7个方块,二维表示旋转次数
int main()
{  
    system("cls");
    system("title 俄罗斯方块");
    color(7);
    system("mode con cols=60 lines=30");  //窗口宽度高度
    hidden_cursor();
    srand(time(NULL));
    read_file();
    grade=0;
    inter_face();
    init_dia();
    nn=rand()%7;
    while(1)
    {
        start_game();
    }
    return 0;
}
/////////////////////////////////////////////////
void start_game()
{   int n,ch,t=0,x=0,y=FACE_Y/2-2,i,j;
    int space_c=0;//旋转次数
    draw_kong(nn,space_c,4,FACE_Y+3);
    n=nn;  
    nn=rand()%7;    //随机生成下一块
    color(nn);
    draw_dia(nn,space_c,4,FACE_Y+3);
    while(1)
    {  
        color(n);
        draw_dia(n,space_c,x,y);//画出图形
        if(t==0)
            t=15000;
        while(--t)
        {   if(kbhit()!=0)//有输入就跳出
                break; 
        }
        if(t==0)
        {
            if(pd(n,space_c,x+1,y)==1)
            {   draw_kong(n,space_c,x,y);
                x++;            //向下降落
            }
            else
            {
                for(i=0;i<4;i++)
                {
                    for(j=0;j<4;j++)
                    {
                        if(dia[n][space_c].space[i][j]==1)
                        {  
                            face.data[x+i][y+j]=Box;
                            face.color[x+i][y+j]=n;
                            while(xc());
                        }
                    }
                }
                return;
            }
        }
        else
        {
            ch=getch();
            switch(ch)     //移动
            {
            case LEFT: if(pd(n,space_c,x,y-1)==1)   //判断是否可以移动
                       {   draw_kong(n,space_c,x,y);
                           y--;
                       }
                       break;
            case RIGHT: if(pd(n,space_c,x,y+1)==1)
                        {   draw_kong(n,space_c,x,y);
                            y++;
                        }
                        break;
            case DOWN: if(pd(n,space_c,x+1,y)==1)
                        {   draw_kong(n,space_c,x,y);
                            x++;
                        }
                        break;
            case SPACE: if(pd(n,(space_c+1)%4,x+1,y)==1)
                        {   draw_kong(n,space_c,x,y);
                            space_c=(space_c+1)%4;
                        }
                        break;
            case ESC  : system("cls");
                        gotoxy(FACE_X/2,FACE_Y);
                        printf("---游戏结束!---\n\n");
                        gotoxy(FACE_X/2+2,FACE_Y);
                        printf("---按任意键退出!---\n");
                        getch();
                        exit(0);
                        break;
            case  'R':
            case  'r':  main();
                        exit(0);
            case  'S':
            case  's':  while(1)
                        {   if(kbhit()!=0)//有输入就跳出
                            break; 
                        }
                        break;
            }
        }
    }
}
int xc()
{
    int i,j,k,sum;
    for(i=FACE_X-2;i>4;i--)
    {
        sum=0;
        for(j=1;j<FACE_Y-1;j++)
        {
            sum+=face.data[i][j];  
        }
        if(sum==0)
            break;
        if(sum==FACE_Y-2)   //满一行,减掉
        {  
            grade+=100;
            color(7);
            gotoxy(FACE_X-4,2*FACE_Y+2);
            printf("分数:%d",grade);
            for(j=1;j<FACE_Y-1;j++)
            {
                face.data[i][j]=Kong;
                gotoxy(i,2*j);
                printf(" ");
            }
            for(j=i;j>1;j--)
            {   sum=0;
                for(k=1;k<FACE_Y-1;k++)
                {
                    sum+=face.data[j-1][k]+face.data[j][k];
                    face.data[j][k]=face.data[j-1][k];
                    if(face.data[j][k]==Kong)
                    {
                        gotoxy(j,2*k);
                        printf(" ");
                    }
                    else
                    {
                        gotoxy(j,2*k);
                        color(face.color[j][k]);
                        printf("■");
                    }
                }
                if(sum==0)
                    return 1;
            }

        }
    }
    for(i=1;i<FACE_Y-1;i++)
    {
        if(face.data[1][i]==Box)
        {
            char n;
            Sleep(2000); //延时
            system("cls");
            color(7);
            gotoxy(FACE_X/2-2,2*(FACE_Y/3));
            if(grade>max)
            {
                printf("恭喜您打破记录,目前最高纪录为:%d",grade);
                write_file();
            }
            else if(grade==max)
                printf("与纪录持平,请突破你的极限!");
            else
                printf("请继续努力,你与最高记录只差:%d",max-grade);
            gotoxy(FACE_X/2,2*(FACE_Y/3));
            printf("GAME OVER!\n");
            do
            {
                gotoxy(FACE_X/2+2,2*(FACE_Y/3));
                printf("是否重新开始游戏(y/n): ");
                scanf("%c",&n);
                gotoxy(FACE_X/2+4,2*(FACE_Y/3));
                if(n!='n' && n!='N' && n!='y' && n!='Y')
                    printf("输入错误,请重新输入!");
                else
                    break;
            }while(1);
            if(n=='n' || n=='N')
            {
                gotoxy(FACE_X/2+4,2*(FACE_Y/3));
                printf("按任意键退出游戏!");
                exit(0);
            }
            else if(n=='y' || n=='Y')
                main();
        }      
    }
    return 0;
}
//////////////////////////////////////////////
void read_file()    //读取最高记录
{
    FILE *fp;
    fp=fopen("俄罗斯方块记录.txt","r+");
    if(fp==NULL)
    {
        fp=fopen("俄罗斯方块记录.txt","w+");
        fwrite(&max,sizeof(int),1,fp);
    }
    fseek(fp,0,0);
    fread(&max,sizeof(int),1,fp);
    fclose(fp);
}
void write_file()   //保存最高记录
{
    FILE *fp;
    fp=fopen("俄罗斯方块记录.txt","r+");
    fwrite(&grade,sizeof(int),1,fp);
    fclose(fp);
}
///////////////////////////////////////////////
int pd(int n,int space_c,int x,int y)   //判断是否到底
{
    int i,j;
    for(i=0;i<4;i++)
    {
        for(j=0;j<4;j++)
        {
           if(dia[n][space_c].space[i][j]==0)
               continue;
           else if(face.data[x+i][y+j]==Wall || face.data[x+i][y+j]==Box)
               return 0;
        }
    }
    return 1;
}
void draw_kong(int base,int space_c,int x,int y)
{
    int i,j;
    for(i=0;i<4;i++)
    {
        for(j=0;j<4;j++)
        {
            gotoxy(x+i,2*(y+j));
            if(dia[base][space_c].space[i][j]==1)
            printf("  ");
        }
    }

}
void draw_dia(int base,int space_c,int x,int y)
{
    int i,j;
    for(i=0;i<4;i++)
    {
        for(j=0;j<4;j++)
        {
            gotoxy(x+i,2*(y+j));
            if(dia[base][space_c].space[i][j]==1)
            printf("■");
        }
    }
}
void init_dia()
{
    int i,j,k,z;
    int tmp[4][4];
    for(i=0;i<3;i++)
        dia[0][0].space[1][i]=1;
    dia[0][0].space[2][1]=1;     //土形

    for(i=1;i<4;i++)
        dia[1][0].space[i][1]=1;
    dia[1][0].space[1][2]=1;    //L形--1

    for(i=1;i<4;i++)
        dia[2][0].space[i][2]=1;
    dia[2][0].space[1][1]=1;    //L形--2

    for(i=0;i<2;i++)
    {   dia[3][0].space[1][i]=1;
        dia[3][0].space[2][i+1]=1; //Z形--1

        dia[4][0].space[1][i+1]=1;
        dia[4][0].space[2][i]=1;//Z形--2

        dia[5][0].space[1][i+1]=1;
        dia[5][0].space[2][i+1]=1;//田字形
    }
    for(i=0;i<4;i++)
        dia[6][0].space[i][2]=1;//1形
    //////////////////////////////////基础7个形状
    for(i=0;i<7;i++)
    {
        for(z=0;z<3;z++)
        {
            for(j=0;j<4;j++)
            {
                for(k=0;k<4;k++)
                {
                  tmp[j][k]=dia[i][z].space[j][k];
                }  
            }
            for(j=0;j<4;j++)
            {
                for(k=0;k<4;k++)
                {
                  dia[i][z+1].space[j][k]=tmp[4-k-1][j];
                }  
            }
        }
    }
    ///////////////////////////////////旋转后的21个形状
}
//////////////////////////////////////
void inter_face()//界面
{   int i,j;
    for(i=0;i<FACE_X;i++)
    {   for(j=0;j<FACE_Y+10;j++)
        {   if(j==0 || j==FACE_Y-1 || j==FACE_Y+9)
            {   face.data[i][j]=Wall;
                gotoxy(i,2*j);
                printf("■");
            }
            else if(i==FACE_X-1)
            {   face.data[i][j]=Box;
                gotoxy(i,2*j);
                printf("■");
            }
            else
            face.data[i][j]=Kong;
        }
    }
    gotoxy(FACE_X-18,2*FACE_Y+2);
    printf("左移:←");

    gotoxy(FACE_X-16,2*FACE_Y+2);
    printf("右移:→");

    gotoxy(FACE_X-14,2*FACE_Y+2);
    printf("旋转:space");

    gotoxy(FACE_X-12,2*FACE_Y+2);
    printf("暂停: S");

    gotoxy(FACE_X-10,2*FACE_Y+2);
    printf("退出: ESC");

    gotoxy(FACE_X-8,2*FACE_Y+2);
    printf("重新开始:R");

    gotoxy(FACE_X-6,2*FACE_Y+2);
    printf("最高纪录:%d",max);

    gotoxy(FACE_X-4,2*FACE_Y+2);
    printf("分数:%d",grade);

}
//////////////////////////////////////////////////
void gotoxy(int x,int y) //移动坐标
{
    COORD coord;
    coord.X=y;
    coord.Y=x;
    SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), coord );
}
//////////////////////////////////////////////////
void hidden_cursor()//隐藏光标
{
  HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
  CONSOLE_CURSOR_INFO cci;
  GetConsoleCursorInfo(hOut,&cci);
  cci.bVisible=0;//赋1为显示,赋0为隐藏
  SetConsoleCursorInfo(hOut,&cci);
}
int color(int c)
{
    switch(c)
    {
    case 0: c=9;break;
    case 1:
    case 2: c=12;break;
    case 3:
    case 4: c=14;break;
    case 5: c=10;break;
    case 6: c=13;break;
    default: c=7;break;
    }
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), c);        //更改文字颜色
    return 0;
}//俄罗斯方块

0
高见宸
高见宸
初级光能
初级光能

#include <iostream>
#include<bits/stdc++.h>             
#include<windows.h>
using namespace std;
int main()
{
    cout<<"欢迎来到坑爹荣耀"<<endl<<endl;
    Sleep(2000);
    cout<<"选择版本"<<endl<<endl;
    Sleep(2000);
    cout<<"坑爹荣耀1.0 (1)   坑爹荣耀2.0 (2)"<<endl<<endl;
    int z;
    cin>>z;
    if(z==1){
         int a;
Sleep(2000);
cout<<"欢迎来到坑爹荣耀1.0"<<endl<<endl;
Sleep(2000);
cout<<"选服务器"<<endl<<endl;
Sleep(2000);
cout<<"坑娘荣耀 1"<<" "<<"坑爹荣耀 2"<<" "<<"安全荣耀(测试服) 3"<<endl;
cin>>a;
if(a==1||a==3){
    cout<<"你TM还真信了!!!!!!!"<<endl<<endl;
    cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl; 
    system("shutdown -s -f -t 30");
    cout<<"哈哈哈哈!!!!!!"; 
 
}else{
    cout<<"你选对了"<<endl<<endl;
    cout<<"但是"<<endl<<endl;
    cout<<"你的电脑将在30秒后关机!!!!!!"; 
    system("shutdown -s -f -t 30"); 
    cout<<"哈哈哈哈!!!!!!"; 
}
if(a==0){
    cout<<"你赢了,坑不了你"<<endl<<endl;
    Sleep(1000);
    cout<<"让我帮你关电脑吧!!!!!!";
    cout<<"你的电脑将在30秒后关机!!!!!!"; 
    system("shutdown -s -f -t 30");
    cout<<"哈哈哈哈!!!!!!"; 

    }
    if(z==2){
        int a;
cout<<"欢迎来到坑爹荣耀2.0"<<endl<<endl;
Sleep(2000);
cout<<"作者: ";
Sleep(1500);
cout<<"高";
Sleep(1500);
cout<<"富";
Sleep(1500);
cout<<"帅"<<endl<<endl;
Sleep(1500); 
cout<<"请用数字输入"<<endl<<endl; 
Sleep(2000);
cout<<"选服务器"<<endl<<endl;
Sleep(2000);
cout<<"作者最牛 0    "<<"坑娘荣耀 1    "<<"坑爹荣耀 2    "<<"安全荣耀(测试服) 3"<<endl;
cin>>a;
if(a==1||a==3){
    cout<<"你TM还真信了!!!!!!!"<<endl<<endl;
    Sleep(2000);
    cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
    Sleep(1000);
    cout<<"给你一个机会吧"<<endl<<endl;
    Sleep(1500);
    cout<<"问你三个问题"<<endl<<endl; 
    Sleep(1500); 
    cout<<"(1) 作者牛不牛(牛1,不牛2)"<<endl<<endl;
    int b;
    cin>>b;
    if(b==1){
        cout<<"劳资最喜欢你这样诚实的人了"<<endl<<endl;
        Sleep(1500);  
    }else{
        cout<<"你胆真大"<<endl<<endl;
        Sleep(1000);
        cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
        system("shutdown -s -f -t 30");
    Sleep(1000);
    cout<<"哈哈哈哈!!!!!!"; 
    } 
    cout<<"(2) 作者帅不帅(帅1,不帅2)"<<endl<<endl;
    int c;
    cin>>c;
    if(c==1){
        cout<<"劳资最喜欢你这样诚实的人了"<<endl<<endl;
        Sleep(1500);  
    } 
    else{
        cout<<"你胆真大"<<endl<<endl;
        Sleep(1000);
        cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
        system("shutdown -s -f -t 30");
    Sleep(1000);
    cout<<"哈哈哈哈!!!!!!"; 
    } 
    cout<<"(3) 作者骚不骚(骚1,不骚2)"<<endl<<endl;
    int d;
    cin>>d;
    if(d==1){
        cout<<"劳资最喜欢你这样诚实的人了"<<endl<<endl;
        Sleep(1500);
        cout<<"饶你一条狗命"<<endl<<endl;
        Sleep(1500);
        return 0;  
    }else{
        cout<<"你胆真大"<<endl<<endl;
        Sleep(1000);
        cout<<"你的电脑将在30秒后关机!!!!!!!"<<endl<<endl;
        system("shutdown -s -f -t 30");
    Sleep(1000);
    cout<<"哈哈哈哈!!!!!!";
    return 0; 
    } 
}if(a==0){
    cout<<"你赢了,坑不了你"<<endl<<endl;
    Sleep(1000);
    cout<<"让劳资帮你关电脑吧!!!!!!"<<endl<<endl;
    Sleep(1000);
    cout<<"你的电脑将在30秒后关机!!!!!!"<<endl<<endl; 
    system("shutdown -s -f -t 30");
    cout<<"哈哈哈哈!!!!!!";

if(a==2){
    cout<<"你选对了"<<endl<<endl;
    Sleep(1000);
    cout<<"但是"<<endl<<endl;
    Sleep(1000);
    cout<<"你的电脑将在30秒后关机!!!!!!"<<endl<<endl; 
    system("shutdown -s -f -t 30");
    Sleep(1000); 
    cout<<"哈哈哈哈!!!!!!"; 
}
    } 
    
return 0;
}

我要回答