C++ 精选游戏

目录:

1.走迷宫
2.丧尸危机
3.双人格斗
4.海战
5.井字棋(鼠标点击版)
6.胎神之路
7.愤怒的小鸟
  1. 走迷宫

#include<bits/stdc++.h>
#include<windows.h>
#include "conio.h"

using namespace std;
int zhi1=1,jm=1,zhi2=3;
char xz;
typedef BOOL (WINAPI *PROCSETCONSOLEFONT)(HANDLE, DWORD);
PROCSETCONSOLEFONT SetConsoleFont;

void color(int a) { //字体颜色
    if(a==0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);//白
    if(a==1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);//蓝
    if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);//绿
    if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);//紫
    if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);//红
    if(a==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);//靛
    if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);//黄
}

void Print(int a) {
    HMODULE hKernel32 = GetModuleHandle("kernel32");
    SetConsoleFont = (PROCSETCONSOLEFONT)GetProcAddress(hKernel32,"SetConsoleFont");
    SetConsoleFont(GetStdHandle(STD_OUTPUT_HANDLE),a);
}

void print(string ditu,int a,int b) {
    for(int i=0; i<b; i++) {
        for(int j=a*i; j<a*(i+1); j++) {
            if(ditu[j] == '#')
                color(1);
            else if(ditu[j] == 'O')
                color(4);
            else if(ditu[j] == '@')
                color(6);
            else if(ditu[j] == 'Q')
                color(3);
            else if(ditu[j] == 'z')
                color(5);
            else
                color(0);
            cout<<"█";
        }
        printf("\n");
    }
}

void jx(string ditu,int a,int b) {
    int x=1,y=1;
    print(ditu,a,b);
    do {
        xz=getch();
        system("cls");
        if(xz=='d') {
            if(ditu[x*a+y+1]=='@') {
                system("cls");
                print(ditu,a,b);
                printf("\n");
                printf("胜利");
                Sleep(1000);
                system("cls");
                jm=1;
                x=1;
                y=1;
                return;
            } else if(ditu[x*a+y+1]!='#') {
                ditu[x*a+y]=' ';
                y++;
                ditu[x*a+y]='O';
            }
        }
        if(xz=='a') {
            if(ditu[x*a+y-1]=='@') {
                system("cls");
                print(ditu,a,b);
                printf("\n");
                printf("胜利");
                Sleep(1000);
                system("cls");
                jm=1;
                x=1;
                y=1;
                return;
            } else if(ditu[x*a+y-1]!='#') {
                ditu[x*a+y]=' ';
                y--;
                ditu[x*a+y]='O';
            }
        }
        if(xz=='s') {
            if(ditu[(x+1)*a+y]=='@') {
                system("cls");
                print(ditu,a,b);
                printf("\n");
                printf("胜利");
                Sleep(1000);
                system("cls");
                jm=1;
                x=1;
                y=1;
                return;
            } else if(ditu[(x+1)*a+y]!='#') {
                ditu[x*a+y]=' ';
                x++;
                ditu[x*a+y]='O';
            }
        }
        if(xz=='w') {

            if(ditu[(x-1)*a+y]=='@') {
                system("cls");
                print(ditu,a,b);
                printf("\n");
                printf("胜利");
                Sleep(1000);
                system("cls");
                jm=1;
                x=1;
                y=1;
                return;
            } else if(ditu[(x-1)*a+y]!='#') {
                ditu[x*a+y]=' ';
                x--;
                ditu[x*a+y]='O';
            }
        }
        print(ditu,a,b);
    } while(jm != 1);
}

int main() {
    //Print(2);
    //地图生成。
    string ditu1= "###########O      @###########";
    string ditu2= "###########O       ##### ### ##@     # ###########";
    string ditu3= "####### O# @# ## ##  # ###   #######";
    string ditu4= "###############################0                           ##                            ##                       #   ###   ######  ###              ## ######            ##### #####                            ##                            ##                            ##                            ##                            ##                            ##                            ##                            ##                            ##                            ##                            ##                            ##                           @###############################";
    string ditu5= "###############################O#      #     #Q            ## ###### # ### #             ##     #    #   #             ## # ### ## # ###             ## # #   ## # #               ## #   ###@## #               ## #######z#  #               ##       #Q  #                #### ## ######                ##   ## #                     ## ###  #                     ###### #                      ##     #                      ## ## ##                      ##### ##                      ##                            #####                         #####                         ###############################";
    string ditu6= "###############################O         #   ##   # ### ##### ###### # # #    # # ### ##### #   ## #   # #### # ###   ###   # ##  ###    #  #  ## ######### #     # ##### ##    #####   # ##### #   #   # # #    ## # #    ## # #### ## # # ##### # # ##      ##      # # ##### # # ####### ## ###### #   ### #   ##   # ## ###### ###   ## ###### # #####  #        # ##        # #     ##### ### # @# ######## ##### # ### ### # ##     # ## ##### ###       ######## # ## #      ######## # ##     # ## ## ###        #   ## # ###       ###### ####### ## #    ### ##      #         ###############################";
    //开始界面。
    while(1) {
        zhi1=1;
        jm=1;
        zhi2=3;
        while(jm==1) {
            color(4);
            printf("欢迎来到走迷宫\n\n\n");
            color(0);
            if(zhi1==1) {
                printf("->开始游戏\n");
                printf("  开发简介\n");
                printf("  游戏玩法\n");
            } else if(zhi1==2) {
                printf("  开始游戏\n");
                printf("->开发简介\n");
                printf("  游戏玩法\n");
            } else if(zhi1==3) {
                printf("  开始游戏\n");
                printf("  开发简介\n");
                printf("->游戏玩法\n");
            }
            printf("\n\n\n\n\n\n");
            color(1);
            cout<<"██████████\n█";
            color(4);
            cout<<"█";
            color(0);
            cout<<"██████";
            color(6);
            cout<<"█";
            color(1);
            cout<<"█\n██████████";
            printf("\n\n\n\n\n\n\n\n");
            printf("请用'w','s'选择功能\n");
            printf("按'q'确认");
            xz=getch();
            if(xz==115) zhi1++;
            if(xz==119) zhi1--;
            if(xz==113) jm=zhi1+1;
            if(zhi1<1) zhi1=1;
            if(zhi1>3) zhi1=3;
            system("cls");
        }
        //选关。
        while(jm==2) {
            color(1);
            printf("1  2  3  4  5  6 \n");
            for(int i=1; i<=zhi2-3; i++) printf(" ");
            printf("^ \n");
            color(0);
            printf("请用'a','d'选择关卡\n");
            printf("按'q'确认");
            xz=getch();
            if(xz==100) zhi2+=3;
            if(xz==97) zhi2-=3;
            if(xz==113) jm=zhi2/3+4;
            //if(zhi2>15) zhi2=15;
            system("cls");
        }
        switch(jm) {
            case 3:
                break;
            case 4:
                break;
            case 5:
                jx(ditu1,10,3);
                break;
            case 6:
                jx(ditu2,10,5);
                break;
            case 7:
                jx(ditu3,6,6);
                break;
            case 8:
                jx(ditu4,30,20);
                break;
            case 9:
                jx(ditu5,30,20);
                break;
            case 10:
                jx(ditu6,30,20);
                break;
        }
        if(jm==3) {
        } else if(jm==4) {
        }
        //第一关
        else if(jm==5) {
            jx(ditu1,10,3);
        }
        //第二关
        else if(jm==6) {
            jx(ditu2,10,5);
        }
        //第三关
        else if(jm==7) {
            jx(ditu3,5,6);
        }
        //第四关
        else if(jm==8) {
            jx(ditu4,20,30);
        }
        //第五关
        else if(jm==9) {
            jx(ditu5,20,30);
        }
    }
    return 0;
}
  1. 丧尸危机

#include<bits/stdc++.h>
#include<windows.h>
#include<time.h>
#include<conio.h>
using namespace std;
int mzhg,zd,swhm,qxs,swx,sn,mp,tongguan,sw1,zd1,sn1,mz1,mp1,zbbj,ccg,mzzd,mz,tongguan1,sw,x,s,cdd,jg,qiang,gun,by,vv,gjj[100],hjj[100],zjj[100];
void Read() {
    ifstream in("丧尸危机存档.in");
    in>>mzhg>>zd>>swhm>>qxs>>swx>>sn>>mp>>tongguan>>sw1>>zd1>>sn1>>mz1>>mp1>>zbbj>>ccg>>mzzd>>mz>>tongguan1>>sw>>x>>s>>cdd>>jg>>qiang>>gun>>by>>vv;
    for(int i=0; i<=99; i++) in>>gjj[i];
    for(int i=0; i<=99; i++) in>>hjj[i];
    for(int i=0; i<=99; i++) in>>zjj[i];
    in.close();
}
void Save() {
    ofstream out("丧尸危机存档.in");
    out<<mzhg<<' '<<zd<<' '<<swhm<<' '<<qxs <<' '<<swx<<' '<<sn<<' '<<mp<<' '<<tongguan<<' '<<sw1<<' '<<zd1<<' '<<sn1<<' '<<mz1<<' '<<mp1<<' '<<zbbj<<' '<<ccg<<' '<<mzzd<<' '<<mz<<' '<<tongguan1<<' '<<sw<<' '<<x<<' '<<s<<' '<<cdd<<' '<<jg<<' '<<qiang<<' '<<gun<<' '<<by<<' '<<vv<<'\n';
    for(int i=0; i<=99; i++) out<<' '<<gjj[i];
    out<<'\n';
    for(int i=0; i<=99; i++) out<<' '<<hjj[i];
    out<<'\n';
    for(int i=0; i<=99; i++) out<<' '<<zjj[i];
    out<<'\n';
    out.close();
}
void Slowsay(string a) {
    int l=a.size();
    for(int i=0; i<l; i++) {
        cout<<a[i];
        if(vv==0) Sleep(20);
    }
    printf("\n");
    if(vv==1) Sleep(100);
}
int read() {
    char ch=_getch();
    while(ch>'9'||ch<'0') ch=_getch();
    return ch-48;
}
void qp() {
    system("cls");
    if(swx==2) Slowsay("王,"),zd=99999,sw=99999;
    Slowsay("当前你的状态是\n");
    printf("子弹 %d,食物 %d\n",zd,sw);
}
int esl() {
    system("cls");
    char ch;
    Slowsay("你,饿死了。\n");
    if(vv==0) ch=_getch();
    hjj[1]=1;
    Slowsay("Bad End  1\n");
    ch=_getch();
    s++;
    return 0;
}
int mzd() {
    hjj[2]=1;
    system("cls");
    char ch;
    Slowsay("你,被丧尸咬死了。\n");
    if(vv==0) ch=_getch();
    Slowsay("Bad End   2\n");
    ch=_getch();
    s++;
    return 0;
}
int hd1() {
    system("cls");
    Slowsay("在某一天,你家门口响起了敲门声,你打开门,外面的发现让你欣喜若狂\n");
    Slowsay("政府的救援部队已经消灭了这个城市的丧尸,\n他们在这个城市的各个角落搜索着可能存在的幸存者.\n");
    Slowsay("Happy End-----苟到最后\n");
    Sleep(1000);
    gjj[1]=1;
    return 0;
}
int hd2() {
    system("cls");
    int sw;
    char ch;
    Slowsay("在与妹子相处的这些时间里,你与她相爱了\n");
    Slowsay("你们的生活是那样的幸福\n");
    Slowsay("直到有一天......\n");
    Slowsay("基地首领希望你去执行一个任务,你选择\n");
    Slowsay("1.独自一人前往\n");
    Slowsay("2.和妹子一起去\n");
    while(true) {
        int x;
        x=read();
        if(x<1||x>2) {
            Slowsay("请重新输入\n");
            continue;
        }
        if(x==1) {
            Slowsay("当你完成任务回来的时候,发现——\n");
            Slowsay("基地被丧尸攻破了\n");
            Slowsay("这个基地的所有人都被丧尸杀了,一个人都没跑出来\n");
            hjj[4]=1;
            Slowsay("Bad End    4");
            s++;
        }
        if(x==2) {
            Slowsay("当你和妹子完成任务回来时,\n");
            Slowsay("基地已经变成一片废墟了\n");
            Slowsay("你和妹子没有办法,只能到处流浪\n");
            Slowsay("不过,两个人总比一个人要好\n");
            gjj[2]=1;
            Slowsay("Happy End------神仙眷侣");
        }
        break;
    }
    Sleep(1000);
    return 0;
}
int hd3() {
    system("cls");
    char ch;
    Slowsay("你就这样平静的生活在这个基地里\n");
    Slowsay("直到某一天,大量的丧尸进攻了这里\n");
    if(zd>9) {
        Slowsay("每个人都在尽自己的努力去守卫基地\n");
        Slowsay("每个人都做到了自己能做到的\n");
        Slowsay("最后,奇迹出现了\n");
        Slowsay("大家成功守住了基地\n");
        Slowsay("而你,也因为在守卫过程中立下大功成为了这个基地的英雄\n");
        Slowsay("顺便说一句,到死了你也没女朋友\n");
        gjj[3]=1;
        Slowsay("Happy End-----英雄不朽");
        return 0;
    }
    Slowsay("丧尸的数量实在太多了,\n");
    Slowsay("尽管基地的大家都在尽全力防守\n");
    Slowsay("可基地还是被攻破了\n");
    Slowsay("而你,也死在了这里\n");
    s++;
    hjj[5]=1;
    Slowsay("Bad End     5");
    Sleep(1000);
}
int hd4() {
    system("cls");
    Slowsay("在于少年相处的这些时间里");
    Slowsay("你尽力地保护着他");
    Slowsay("而他也常常给你带来惊喜");
    Slowsay("慢慢的,你开始认清你自己");
    Slowsay("你是个gay");
    Slowsay("于是,你就和少年性福快乐的生活在了一起");
    Slowsay("Happy End-----认清自己");
    gjj[4]=1;
    Sleep(1000);
}
int td() {
    system("cls");
    char ch;
    Slowsay("那箱饼干与你的枪一起发出了强光\n");
    Slowsay("紧接着,他们融为了一体\n");
    Slowsay("当光芒散去时,整个世界都发生了变化\n");
    Slowsay("所有的丧尸都变回了人类\n");
    Slowsay("伟大的勇士!丧尸危机终于解除了!!接下来,是普天同庆的大狂欢!!!\n");
    Slowsay("True End-----拯救世界\n");
    Sleep(1000);
    Slowsay("???????????????????????????????????");
    Slowsay("......这是怎么回事......");
    Slowsay("......为什么......");
    Slowsay("......不是普通的......");
    Slowsay("......从何而来......");
    Sleep(1000);
    Slowsay("。 。 。 。 。 。是谁。 。 。 。 。 。");
    Slowsay("你陷入沉思。");
    if(zjj[1]!=1) {
        Slowsay("获得线索-----奇特的枪与饼干");
    }
    zjj[1]=1;
    Sleep(1000);
}
int td2() {
    system("cls");
    char ch;
    Slowsay("你的变异已经开始了");
    Slowsay("你开始疯狂的进食,直到把自己的胃撑破");
    Slowsay("然后,就眼前一黑失去意识");
    Slowsay("再次醒来时,你已经是一个丧尸了");
    Slowsay("奇怪的是,你还保留着自己的意识");
    Slowsay("你感觉到自己的力气变得更大,速度变得更快");
    Slowsay("或许变成丧尸也不错————你这样想着");
    Slowsay("True End-----认清!·本我");
    if(zjj[2]!=1) {
        Sleep(2000);
        Slowsay("获得线索-----延迟变异!·少年");
    }
    zjj[2]=1;
    Sleep(1000);
}
int bd8() {
    Slowsay("坐在椅子上的是一个15岁左右的少年");
    Slowsay("正在你因为他的年龄而惊讶时");
    Slowsay("少年却站了起来,看向了你身后的妹子");
    Slowsay("“差不多了吧”,妹子这样说道");
    Slowsay("“可以了”,这是少年的回答");
    Slowsay("然后,你就感到脖子一阵剧痛");
    Sleep(1000);
    Slowsay("在你失去意识前,妹子一直没有松口。");
    s++;
    Slowsay("Bad End     8");
    if(hjj[8]==0) {
        Sleep(2000);
        Slowsay("获得线索-----早已变异!·妹子");
    }
    hjj[8]=1;
    Sleep(1000);
}
int td3() {
    system("cls");
    Slowsay("你和妹子冲出了丧尸的围杀,");
    Slowsay("可是当你们来到那个幸存者基地时");
    Slowsay("却发现那个基地有一些不对");
    Slowsay("所有人都死气沉沉的");
    Slowsay("你们直接走向了首领的房间");
    Sleep(1000);
    if(zjj[2]==1&&zjj[3]==1) {
        bd8();
        return 0;
    }
    Slowsay("换完子弹的你想离开");
    Slowsay("就在你快要离开的时候,妹子抓住了你的手");
    Slowsay("“我喜欢你,别走”,她这样说");
    Slowsay("于是,你留了下来");
    Slowsay("你们的生活是那样的幸福");
    Slowsay("直到有一天......");
    Sleep(1000);
    Slowsay("基地首领希望你去执行一个任务,\n");
    Slowsay("在执行任务的过程中");
    Slowsay("妹子曾被丧尸咬到过一口");
    Slowsay("她以为你没有发现");
    Slowsay("而你却在远处看到了这一幕");
    Slowsay("奇怪的是,她却并没有变异\n");
    Slowsay("那一刹那你突然想起,");
    Slowsay("你们的房间里,总是弥漫着一股血腥的味道......");
    Sleep(1000);
    Slowsay("Happy End------神仙眷侣");
    Sleep(1000);
    Slowsay("???????????????????????????????????");
    Slowsay("True End------认清?·妹子");
    if(zjj[3]==0) {
        Sleep(2000);
        Slowsay("获得线索-----不变异?·妹子");
    }
    zjj[3]=1;
    Sleep(1000);
}
int td4() {
    system("cls");
    Slowsay("当丧尸危机爆发时,你正呆在家里\n");
    char ch=_getch();
    if(vv==0) ch=_getch();
    system("cls");
    Slowsay("当丧*#******丧尸危机*$*&*^&*机爆发时,**你正呆***&*爆发******#在家里**\n");
    Sleep(1000);
    Slowsay("***检*#******测到*不**丧尸危**88机*$匹*$**机爆发时,**配***#在家里****\n");
    Sleep(2000);
    Slowsay("L当****#OG****I危机*$N**E机爆***(RR*8%#404)**发时,**你O*****#在家R里!\n");
    Sleep(2000);
    system("cls");
    if(vv==0) ch=_getch();
    Slowsay("有什么不对劲");
    Slowsay("你这样想着");
    Slowsay("过去了好多天,\n你还是一个人都没有遇到,\n除了丧尸就是丧尸");
    Slowsay("为什么他们......不见了?");
    Slowsay("\n");
    Slowsay("True End------验证失败");
    zjj[4]=1;
    if(zbbj==0)
        Slowsay("进阶线索-----乱码,废弃与失联"),zbbj=1;
    Sleep(1000);
}
int td5() {
    system("cls");
    Slowsay("当少年死去后,整个世界好像变得不同了");
    Slowsay("所有的活人在一瞬间消失");
    Slowsay("所有的丧尸当场去世");
    Slowsay("你的眼前只剩下了黑暗");
    Slowsay("不知道过去了多久,你死了");
    Slowsay("Bad End......");
    Sleep(1000);
    Slowsay("不,还没有结束");
    Slowsay("虽然好像和往常死去之后的感觉一样");
    Slowsay("但是。。。好像。。。");
    Sleep(1000);
    Slowsay("有延迟?。。。");
    Slowsay("。。。在这段时间里,你的思考一直没停。。。");
    Slowsay("True End-----死亡姗姗来迟");
    s++;
    if(zjj[5]==0)
        Slowsay("进阶线索-----少年之死");
    zjj[5]=1;
    Sleep(1000);
}
int tg3() {
    Slowsay("当你再次睁开眼时");
    Slowsay("你发现自己躺在一个营养仓内");
    Slowsay("你无比的确认这就是真实的世界");
    Slowsay("脑中的一切开始明晰起来");
    Slowsay("你认为自己知道了一切的真相");
    Slowsay("去杀光人类吧!!!!");
    Slowsay("你这样想着");
    Slowsay("在身着白大褂的丧尸们的欢呼声中");
    Slowsay("你打碎了玻璃,跑出了营养仓");
    Slowsay("来到了外面这个被战争破坏得满目疮痍的世界");
    Slowsay("战火硝烟,炮声隆隆");
    Slowsay("你熟练的发出嘶吼,呼唤着周围的丧尸");
    Slowsay("你指挥着他们,毁掉了一个又一个人类的基地");
    Slowsay("最后,在这场世纪战争中,丧尸们艰难地取得了胜利");
    Slowsay("作为它们的英雄,你自豪的统治着世界。");
    Slowsay("虽然,其实,在那些你不知道的地方");
    Slowsay("一个个一样的营养仓中,装着一个个一样的你。");
    Slowsay("---------------游戏终极剧情通关-------------");
    tongguan1=2;
    Save();
    Sleep(1000);
}
int tg2() {
    Slowsay("当你再次睁开眼时");
    Slowsay("你发现自己躺在一个营养仓内");
    Slowsay("你无比的确认这就是真实的世界");
    Slowsay("可是你却发现自己没法操纵身体");
    Slowsay("隔着玻璃,一个黑色的身影正在操作着");
    Slowsay("你清晰的看见那个人的大脑裸露出来,与你的接在一起");
    Slowsay("这时,又有一大波记忆涌入脑海。");
    Slowsay("“少年与妹子......是以“成功者”“英雄”“神话传说”为原型创造的人物......”");
    Slowsay("“游戏中的情节与场景......取材于现实世界真实案例......”");
    Slowsay("再往后,你的脑中一片混乱。");
    Slowsay("“...舍弃.........熟练..我....智慧..学习........获得.....”");
    Slowsay("“.....种族...探索.......杀...进化.........帮助..需要.....”");
    Slowsay("“...成熟....兵器.....无敌..下风.......战争...伟大.....英雄.....”");
    Slowsay("激昂的声音一直回荡着。");
    Slowsay("---------------游戏进阶剧情通关-------------");
    tongguan1=1;
    Sleep(1000);
}
int td6() {
    Slowsay("一天以后,少年回来了");
    Slowsay("一起回来的还有妹子");
    Slowsay("“找到了......”");
    Slowsay("少年的手中拿着一个破损的铭牌");
    Slowsay("铭牌上的字迹很诡异,但写着熟悉的内容:");
    Slowsay("【22-08-03...】");
    Slowsay("“你的......”");
    Slowsay("妹子神色复杂的看了你一眼");
    Slowsay("“我们是一类人......”");
    Slowsay("“现在,让我把你带出去吧。”");
    if(qxs==1&&swx==0) {
        tg2();
        return 0;
    } else {
        Slowsay("一股强烈的撕扯感出现到了你身上");
        if(swx==1) Slowsay("此时的你,是如此渴望着死亡与结局\n你大笑着张开双臂,迎接了死亡。");
        else Slowsay("此时的你并不能接受如此巨大的伤害"),Slowsay("你死了。");
        Slowsay("Bad End      14");
        if(hjj[14]==0)
            Slowsay("进阶线索-----外面的世界");
        hjj[14]=1;
        s++;
    }
    Sleep(1000);
}

int bd6() {
    system("cls");
    Slowsay("你感觉到自己正在变异,");
    Slowsay("意识开始逐渐模糊起来");
    Slowsay("你的肚子正无比渴望着食物,你啃噬着触及的一切!");
    Slowsay("但是不够,你的身躯饿得干枯,你甚至开始食用自己的躯体!");
    Slowsay("接着,你眼前一黑,再也没有醒来......");
    s++;
    hjj[6]=1;
    Slowsay("Bad End      6");
    Sleep(1000);
}

int bd3() {
    system("cls");
    char ch;
    Slowsay("长久的等待终于让你失去了理智,你疯了。\n");
    Slowsay("Bad End   3\n");
    hjj[3]=1;
    Sleep(1000);
    if(mp==-1) {
        Slowsay("当政府的救援队打开你家的门时,你嘶吼着扑了上去");
        if(zd>0)
            Slowsay("他们试图将你击毙,却被你提前一枪击倒");
        else {
            Slowsay("你被他们击毙了");
            Slowsay("Bad End       12");
            s++;
            hjj[12]=1;
            return 0;
        }
        Slowsay("你如同一个熟练的猎手,狩猎着救援队");
        Slowsay("当他们全部死去后,你开始享用起你的大餐");
        Slowsay("Bad End           13");
        if(by==0)
            Sleep(2000),Slowsay("进阶线索-----早已变异!·本我"),by=1;
        hjj[13]=1;
        return 0;
    }
    s++;
}
int bd7() {
    s++;
    system("cls");
    Slowsay("你,被狗咬死了");
    Slowsay("Bad End      7");
    hjj[7]=1;
    Sleep(1000);
}

int bd15() {
    s++;
    Slowsay("你发现这笔迹有些不对");
    Slowsay("就好像是新写上去的一样");
    Slowsay("认字迹的话,好像还十分熟悉");
    Sleep(1000);
    Slowsay("正当你想的入迷的时候,你的脖子被咬住了");
    Slowsay("在死前,你隐约听到了少年的声音,“Again.”");
    Slowsay("Bad End     15");
    if(hjj[15]==0) {
        Sleep(2000);
        Slowsay("进阶线索-----伪造......");
    }
    hjj[15]=1;
    Sleep(1000);
}
int tgg3() {
    system("cls");
    Slowsay("你杀掉了少年,并吃掉了他的尸体");
    Slowsay("世界开始崩塌");
    tg3();
    Sleep(1000);
}
int bd9() {
    s++;
    system("cls");
    Slowsay("诡异的是,当你杀光了跟来的丧尸后,发现地下室里并没有丧尸");
    Slowsay("这里有的,只是一个穿着白大褂的尸体");
    Slowsay("在尸体的衣服口袋中,你找到了一个笔记本");
    Slowsay("****(无法辨认)1号****进展*****永生**");
    Slowsay("今********,*号诞生了,他比其*****更*");
    Slowsay("有些不对,*****的发育*****太快***");
    Slowsay("2号的**被***出有*****强感染性*****");
    Slowsay("**********************************");
    Slowsay("***瓶颈,或许我们**应该****活体样本");
    Slowsay("**,**样本*****失去活性,*****但**在动\n");
    if(mp==-1) {
        bd15();
        return 0;
    }
    Slowsay("正当你看的入迷的时候,你的脖子被咬住了");
    Slowsay("在死前,你隐约听到了少年的声音,“Again.”");
    Slowsay("Bad End     9");
    if(hjj[9]==0) {
        Sleep(2000);
        Slowsay("获得线索-----实验体·1号和2号");
    }
    hjj[9]=1;
    Sleep(1000);
}

int tg() {
    system("cls");
    Slowsay("不知为何,当你走到这里时,感到世界在一瞬间发生了变化");
    Slowsay("你不知道这个变化发生在那里,你只知道,现在的世界十分违和");
    Slowsay("或许,这个世界不是真实的");
    Slowsay("当你的脑中出现了这个的时候,你眼前的世界,蹦塌了");
    Slowsay("于此同时,大量记忆冲进了你的脑海");
    Slowsay("不,它们只是回来了,这本身就是你的记忆");
    Slowsay("他们在一开始被一些虚假的记忆所替换");
    Slowsay("从记忆中,你得知你此时正在玩一个vr游戏");
    Slowsay("少年与妹子则是游戏的npc");
    Slowsay("这款游戏号称有着超强的代入感");
    Slowsay("你在发售当天就买来玩了");
    Slowsay("“这游戏真是了不起啊”,你这样想着,“再玩一次吧”");
    Slowsay("...是啊,没错,这一切只是游戏,游戏。............");
    Sleep(1000);
    Slowsay("躺在仓中的你,自始至终,都没有睁开眼。");
    Slowsay("---------------游戏基础剧情通关-------------");
    cdd=0;
    tongguan=1;
    Sleep(1000);
}
int cg() {
    system("cls");
    Slowsay("你感觉到违和感在不断加深");
    Slowsay("世界好像不再是真实的");
    Slowsay("你现在脑中只有一种想法\n");
    Sleep(1000);
    Slowsay("活下去!越久越好!!!");
    Sleep(1000);
}
int cg2() {
    system("cls");
    system("Color C");
    Slowsay("违和感在此时已经聚集到了顶峰\n");
    Slowsay("你的脑中想清楚了一切\n");
    Slowsay("1.那么,下一步是  杀光他们\n");
    Slowsay("2.那么,下一步是  团结起来\n");
    x=read();
    if(x==1)
        Slowsay("已立起尸王线flag,接下来,去打通全 15 badend!"),swx=1,qxs=1;
    else
        Slowsay("“看来你还是没懂啊......”背后传来冷冷的声音\n\n“ A  G  A  I  N   . ”");
    system("Color F");
    Sleep(1000);
}
int Swx() {
    system("cls");
    Slowsay("哈。。。哈。。。哈。。。。。。");
    Slowsay("我。。。已经完成了。。。");
    Slowsay("所有的死法。。。我都体验了一遍了。。。");
    Slowsay("我。。。一直是只丧尸吧。。。");
    Slowsay("无论被打倒多少次。。。我都会站起来继续。。。");
    Slowsay("只要是我想通的结局。。。我便一定会通掉它。。。");
    Slowsay("只要是我想杀的人。。。我便一定会杀死他。。。");
    Slowsay("只要是我想知道的真相。。。我便一定会知晓它。");
    Slowsay("我。。。已经不是以前的那个懦弱无能的我了。。。");
    Slowsay("这一轮。。。我。。。要成为王!!!\n");
    Slowsay("在实验室中,为首者发出低哑的嘶吼:");
    Slowsay("所有人员一级戒备!实验,进入最后阶段!!");
    Slowsay("------------终极剧情-尸王线开启!------------");
    cdd=0;
}
int bd10() {
    system("cls");
    Slowsay("你发现了另一个基地");
    Slowsay("弹尽粮绝的你选择加入了他们");
    Slowsay("之后的每一天都十分单调");
    Slowsay("外出寻找物资,然后天黑了回家睡觉");
    Slowsay("应该是这样吗?");
    Slowsay("也许吧");
    Slowsay("Bad End     10");
    hjj[10]=1;
    Sleep(1000);
}
int hd5() {
    Slowsay("没关系的,一切都会过去的");
    Slowsay("你这样说的");
    Slowsay("他似乎感觉到了你的善意,一点一点向你靠近");
    Slowsay("你紧紧的抱住了他");
    Slowsay("我会保护好你的");
    Sleep(1000);
    Slowsay("Happy End-----跨越物种的gay~");
    Sleep(1000);
}
int sswj() {
    Save();
    system("cls");
    int w=0;
    mp=0;
    if(tongguan==1&&zjj[4]==0) {
        Slowsay("检测到你已通关,是否领取特殊物品\n");
        Slowsay("1.领取");
        Slowsay("2.不领取");
        while(true) {
            x=read();
            if(x==1)
                mp=-1;
            if(x==2) {
                td4();
                return 0;
            }
            break;
        }
    } else if(tongguan==1) {
        Slowsay("检测到你已通关,已领取特殊物品\n");
        mp=-1;
    }
    char ch;
    if(cdd==1) {
        Slowsay("是否读取存档\n");
        Slowsay("1.读取\n");
        Slowsay("2.不读取\n");
        x=read();
        if(x==1) {
            sw=sw1;
            zd=zd1;
            sn=sn1;
            mz=mz1;
            mp=mp1;
            goto cddd1;
        }
    }
    system("cls");
    Slowsay("当丧尸危机爆发时,你正呆在家里\n");
    if(vv==0) ch=_getch();
    Slowsay("你有10点物资可以分配到子弹和食物上");
    if(swx==2) Slowsay("...\n\n但是!不!我已经不会再惧怕食物短缺与丧尸小兵了!\n\n我,应当是世界的王!!\n"),zd=99999,sw=99999;
    else {
        if(vv==0) ch=_getch();
        int x,y;
        qiang=0;
        gun=0;
        zd=0;
        sw=0;
        mz=0;
        mzzd=0;
        sn=0;
        mzhg=0;
        Slowsay("\n请输入你的选择(此次输入需键入回车,例:5 5 )\n");
        while(true) {
            scanf("%d%d",&x,&y);
            zd=x;
            sw=y;
            if(x+y!=10||x<0||y<0) {
                if(x==666666&&y==5201314) {
                    Slowsay("启用秘籍\n");
                    Slowsay("请输入你真正需要的子弹数和食物数(上限:999 )\n");
                    scanf("%d%d",&x,&y);
                    zd=min(x,999);
                    sw=min(y,999);
                    break;
                }
                Slowsay("请重新输入\n");
                w++;
                if(w>5) {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
                    Slowsay("行了行了,这只是第一个选择而已\n"),
                            Slowsay("有必要这么皮吗\n"),
                            Slowsay("自动分配食物3个子弹7个\n");
                    if(vv==0) ch=_getch();
                    sw=3,zd=7;
                    break;
                }
            } else break;
        }
    }
    Slowsay("你的家里是个较为安全的地方,你可以选择搜索你家的物资或是去邻居家看看\n");
    if(vv==0) ch=_getch();
    Slowsay("1.留在家中\n");
    Slowsay("2.前往邻居家\n");
    while(true) {
        x=read();
        if(x!=1&&x!=2)
            Slowsay("请重新输入\n");
        else if(x==1) {
            if(swx==2) {
                Slowsay("饿啊!为什么我还呆在家里!!");
                break;
            } else {
                Slowsay("在二楼,你发现了一些食物食物+3\n");
                if(vv==0) ch=_getch();
                Slowsay("在家里过了一夜,食物-1\n");
                sw=sw+2;
                break;
            }
        } else {
            if(swx==2) {
                Slowsay("可恶!为什么邻居家里没有人!!");
                break;
            } else {
                Slowsay("在前往邻居家的路上,你遇到了丧尸\n");
                if(vv==0) ch=_getch();
                if(zd<1) {
                    Slowsay("你朝他开了一枪,不过枪里没有子弹,你被他咬死了\n");
                    if(vv==0) ch=_getch();
                    hjj[11]=1;
                    Slowsay("Bad End      11\n");
                    s++;
                    if(vv==0) ch=_getch();
                    Slowsay("另外在说一句,一个子弹都不带,还到处乱浪,你是真的作");
                    return 0;
                } else {
                    Slowsay("你用你手中的枪结束了他的生命,子弹-1\n");
                    zd=zd-1;
                    if(vv==0) ch=_getch();
                    Slowsay("邻居家里不知为何并没有人,你在仔细搜索后发现了一个弹夹,里面有4发子弹\n");
                    zd+=4;
                    if(vv==0) ch=_getch();
                    Slowsay("在邻居家过了一夜后,食物-2\n");
                    sw=sw-2;
                    if(sw<0) {
                        esl();
                        return 0;
                    }
                }
                break;
            }
        }
    }
    if(vv==0) ch=_getch();
    qp();
    Slowsay("你回想起这附近有一座商场,你决定\n");
    if(vv==0) ch=_getch();
    Slowsay("1.前往商场\n");
    Slowsay("2.到处乱走\n");
    Slowsay("3.留在屋子里\n");
    while(true) {
        x=read();
        if(x!=1&&x!=2&&x!=3) {
            Slowsay("请重新输入\n");
            continue;
        }
        if(swx==2&&x==1) {
            system("cls"),Slowsay("你循着残存的记忆前往商场,找到了适合你膨胀体型的衣服,可以继续隐藏下去。\n\n"),mz=1;
            break;
        } else if(swx==2&&x==2) {
            system("cls"),Slowsay("你到处乱走,见人即杀,丧尸与人类的血混合着溅满了街道,\n惨叫连连,火光接天,如同末世一般。\n你站在尸山上狂笑,不屑于看那些渺小的灵魂。\n\n然而,你丝毫没有注意,一个娇小的身影远远的看到了你,捂着嘴逃之夭夭。\n\n"),mz=10086;
            break;
        } else if(swx==2&&x==3) {
            system("cls");
            Slowsay("你如一名老练的猎手忍耐着饥饿,终于等来了敲门声。\n你得意洋洋的屠杀着这送上门来的大餐\n并跟踪着逃兵进入了幸存者基地。\n那一天,残阳似血,为浸染大地的红再镶上一道道金光。\n\n");
            Sleep(1000);
            return 0;
        } else if(x==3) {
            if(sw<2) {
                esl();
                return 0;
            }
            Slowsay("无聊正在逐渐消磨你的意志,但你还是坚持了下来。食物-2\n");
            sw=sw-2;
            if(vv==0) ch=_getch();
            Slowsay("之后的每一天你都是这样,独自一人在家中等待救援\n");
            if(vv==0) ch=_getch();
            Slowsay("在过了好久之后\n");
            cout<<mp;
            if(sw<6) {
                esl();
                return 0;
            }
            x=rand()%2;
            if(x==1&&mp==0) {
                hd1();
                return 0;
            } else {
                bd3();
                return 0;
            }
        } else if(x==2) {
            int xx=rand()%3;
            if(xx!=0) {
                Slowsay("在到处乱走的过程中,你遇到了来自世界各地的丧尸,子弹-2\n");
                if(zd<2) {
                    mzd();
                    return 0;
                }
                zd=zd-2;
            } else {
                Slowsay("在到处乱走的过程中,你走入了一处曾为战场的废墟\n");
                if(vv==0) ch=_getch();
                Slowsay("你循着硝烟味,终于找到了军队残留的弹药箱,子弹+6\n");
                zd+=6;
            }
            break;
        } else if(x==1) {
            if(zd<4) {
                mzd();
                return 0;
            }
            Slowsay("在前往商场的过程中,你遇到了丧尸,子弹-4\n");
            zd=zd-4;
            if(vv==0) ch=_getch();
            Slowsay("你在商场发现了食物与子弹,食物+3,子弹+2\n");
            sw=sw+3;
            zd=zd+2;
            break;
        }
    }
    if(mz!=10086) {
        Slowsay("你在回家的路上发现了一个女幸存者\n");
        if(vv==0) ch=_getch();
        Slowsay("她试图向你讨要食物,你的选择是\n");
        Slowsay("1.不给\n");
        Slowsay("2.给她2份食物\n");
        Slowsay("3.给她2份子弹\n");
        Slowsay("4.给她一枪\n");
        while(true) {
            x=read();
            if(x<1||x>4) {
                Slowsay("请重新输入。\n");
                continue;
            }
            if(x==1) {
                Slowsay("妹子生气的走了。\n");
                if(vv==0) ch=_getch();
            }
            if(x==2) {
                if(sw<2) {
                    Slowsay("食物不足\n");
                    continue;
                }
                sw=sw-2;
                mzhg++;
                Slowsay("你的食物-2,妹子好感度+1\n");
                if(vv==0) ch=_getch();
            }
            if(x==3) {
                if(zd<2) {
                    Slowsay("子弹不足\n");
                    continue;
                }
                mzzd=1;
                Slowsay("你给了妹子两份子弹,妹子离开了\n"),zd=zd-2;
                if(vv==0) ch=_getch();
            }
            if(x==4) {
                if(zd<1) {
                    Slowsay("子弹不足\n");
                    continue;
                }
                zd=zd-1;
                Slowsay("你一枪杀死了妹子,并从她的尸体上找到了4份食物\n");
                sw=sw+4;
                mzhg=-1;
                if(swx==2) Slowsay("你吃掉了妹子的尸体,真是人间佳肴!\n"),mzhg=-10086;
            }
            if(swx==2&&x!=4) Slowsay("你看着妹子的背影在心中狂笑\n"),mzhg=10086;
            break;
        }
    }
    Slowsay("又过了一夜,你的食物-2\n");
    if(vv==0) ch=_getch();
    qp();
    sw=sw-2;
    if(sw<0) {
        esl();
        return 0;
    }
    if(mzhg==1) Slowsay("那个妹子又来找到了你,并邀请你加入他们的幸存者基地\n");
    else Slowsay("你在附近发现了一个幸存者基地\n");
    if(swx!=2) {
        Slowsay("在前往基地的途中,你遇到了丧尸\n");
        Slowsay("你且战且退,大量丧尸把你逼进了一家商店\n");
        Slowsay("门口的丧尸越来越多,你选择\n");
        Slowsay("1.杀出去\n");
        Slowsay("2.守在这\n");
        while(true) {
            x=read();
            if(x<1||x>2) {
                Slowsay("请重新输入\n");
                continue;
            }
            if(x==1) {
                int res=0;
                if(mzhg>0)
                    res=1;
                else res=3;
                if(zd<res) {
                    mzd();
                    return 0;
                }
                zd=zd-res;
                printf("你消耗了一些子弹冲了出去,子弹-%d\n",res);
                if(mzzd==1&&mp==-1) {
                    Slowsay("妹子在她杀死的丧尸的尸体上找到了许多物资,子弹+7,食物+3\n");
                    zd=zd+7;
                    sw=sw+3;
                    mz=1;
                    break;
                }
                x=rand()%5;
                if(res==1&&x!=3)
                    Slowsay("妹子为了帮你突围,被丧尸咬到,然后自杀了。\n"),mzhg=-1;
                if(x==3&&res==1) {
                    td3();
                    return 0;
                }
            } else if(x==2) {
                if(zd<5) {
                    mzd();
                    return 0;
                }
                zd=zd-5;
                Slowsay("你守在这家商店里直到杀死了所有找来的丧尸,子弹-5\n");
                if(mzhg==1) {
                    Slowsay("妹子在商店中发现了一把无限子弹的枪,子弹+10086\n");
                    zd=10086;
                    if(vv==0) ch=_getch();
                    Slowsay("但是妹子在翻找货架的时候被沾了丧尸血的货架划伤\n");
                    Slowsay("妹子自杀了\n");
                    mzhg=-1;
                }
            }
            break;
        }
    }
    if(vv==0) ch=_getch();
    qp();
    Slowsay("你来到了这个幸存者基地\n");
    if(mz==10086) {
        system("cls");
        Slowsay("人们在一位年轻首领的带领下顽强的与你战斗\n每个人都在尽自己的努力去守卫基地\n哪怕战友们一个个倒下\n哪怕首领被你愤怒的捏爆脑袋\n没有一个人放弃战斗,没有一个人抛弃希望\n\n最后,奇迹出现了\n\n在基地的废墟中,你的尸体沉重的倒下。\n\n");
        s++;
        Sleep(1000);
        return 0;
    }
    Slowsay("这个基地的首领表示可以用子弹交换你手中的食物\n");
    printf("你还有%d份食物,%d份子弹\n",sw,zd);
    if(vv==0) ch=_getch();
    Slowsay("请输入你需要的子弹数(0-9)\n");
    while(true) {
        x=read();
        if(x<0||x>sw) {
            Slowsay("请重新输入\n");
            continue;
        }
        sw=sw-x;
        zd=zd+x;
        if(x>=1) {
            Slowsay("首领很开心你能提供稀缺的食物,多给了你1份子弹\n");
            zd=zd+2;
        }
        break;
    }
    if(vv==0) ch=_getch();
    qp();
    Slowsay("又过了一天,食物-2");
    sw=sw-2;
    if(sw<0) {
        esl();
        return 0;
    }
    if(vv==0) ch=_getch();
    system("cls");
    Slowsay("基地首领希望你加入这个基地\n");
    Sleep(500);
    Slowsay("你的选择是\n");
    Sleep(500);
    system("Color C");
    Slowsay("1.留在这");
    Slowsay("2.离开");
    while(true) {
        x=read();
        if(x<1||x>2) {
            Slowsay("请重新输入\n");
            continue;
        }
        system("Color F");
        if(swx==2&&x==1) {
            system("cls");
            Slowsay("在一个月黑风高的夜里,你终于忍不住袭击了营地。\n年轻首领被你梦中封喉。\n人们顽强的与你战斗\n每个人都在尽自己的努力去守卫基地\n没有一个人放弃战斗,没有一个人抛弃希望\n但是他们失败了。\n在基地的废墟中,英雄们的尸体沉重的倒下。\n\n而你狂笑着吞噬着一切。\n\n");
            Sleep(1000);
            return 0;
        } else if(x==1) {
            if(mzhg>-1) hd2();
            else hd3();
            return 0;
        } else if(x==2) {
            Slowsay("你决定\n");
            Slowsay("1.当天离开\n");
            Slowsay("2.再停留一天\n");
            while(true) {
                x=read();
                if(x<1||x>2) {
                    Slowsay("请重新输入\n");
                    continue;
                }
                if(x==1) break;
                if(x==2) {
                    if(vv==0) ch=_getch();
                    qp();
                    Slowsay("这个基地的首领表示可以用子弹交换你手中的食物\n");
                    printf("你还有%d份食物,%d份子弹\n",sw,zd);
                    if(vv==0) ch=_getch();
                    Slowsay("请输入你需要的子弹数\n");
                    while(true) {
                        x=read();
                        if(x<0||x>sw) {
                            Slowsay("请重新输入\n");
                            continue;
                        }
                        sw=sw-x;
                        zd=zd+x;
                        if(x>=3) {
                            Slowsay("首领很开心你能提供稀缺的食物,多给了你3份子弹\n");
                            zd=zd+3;
                        }
                        break;
                    }
                    sw=sw-2;
                    if(sw<0) {
                        esl();
                        return 0;
                    }
                    Slowsay("又过了一夜,食物-2\n");
                }
                break;
            }
            Slowsay("在你离开的时候,一个少年跑了过来。\n");
            Slowsay("他说,他想要和你一起走\n");
            Slowsay("1.带上他\n");
            Slowsay("2.不带他\n");
            while(true) {
                x=read();
                if(x<1||x>2) {
                    Slowsay("请重新输入\n");
                    continue;
                }
                if(x==2) {
                    Slowsay("少年生气的离开了");
                    if(swx!=2) Slowsay(",当他走远了,你才发现\n\n在刚刚的接触中,他偷走了你所有的子弹\n");
                    else Slowsay("\n当你走远后,你才发现,少年一直冷笑着跟在你的身后\n"),sn=1;
                    zd=0;
                }
                if(x==1) {
                    Slowsay("你选择上少年一起走\n");
                    Slowsay("少年将他身上带着的一份食物交给了你\n");
                    sw=sw+1;
                    Slowsay("食物消耗+1,少年入队\n");
                    sn=1;
                }
                break;
            }
        }
        break;
    }
    if(vv==0) ch=_getch();
    qp();
    printf("你在路边的一座没人的房子里过了一夜,食物-%d\n",2+sn);
    sw=sw-2-sn;
    if(vv==0) ch=_getch();
    if(sn==1&&swx==2) {
        Slowsay("\n1.杀了少年,这时没人可以阻止你!\n");
        Slowsay("2.我决定在少年面前一直隐瞒到底\n");
        x=read();
        if(x==1) {
            Slowsay("少年不见了,难道他发现了......\n\n你一回头,少年咯咯笑着咬住你的脖子\n\n你应该等我虚弱时再下手啊.....\n\n");
            s++;
            return 0;
        }
    }
    if(sw<0) {
        esl();
        return 0;
    }
    Slowsay("是否存档?\n");
    Slowsay("1.存档(记录当前进度,只能有一个存档)\n");
    Slowsay("2.不存\n");
    x=read();
    if(x==1) {
        cdd=1;
        sw1=sw;
        zd1=zd;
        mp1=mp;
        mz1=mz;
        sn1=sn;
        Slowsay("存档成功");
    }
cddd1:
    qp();
    if(sn==1) {
        vv=0;
        Slowsay("今天一早你就被少年叫醒了,\n");
        if(vv==0) ch=_getch();
        Slowsay("他在床底下发现了一箱方便面,食物+8\n");
        sw=sw+8;
        Slowsay("少年向你讨要武器,你决定\n");
        Slowsay("1.把枪给他\n");
        Slowsay("2.把捡到的水管给他\n");
        Slowsay("3.什么都不给他\n");
        while(true) {
            x=read();
            if(x<1||x>3) {
                Slowsay("请重新输入\n");
                continue;
            }
            if(x==1) gun=0,qiang=2;
            if(x==2) gun=2,qiang=1;
            if(x==3) gun=0,qiang=1;
            break;
        }
    } else {
        Slowsay("你在冰箱里发现了几包巧克力\n");
        if(vv==0) ch=_getch();
        Slowsay("希望它们还没过期吧,食物+3\n");
        sw=sw+3;
    }
    if(vv==0) ch=_getch();
    Slowsay("今天你们来到了一家大商场\n");
    Slowsay("你决定\n");
    Slowsay("1.独自探索1楼\n");
    Slowsay("2.独自探索2楼\n");
    if(sn==1) {
        Slowsay("3.和少年一起探索2楼");
    }
    while(true) {
        x=read();
        if(x<1||x>3) {
            Slowsay("请重新输入\n");
            continue;
        }
        if(x==1) {
            Slowsay("你在一楼发现了一些子弹,子弹+3\n");
            zd=zd+3;
            Slowsay("奇怪的是,一只丧尸都没有看到\n");
            if(vv==0) ch=_getch();
            if(sn>0) {
                if(qiang==2) {
                    Slowsay("当你来到二楼时,发现了一地尸体\n");
                    Slowsay("少年就倒在这尸体中间,他死前手还紧紧握着枪\n");
                    Slowsay("你把枪拿了回来,并在少年的尸体下面发现了一箱压缩饼干以及一把几乎无限子弹的枪\n");
                    Slowsay("食物+10086\n");
                    Slowsay("子弹+10086\n");
                    if(vv==0) ch=_getch();
                    sw=10086;
                    zd=10086;
                    if(sw>10000&&zd>9000) {
                        td();
                        return 0;
                    }
                    sn=0;
                    qiang=1;
                } else {
                    Slowsay("当你来到二楼时,发现了少年的尸体\n");
                    if(vv==0) ch=_getch();
                    sn=0;
                    Slowsay("你紧紧握着手中的枪,猛地一回头\n");
                    Slowsay("四周大量的丧尸向你涌来\n");
                    if(vv==0) ch=_getch();
                    zd=zd-5;
                    if(zd<0) {
                        mzd();
                        return 0;
                    }
                    Slowsay("你杀光了这些丧尸,子弹-5\n");
                    if(vv==0) ch=_getch();
                    Slowsay("你在二楼找到了食物,食物+3\n");
                    sw+=3;
                }
            }
        }
        if(x==2) {
            Slowsay("你来到了二楼,数之不尽的丧尸忽然从阴影中窜出\n");
            if(qiang==2) {
                Slowsay("尽管你没了枪也尽力抵抗,可丧尸的数量实在太多。\n");
                mzd();
                return 0;
            }
            if(vv==0) ch=_getch();
            zd-=5;
            if(zd<0) {
                Slowsay("尽管你尽力抵抗,可丧尸的数量实在太多。\n");
                mzd();
                return 0;
            }
            Slowsay("你杀光了这些丧尸,子弹-5\n");
            if(vv==0) ch=_getch();
            Slowsay("你在二楼找到了食物,食物+3\n");
            sw+=3;
            if(sn==1) {
                Slowsay("少年在一楼找到了子弹,子弹+3\n");
                zd=zd+3;
            }
        }
        if(x==3&&sn==1) {
            system("cls");
            Slowsay("你们来到了二楼\n");
            if(vv==0) ch=_getch();
            system("Color C");
            Slowsay("数之不尽的丧尸从阴影中窜出");
            Slowsay("尽管你们尽力抵抗,可丧尸的数量实在太多。");
            if(gun!=2&&qiang!=2) {
                Slowsay("没有武器的少年被当场咬死。");
                if(mp==-1&&mz==0) {
                    td5();
                    return 0;
                }
                sn=0;
            }
            Slowsay("其中一只丧尸趁你不注意冲到了你的旁边");
            if(gun==2) Slowsay("就在你要被咬死的时候,少年扔出了手中的水管\n,救下了你");
            else if(qiang!=2) {
                zd=zd-3;
                if(zd<0) {
                    mzd();
                    return 0;
                }
                Slowsay("你赶忙回头几枪补掉了这只丧尸,子弹-3");
            }
            zd=zd-3;
            if(qiang==2||zd<0) {
                system("Color F");
                mzd();
                return 0;
            }
            system("Color F");
            Slowsay("经过了一番苦战,你们终于战胜了所有丧尸,子弹-3");
            if(vv==0) ch=_getch();
        }
        break;
    }
    if(vv==0) ch=_getch();
    qp();
    if(vv==0) ch=_getch();
    printf("又过了一夜,食物-%d\n",sn+2);
    sw=sw-2-sn;
    if(sw<0) {
        esl();
        return 0;
    }
    qp();
    Slowsay("今天在出门的时候\n");
    Slowsay("你遇到了一条流浪狗\n");
    Slowsay("1.用枪打死它\n");
    Slowsay("2.用食物打发它\n");
    while(true) {
        x=read();
        if(x<1||x>2) {
            Slowsay("请重新输入\n");
            continue;
        }
        if(x==1) {
            zd=zd-1;
            if(zd<0) {
                bd7();
                return 0;
            }
            Slowsay("你一枪打死了这条狗,子弹-1\n");
            if(sn==0) break;
            Slowsay("在打死了狗之后,你忽然发现少年的脸色不太好\n");
            if(vv==0) ch=_getch();
            Slowsay("原来,在昨天的商场中,少年早就被咬了一口");
            Slowsay("他一直瞒着你,不敢说出来");
            Slowsay("此时,他闻到了血腥味,看到了尸体,已经忍不住,濒临变异了!!");
            Slowsay("你决定\n");
            Slowsay("1.杀了他\n");
            Slowsay("2.不杀他\n");
            int a3=0;
            if(gjj[4]==1&&zd<4) {
                Slowsay("3.安抚他\n");
                a3=1;
            }
            while(1) {
                x=read();
                if(x<1||x>3||(x==3&&a3==0)) {
                    Slowsay("请重新输入\n");
                    continue;
                }
                if(x==1) {
                    if(swx==2) {
                        if(mzhg<-1000) tgg3();
                        else Slowsay("\n“杀我还早的很呢......”\n\n少年咯咯笑着挡下了你所有的攻击\n\n“因为你还不是一个优秀的丧尸......”"),Sleep(1000),mzd();
                        return 0;
                    }
                    if(vv==0) ch=_getch();
                    if(mp==-1&&mz==0) {
                        Slowsay("奇怪的是,你直接秒掉了他。\n");
                        Sleep(1000);
                        sn=0;
                        td5();
                        return 0;
                    } else if(mp==-1&&mz!=0) {
                        Slowsay("突然,妹子出现了。\n");
                        Slowsay("“放着我来!”,妹子与少年搏斗起来,妹子的力气极大,竟然真的压制住了少年!\n");
                        Slowsay("在你的惊恐目光下,少年的皮肤渐渐变淡,重新变回了“人”!\n");
                        Slowsay("这时,你才注意到少年的声音一直带着点沙哑,如同低吼一般\n");
                        Slowsay("“我没事。”他说。\n");
                    } else {
                        system("Color C");
                        Slowsay("你试着向他开枪,子弹穿过了他的身体\n");
                        Slowsay("你十分惊恐,疯狂地倾泻着手中的弹药\n");
                        Slowsay("“没有用的。”少年咯咯笑着向你走进,\n");
                        Slowsay("而他的伤口却以肉眼可见的速度愈合!\n");
                        Slowsay("怎么可能!怎么可能,怎么可能......\n");
                        system("Color F");
                        mzd();
                        if(zjj[9]==0) {
                            Slowsay("获得线索-----无敌变异!·少年\n");
                            Sleep(1000);
                            zjj[9]=1;
                        }
                        return 0;
                    }
                }
                if(x==2) {
                    system("Color C");
                    Slowsay("你看着少年变异\n");
                    Slowsay("奇怪的是,他变异后并没有像其他的丧尸一样,向你扑过来\n");
                    Slowsay("而是躲在墙角瑟瑟发抖\n");
                    Slowsay("你慢慢的走过去\n");
                    Slowsay("就在你走近的时候,少年突然暴起\n");
                    Slowsay("狠狠地咬住了你的手臂\n");
                    Slowsay("你赶忙用枪打死他,可是为时已晚\n");
                    system("Color F");
                    sn=0;
                    if(sw>=6) {
                        td2();
                        return 0;
                    } else {
                        bd6();
                        return 0;
                    }
                }
                break;
            }
            if(x==3&&gjj[4]==1) {
                gjj[5]=1;
                hd5();
                return 0;
            }
        }
        if(x==2) {
            sw=sw-1;
            if(sw<0) {
                bd7();
                return 0;
            }
            Slowsay("你用一份食物引开了这条狗,食物-1\n");
        }
        break;
    }
    if(swx==2) {
        system("cls");
        if(sn==1) Slowsay("少年的变异的很突然,但身为丧尸的你没有受到攻击\n你们结伴一起狩猎着人类\n只是,与少年相处的越久,你就越发感受到他的强大。\n你只好收起杀心跟在他后面。\n应该是这样吗?"),Sleep(1000),Slowsay("\n\n“我错过了机会”\n");
        else Slowsay("少年死后,你无聊的屠杀着一切,\n在接下来的几天里,你轻松的杀掉了城中所有的生物\n之后,你只能天天游荡,无助的面对着这座死城\n应该是这样吗?\n"),Sleep(1000),Slowsay("\n“我走错了路。”");
        Sleep(1000);
        return 0;
    }
    if(vv==0) ch=_getch();
    if(sn==1&&sw>=4&&gun==2&&zd>5) {
        hd4();
        return 0;
    }
    if(sn==1) {
        Slowsay("又过了一天,食物-2\n");
        sw=sw-2;
        if(sw<0) {
            esl();
            return 0;
        }
        if(vv==0) ch=_getch();
        system("cls");
        Slowsay("今天早上,你发现少年不见了\n");
        Slowsay("你决定\n");
        Slowsay("1.去寻找他\n");
        Slowsay("2.不去找他\n");
        while(true) {
            x=read();
            if(x<1||x>2) {
                Slowsay("请重新输入\n");
                continue;
            }
            if(x==1) {
                system("cls");
                qp();
                Slowsay("你通过蛛丝马迹一路追踪,来到了一座大厦前\n");
                Slowsay("在路上,你遭遇了丧尸,子弹-2\n");
                zd=zd-2;
                if(zd<0) {
                    mzd();
                    return 0;
                }
                Slowsay("你决定\n");
                system("Color C");
                Slowsay("1.破门!冲入大厦\n");
                Slowsay("2.悄悄开门,潜入大厦\n");
                Slowsay("3.寻找其它的入口\n");
                while(true) {
                    x=read();
                    if(x<1||x>3) {
                        Slowsay("请重新输入\n");
                        continue;
                    }
                    if(x==1) {
                        int xx=rand()%4;
                        Slowsay("你进入大厦才发现这里几乎充满了丧尸!");
                        Slowsay("丧尸似乎被你惊醒,如同海啸般向你涌来!");
                        system("Color F");
                        if(zd>6) Slowsay("怎么回事!!你一路且战且退来到了地下室"),zd-=6,bd9();
                        else if(xx==0) Slowsay("幸运的是,你退后的脚碰到了地下室的暗门,Thanks God!"),bd9();
                        else Sleep(1000),mzd();
                        return 0;
                    }
                    if(x==2) {
                        int xx=rand()%6;
                        Slowsay("你进入大厦才发现这里几乎充满了丧尸!");
                        system("Color F");
                        Slowsay("怎么回事!!你害怕得定在原地,奇怪的是它们并没有向你扑来,只是疲惫的看着你。");
                        Slowsay("定睛一看,丧尸们个个躯体畸形,断手断脚者不乏其数");
                        Slowsay("再一看,这些丧尸们被奇怪的机器束缚,不得踏出大厦一步。");
                        Slowsay("你大着胆子靠近一个丧尸,发现它的头上有着模糊的字迹");
                        Slowsay("【21.7.29,失败】");
                        Sleep(1000);
                        Slowsay("瞬间,那个丧尸惊恐地捂住头上的字,发出奇怪的吼声!");
                        Slowsay("其它丧尸如同被激怒,海啸般向你涌来!");
                        if(zd>6) Slowsay("怎么回事!!你一路且战且退来到了地下室"),zd-=6,bd9();
                        else if(xx==0) Slowsay("幸运的是,你退后的脚碰到了地下室的暗门,Thanks God!"),bd9();
                        else Sleep(1000),mzd();
                        return 0;
                    }
                    if(x==3) {
                        system("Color F");
                        Slowsay("你走入刚刚的大街,你的老相识开心地吐着舌头看着你");
                        Slowsay("......后面跟着它的一堆朋友......");
                        Slowsay("......你被讨食的狗狗们追着跑过了两条大街,不停地扔出食物来减缓它们的攻势......");
                        if(sw>5) Slowsay("终于,它们全部满足的趴倒在了地上。\n领头狗如同可以听懂人话一样,将你带到了一个隐蔽的地道口前......"),sw-=5,bd9();
                        else bd7();
                        return 0;
                    }
                    break;
                }
            }
            break;
        }
    }
    qp();
    if(vv==0) ch=_getch();
    if(mz==1&&sn==1&&swx==0) {
        td6();
        return 0;
    }
    Slowsay("又过了一天,食物-2");
    sw=sw-2;
    if(sw<0) {
        esl();
        return 0;
    }
    Sleep(500);
    Slowsay("遭遇丧尸,子弹-3");
    zd=zd-3;
    if(zd<0) {
        mzd();
        return 0;
    }
    Sleep(500);
    Slowsay("又过了一天,食物-2");
    sw=sw-2;
    if(sw<0) {
        esl();
        return 0;
    }
    Sleep(500);
    Slowsay("遭遇丧尸,子弹-2");
    zd=zd-2;
    if(zd<0) {
        mzd();
        return 0;
    }
    Sleep(500);
    if(ccg==1) {
        tg();
        return 0;
    } else {
        bd10();
        return 0;
    }
}
int main() {
    srand(time(0));
    Read();
    int go=0;
    while(tongguan1!=2) {
        int v=0;
        char ch;
        mp=0;
        if(go==1) {
            Sleep(1000);
            if(vv==0) ch=_getch();
            system("cls");
            Save();
        }
        go=1;
        Slowsay("1.进行游戏\n");
        Slowsay("2.查看成就\n");
        Slowsay("3.查看线索(获得全部线索后通关游戏)\n");
        Slowsay("4.获得一条随机的提示\n");
        Slowsay("5.游戏相关\n");
        Slowsay("6.极速模式\n");
        Slowsay("7.退出游戏\n");
        x=read();
        if(x==1) {
            sswj();
            if(s>50&&swhm==0) {
                swhm=1;
                Slowsay("又死了啊......");
                Slowsay("这已经是第几次了呢......");
                Slowsay("一个柔和的声音从耳边传来");
                Slowsay("或许早该放弃了");
                Sleep(1000);
                Slowsay("获得线索-----计数者");
            }
        }
        if(x==2) {
            int v1=0;
            system("cls");
            if(tongguan1==2) Slowsay("\n已通关终极剧情\n");
            if(tongguan1==1) Slowsay("\n已通关进阶剧情(进阶不重要!终极才是王道!)\n");
            if(tongguan==1) Slowsay("\n已通关基础剧情\n");
            int v=0;
            Slowsay("\nHappy Bnd 达成\n");
            if(gjj[1]==1) Slowsay("苟到最后\n");
            else Slowsay("未达成\n");
            if(gjj[2]==1) Slowsay("神仙眷侣\n");
            else Slowsay("未达成\n");
            if(gjj[3]==1) Slowsay("英雄不朽\n");
            else Slowsay("未达成\n");
            if(gjj[4]==1) Slowsay("认清自己\n");
            else Slowsay("未达成\n");
            if(gjj[5]==1) Slowsay("跨越物种的gay\n");
            else Slowsay("未达成\n");
            Slowsay("\n");
            Slowsay("Bad End 达成(共15个)\n");
            for(int i=1; i<=17; i++)
                if(hjj[i]==1)
                    printf("%d ",i),v1++;
            if(v1>=15&&swx==1)
                swx=2,cdd=0,Swx();
            Slowsay("\n");
            printf("当前死亡次数:%d",s);
            Slowsay("\n");
            Slowsay("True End 达成\n");
            if(zjj[1]==1) Slowsay("拯救世界\n");
            else Slowsay("未达成\n");
            if(zjj[3]==1) Slowsay("认清?·妹子\n");
            else Slowsay("未达成\n");
            if(zjj[2]==1) Slowsay("认清!·本我\n");
            else Slowsay("未达成\n");
            if(zjj[4]==1) Slowsay("验证失败\n");
            else Slowsay("未达成\n");
            if(zjj[5]==1) Slowsay("死亡姗姗来迟\n");
            else Slowsay("未达成\n");
            Slowsay("\n");
            if(vv==0) char ch=_getch();
        }
        if(x==3) {
            system("cls");
            int v=0;
            Slowsay("基础线索\n");
            if(zjj[1]==1) Slowsay("    奇特的枪与饼干\n"),v++;
            else Slowsay("    ?????\n");
            if(zjj[2]==1) Slowsay("    延迟变异?·少年\n"),v++;
            else Slowsay("    ?????\n");
            if(zjj[9]==1) Slowsay("    无敌变异!·少年\n"),v++;
            else Slowsay("    ?????\n");
            if(zjj[3]==1) Slowsay("    不变异?  ·妹子\n"),v++;
            else Slowsay("    ?????\n");
            if(hjj[8]==1) Slowsay("    早已变异!·妹子\n"),v++;
            else Slowsay("    ?????\n");
            if(hjj[9]==1) Slowsay("    实验体·1号和2号\n"),v++;
            else Slowsay("    ?????\n");
            if(v>=6&&ccg==0) {
                Sleep(2000);
                cdd=0;
                cg();
                ccg=1;
            }
            Slowsay("进阶线索\n");
            if(swhm==1) Slowsay("    计数者\n"),v++;
            else Slowsay("    ?????\n");
            if(zbbj==1) Slowsay("    乱码,废弃与失联\n"),v++;
            else Slowsay("    ?????\n");
            if(by==1) Slowsay("    早已变异!·本我\n"),v++;
            else Slowsay("    ?????\n");
            if(hjj[15]==1) Slowsay("    伪造......\n"),v++;
            else Slowsay("    ?????\n");
            if(zjj[5]==1) Slowsay("    少年之死\n"),v++;
            else Slowsay("    ?????\n");
            if(hjj[14]==1) Slowsay("    外面的世界\n"),v++;
            else Slowsay("    ?????\n");
            if(v>=12&&qxs==0) {
                Sleep(2000);
                cg2();
                cdd=0;
                Sleep(1000);
                Slowsay("-------- 游戏进阶结局已解锁(快前往达成吧)--------");
                qxs=1;
            }
            if(vv==0) ch=_getch();
        }
        if(x==4) {
            system("cls");
            int y=rand()%3;
            if(y==0) {
                Slowsay("【稀有提示】");
                x=rand()%14;
                if(x==0) Slowsay("【稀有结局提示】 试试 0 10 开局!");
                else if(x==1) Slowsay("【稀有结局提示】 最好的爱总要先错过~");
                else if(x==2) Slowsay("【剧情提示】 二周目:少年变异后有新剧情!");
                else if(x==3) Slowsay("【剧情提示】 不变异的妹子总有一天会在营地暴露!再来一遍!");
                else if(x==4) Slowsay("【剧情提示】 弹尽粮绝之时,变异的少年会记起上辈子的爱情!再来一遍!");
                else if(x==5) Slowsay("【剧情提示】 第二天,和首领换更多子弹,他会更开心!");
                else if(x==6) Slowsay("【剧情提示】 在家里等待疯掉?再来一遍!");
                else if(x==7) Slowsay("【剧情提示】 二周目:再次进入实验室吧!");
                else if(x==8) Slowsay("【剧情提示】 二周目:神枪手妹子...");
                else if(x==9) Slowsay("【剧情提示】 二周目:不带子弹!等待救援!");
                else if(x==10) Slowsay("【通关方式】 二周目:在获得所有线索后前往“外面的世界”。");
                else if(x==11) Slowsay("【通关方式】 三周目:(都提示这么明显了)吃掉妹子,杀掉少年。");
                else if(x==12) Slowsay("【线索提示】 死亡很多次后......(有个地方可以刷死亡次数)");
                else Slowsay("【???】 666666,5201314(会错过一些线索与结局!)");
            } else {
                x=rand()%14;
                if(x==0) Slowsay("加了好感后,妹子有几率不死");
                else if(x==1) Slowsay("少年喜欢子弹");
                else if(x==2) Slowsay("乱走有时可以获得子弹");
                else if(x==3) Slowsay("冲进去活下来几率更大");
                else if(x==4) Slowsay("分头探商店可以获得更多资源");
                else if(x==5) Slowsay("有一些结局只能通关后触发");
                else if(x==6) Slowsay("有一些结局要脸好才能触发");
                else if(x==7) Slowsay("有一些结局要通其他结局后才能触发");
                else if(x==8) Slowsay("大多数时候,你认为一个地方没有好结局只是因为你食物/子弹不够");
                else if(x==9) Slowsay("绝大多数的线索来自结局");
                else if(x==10) Slowsay("三大重叠剧情线路:普通,进阶,尸王线");
                else if(x==11) Slowsay("本游戏是一个剧情严谨,人物丰满,细思极恐的好!游!戏!~");
                else if(x==12) Slowsay("事实证明剧情游戏是最难调的!有Bug一定要去博客说出来啊!(luogu.com.cn/blog/z1e2k3i4/)");
                else Slowsay("完成目标后,需要在线索,成就界面开启新剧情哦");
            }
            if(vv==0) char ch=_getch();
            continue;
        }
        if(x==5) {
            system("cls");
            Slowsay("作者:杨欣谚\n");
        }
        if(x==6) {
            system("cls");
            if(vv==0) vv=1,Slowsay("已开启极速模式");
            else vv=0,Slowsay("已关闭极速模式");
        }
        if(x==7) {
            system("cls");
            Slowsay("想退?死吧!!");
            s++;
        }
    }
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    Slowsay("Thanks for playing......");
    Sleep(1000);
    Slowsay("您已通关,我亲爱的 终极丧尸,成功者,杀人机器,你还没杀够吗?......");
    system("Color C");
}
  1. 双人格斗

#include<iomanip>
#include<iostream>
#include<conio.h>
#include<windows.h>
#include<cstdio>
#include<vector>
#include<cstring>
#include<string>

#define bottom 40
#define jumph 6
#define skills 6
#define skilled 2
#define Setcolor(NAME) if(NAME)SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY | BACKGROUND_GREEN | BACKGROUND_BLUE);else SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY | BACKGROUND_GREEN | BACKGROUND_BLUE)
#define Backcolor(NAME) if(NAME)SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY | BACKGROUND_GREEN | BACKGROUND_BLUE)
#define Choosecolor(NAME) if(NAME==2)SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED| FOREGROUND_GREEN|FOREGROUND_BLUE | FOREGROUND_INTENSITY|BACKGROUND_BLUE );else if(!NAME)SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_RED| BACKGROUND_INTENSITY| BACKGROUND_GREEN|BACKGROUND_RED|BACKGROUND_BLUE );else if(NAME==1)SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY| BACKGROUND_GREEN|BACKGROUND_RED)

using namespace std;

void HideCursor();
void go(int x, int y);
void movewindow();
void GetContain();
void start1();
void start2();
void _skillprint(int, int);
void skillprint(int,int);
void mapprint();
void Getmove();
void winprint(bool);
void BoomGet();
class bullet;
class player;

bool dj1, dj2, s11, s12, s21, s22;
int da1, da2,skill1[2] = { 4,3 }, skill2[2] = {2,4}, boom1, boom2, cost[10] = {0,3,3,5,15},place[11][2][2],explace[11][2];//[技能数字][属于][x,y坐标]
float cool[2][2];
char hit[2];
string name1, name2,contain[11],excontain[11];
vector<bullet>bu;
class player {
    public:
        int x, y, j, jh, life,loving,flying,gaying;
        char a, b[2];
        bool dir, fly, myself,fdir;
//dir:0为左,1为右
        void clear() {
            go(x, y);
            printf(" ");
            go(x, y + 1);
            printf(" ");
        }
        void print() {
            Setcolor(myself);
            if (gaying)SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE|FOREGROUND_RED | BACKGROUND_INTENSITY | BACKGROUND_GREEN | BACKGROUND_BLUE);
            go(x, y);
            if (loving) {
                Setcolor(!myself);
                cout << (char)3;
                Setcolor(myself);
            } else if (gaying)cout << "♂";
            else cout << a;
            go(x, y + 1);
            cout << b[dir];
            Backcolor(myself);
        }
        void lifedown(int l) {
            if (!myself) {
                go(life - l+1, 2);
                for (int i = 1; i <= l; ++i)
                    cout << " ";
            } else {
                go(188 - life, 2);
                for (int i = 1; i <= l; ++i)
                    cout << " ";
            }
            life -= l;
        }
        void jump() {
            ++j;
            if (j <= jh) {
                clear();
                --y;
                print();
            } else fly = 1;
        }
        void flown() {
            ++flying;
            clear();
            if (flying <= jumph-1)--y;
            else if (flying <= 2 * jumph-2)++y;
            else flying = 0;
            if (!fdir)x-=2;
            else x+=2;
            if (x < 1)x = 1;
            else if (x > 188)x = 188;
            print();
        }
        void skill(int,bool);
        void attack();
        void move(int);
} p1, p2;
class bullet {
    public:
        int x, y, boom,length,soap;
        bool own, dir, love;
        inline void clear() {
            go(x, y);
            cout << " ";
        }
        void print() {
            Setcolor(own);
            go(x, y);
            if (boom)cout << (char)15;
            else if (love)cout << (char)3;
            else if (soap) cout << "▅";
            else cout << hit[own];
            Backcolor(own);
        }
        void start(int p, int q, bool d, bool o) {
            y = q;
            dir = d;
            own = o;
            if (!d)x = p - 1;
            else x = p + 1;
            boom = 0;
            love = 0;
            length = 0;
            soap = 0;
        }
        void boomstart(int p, int q, bool d, bool o,int l) {
            y = q + 1;
            dir = d;
            own = o;
            if (!d)x = p - 1;
            else x = p + 1;
            boom = 1;
            length = l;
            love = 0;
        }
        bool fly() {
            if (boom >= 800) {
                if (boom == 805) {
                    for (int i = -4; i <= 4; i += 2)
                        for (int j = -2; j <= 2; ++j) {
                            if (x + i < 1 || x + i>188 || y + j > bottom + 1)continue;
                            go(x + i, y + j);
                            cout << " ";
                        }
                    p1.print();
                    p2.print();
                    return 1;

                }++boom;
                return 0;
            }
            if(soap!=-1)clear();
            if (!dir)--x;
            else ++x;
            if (boom) {
                if (!dir)x-=length;
                else x+=length;
            }
            if (boom) {
                ++boom;
                char _sign = 4;
                if (x < 1 || x>188) {
                    Setcolor(own);
                    for (int i = -4; i <= 4; i += 2)
                        for (int j = -2; j <= 2; ++j) {
                            if (x + i < 1 || x + i>188 || y + j > bottom + 1)continue;
                            go(x + i, y + j);
                            cout <<_sign ;
                        }
                    Backcolor(own);
                    if (!own) {
                        if (x >= p2.x - 4 && x <= p2.x + 4 && y+2 >= p2.y&&y-2 <= p2.y + 1) {
                            p2.lifedown(10);
                            if (x > p2.x)p2.fdir = 0;
                            else p2.fdir = 1;
                            p2.flown();
                        }
                    } else {
                        if (x >= p1.x - 4 && x <= p1.x + 4 && y + 2 >= p1.y&&y - 2 <= p1.y + 1) {
                            p1.lifedown(10);
                            if (x >= p1.x)p1.fdir = 0;
                            else p1.fdir = 1;
                            p1.flown();
                        }
                    }
                    boom = 800;
                    return 0;
                }
                if (boom <= 2 * jumph+length)--y;
                else if (boom > 2 * jumph + 2+length) {
                    if (y <= bottom)++y;
                    else {
                        Setcolor(own);
                        for (int i = -4; i <= 4; i += 2)
                            for (int j = -2; j <= 2; ++j) {
                                if (x + i < 1 || x + i>188 || y + j > bottom + 1)continue;
                                go(x + i, y + j);
                                cout << _sign;
                            }
                        Backcolor(own);
                        if (!own) {
                            if (x >= p2.x - 4 && x <= p2.x + 4 && y +2>= p2.y&&y-2 <= p2.y + 1) {
                                p2.lifedown(10);
                                if (x > p2.x)p2.fdir = 0;
                                else p2.fdir = 1;
                                p2.flown();
                            }
                        } else {
                            if (x >= p1.x - 4 && x <= p1.x + 4 && y + 2 >= p1.y&&y - 2 <= p1.y + 1) {
                                p1.lifedown(10);
                                if (x >= p1.x)p1.fdir = 0;
                                else p1.fdir = 1;
                                p1.flown();
                            }
                        }
                        boom = 800;
                        return 0;
                    }
                }
                print();
                if (!own) {
                    if (x == p2.x&&y >= p2.y&&y <= p2.y + 1) {
                        for (int i = -4; i <= 4; i += 2)
                            for (int j = -2; j <= 2; ++j) {
                                if (x + i < 1 || x + i>188 || y + j > bottom + 1)continue;
                                go(x + i, y + j);
                                cout << _sign;
                            }
                        p2.lifedown(10);
                        p2.fdir = 1;
                        p2.flown();
                        boom = 800;
                    }
                } else {
                    if (x == p1.x&&y >= p1.y&&y <= p1.y + 1) {
                        Setcolor(own);
                        for (int i = -4; i <= 4; i += 2)
                            for (int j = -2; j <= 2; ++j) {
                                if (x + i < 1 || x + i>188 || y + j > bottom + 1)continue;
                                go(x + i, y + j);
                                cout << _sign;
                            }
                        Backcolor(own);
                        p1.lifedown(10);
                        p1.fdir = 0;
                        p1.flown();
                        boom = 800;
                    }
                }
                return 0;
            }
            if (soap) {
                if (soap!=-1&&soap <= 2) {
                    ++soap;
                    --y;
                } else if (soap != -1 && y <= bottom+1) {
                    ++y;
                    if (y == bottom + 1)
                        soap = -1;
                } else {
                    if (!dir)++x;
                    else --x;
                }
                if (x < 1)x = 1;
                if (x > 188)x = 188;
                if (soap != -1) {
                    int s = bu.size();
                    for (register int i = 0; i < s; ++i) {
                        if (bu[i].soap&&bu[i].length!=length) {
                            if (x+1>=bu[i].x&&x<=bu[i].x+1&&y ==bu[i].y-1 ) {
                                soap = -1;
                                break;
                            }
                        }
                    }
                }
                if (!own) {
                    if (x+1 >= p2.x&&x<=p2.x&&y >= p2.y&&y <= p2.y + 1) {
                        p2.lifedown(8);
                        p2.gaying += 100;
                        p2.print();
                        return 1;
                    }
                } else {
                    if (x +1>= p1.x&&x<=p1.x&&y >= p1.y&&y <= p1.y + 1) {
                        p1.lifedown(8);
                        p1.gaying += 100;
                        p1.print();
                        return 1;
                    }
                }
                print();
                return 0;
            }
            if (x < 1 || x>188) {
                if (!love) {
                    if (!own) {
                        if ((skill1[0] == -2 || skill1[1] == -2) && !length) {
                            if (!dir)
                                ++x;
                            else --x;
                            dir = !dir;
                            ++length;
                            return 0;
                        }
                    } else {
                        if ((skill2[0] == -2 || skill2[1] == -2) && !length) {
                            if (!dir)++x;
                            else --x;
                            dir = !dir;
                            ++length;
                            return 0;
                        }
                    }
                }
                return 1;
            }
            if (!own) {
                if (x == p1.x&&y >= p1.y&&y <= p1.y + 1)p1.print();
                if (x == p2.x&&y >= p2.y&&y <= p2.y + 1) {
                    if (love) {
                        p2.lifedown(3);
                        p2.loving = 75;
                        p2.print();
                    } else p2.lifedown(1);
                    return 1;
                }
            } else {
                if (x == p2.x&&y >= p2.y&&y <= p2.y + 1)p2.print();
                if (x == p1.x&&y >= p1.y&&y <= p1.y + 1) {
                    if (love) {
                        p1.lifedown(3);
                        p1.loving = 75;
                        p1.print();
                    } else p1.lifedown(2);
                    return 1;
                }
            }
            print();
            return 0;

        }
} temp;
void player::attack() {
    temp.start(x, y, dir, myself);
    bu.push_back(temp);
}
void player::move(int k) {
    clear();
    if (gaying)k = 3 - k;
    if (k == 1) {
        --x;
        dir = 0;
    } else if (k == 2) {
        ++x;
        dir = 1;
    }
    int strb = bu.size();
    for (register int i = 0; i < strb; ++i) {
        if (bu[i].boom == 0 && bu[i].own != myself && bu[i].x == x && bu[i].y >= y && bu[i].y <= y + 1) {
            bu.erase(bu.begin() + i);
            if (bu[i].soap) {
                gaying += 100;
                lifedown(5);
            } else if (bu[i].love) {
                lifedown(2);
                loving =75;
            } else lifedown(1);
            --i;
            --strb;
        }
    }
    print();
}
void player::skill(int l,bool which) {
    if (l <= 0)return;
    if (cool[myself][which] > 0)return;
    cool[myself][which] += cost[l];
    skillprint(myself, which);
    /*!闪现!*/
    if (l == 1) {
        int sign = 0;
        bool sign2 = 0;
        if (!dir) {
            for (register int i = 1; x > 1 && i <= 12; ++i) {
                x -= 2;
                if (x < 1) {
                    x = 1;
                    sign2 = 1;
                }
                print();
                ++sign;
            }
            for (register int i = 2 - sign2; i <= 2 - sign2 + 2 * sign; i += 2) {
                go(x + i, y);
                cout << " ";
                go(x + i, y + 1);
                cout << " ";
                Sleep(1);
            }
        } else {
            for (register int i = 1; x < 188 && i <= 12; ++i) {
                x += 2;
                if (x > 188) {
                    x = 188;
                    sign2 = 1;
                }
                print();
                ++sign;
            }
            for (register int i = 2 - sign2; i <= 2 - sign2 + 2 * sign; i += 2) {
                go(x - i, y);
                cout << " ";
                go(x - i, y + 1);
                cout << " ";
                Sleep(1);
            }
        }
    } else if (l == 2) {
        if(!myself)temp.boomstart(x, y, dir, myself,boom1/6);
        else temp.boomstart(x, y, dir, myself, boom2 /6);
        bu.push_back(temp);
    } else if (l == 3) {
        temp.start(x, y, dir, myself);
        temp.love = 1;
        bu.push_back(temp);
    } else if (l == 4) {
        temp.start(x, y, dir, myself);
        temp.soap = 1;
        temp.length = rand();
        bu.push_back(temp);
    }
}

void go(int x, int y) {
    COORD p;
    p.X = x - 1;
    p.Y = y - 1;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), p);
}
void movewindow() {
    RECT rect;
    HWND hwnd = GetForegroundWindow();
    GetWindowRect(hwnd, &rect);
    MoveWindow(hwnd, 0, 0, 0, 0, TRUE);
}
void HideCursor() {
    CONSOLE_CURSOR_INFO cursor_info = { 1, 0 };
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
void start1() {
    go(20, 20);
    printf("玩家一的名字:");
    getline(cin, name1);
    go(20, 23);
    printf("玩家二的名字:");
    getline(cin, name2);
    Sleep(500);
    system("cls");
}
inline void GetContain() {
    contain[1] = "| 闪现 |";
    contain[2] = "| 手雷 |";
    contain[3] = "| 魅惑 |";
    contain[4] = "| 捡肥皂 |";
    contain[5] = "| 三段跳 |";
    contain[6] = "| 弹射 |";
    excontain[1] = "向前瞬移一段距离 冷却 3 s";
    excontain[2] = "长摁后扔出一枚手雷,造成伤害并炸飞对手。蓄力时间越长,飞行距离越远 冷却 3 s";
    excontain[3] = "发出一颗爱心,造成伤害并使对手无法控制地走向自己 冷却 5 s";
    excontain[4] = "扔出一个肥皂,对手捡到时造成伤害并干扰对手的移动 冷却 15 s";
    excontain[5] = "(被动)可以连续跳跃三次";
    excontain[6] = "(被动)普通攻击第一次碰到墙壁时会反弹回来";
    place[1][0][0] = 25;
    place[1][0][1] = 10;
    place[1][1][0] = place[1][0][0]+85;
    place[1][1][1] = 10;
    for (int k = 0; k <= 1; ++k) {
        for (int i = 2; i <= skills; ++i) {
            place[i][k][0] = place[i - 1][k][0];
            place[i][k][1] = place[i - 1][k][1] + 3;
        }
    }
    for (int k = 0; k <= 1; ++k)
        for (int i = 1; i <= skills; ++i)
            explace[i][k] = place[1][k][0]+18 - excontain[i].size()/2;
}
void start2() {
    GetContain();
    const int exy = place[skills][0][1]+5;
    int wh[2] = {1,1};
    int ch[2][11] = { {0,1,0,0,0,0,0,0,0,0,0},{0,1,0,0,0,0,0,0,0,0,0,}};
    int count[2] = { 0,0 };
    char sign = 16;
    go(82, 2);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_BLUE|BACKGROUND_GREEN|BACKGROUND_INTENSITY);
    cout << "选择你的技能";
    go(54, 45);
    cout << "游戏规则:玩家一 A、D键移动,W键跳跃,J键攻击,K、L键释放技能";
    go(64, 46);
    cout << "玩家二 方向键跳跃和移动,小键盘 1 键攻击,2、3 键释放技能";
    Setcolor(0);
    go(44 - name1.size()/2, 5);
    cout<<name1;
    go(44, 7);
    printf("%c", p1.a);
    go(44, 8);
    printf("%c", p1.b[0]);
    Setcolor(1);
    go(130-name2.size()/2,5);
    cout<< name2;
    go(130, 7);
    printf("%c", p2.a);
    go(130, 8);
    printf("%c", p2.b[0]);
    for(int i=0; i<=1; ++i)
        for (int j = 1; j <= skills; ++j) {
            go(place[j][i][0], place[j][i][1]);
            Setcolor(i);
            cout << " ";
            Choosecolor(ch[i][j]);
            cout << contain[j];
        }
    Choosecolor(1);
    for (int i = 0; i <= 1; ++i) {
        go(place[1][i][0], place[1][i][1]);
        Setcolor(i);
        cout<<sign;
        go(explace[1][i], exy);
        cout << excontain[1];
    }
    bool able[2][3] = { {0,0,0},{0,0,0} };//[0左 1右][0上 1下 2选]
    go(30, 40);
    Setcolor(0);
    cout << "玩家一:W、S键移动,J键选择";
    go(112, 40);
    Setcolor(1);
    cout << "玩家二:方向键、移动,小键盘1键选择";
    while (count[0]<2||count[1]<2) {
        bool f = 0;
        if (GetKeyState('W') >= 0)able[0][0]=1;
        if (GetKeyState('S') >= 0)able[0][1] = 1;
        if (GetKeyState('J') >= 0)able[0][2] = 1;
        if (GetKeyState(VK_UP) >= 0)able[1][0] = 1;
        if (GetKeyState(VK_DOWN) >= 0)able[1][1] = 1;
        if (GetKeyState(VK_NUMPAD1) >= 0)able[1][2] = 1;
        Sleep(5);
        if (GetKeyState('W') < 0&&able[f][0]) {
            if(ch[f][wh[f]]!=2)--ch[f][wh[f]];
            able[f][0] = 0;
            go(place[wh[f]][f][0], place[wh[f]][f][1]);
            Setcolor(f);
            cout << " ";
            Choosecolor(ch[f][wh[f]]);
            cout << contain[wh[f]];
            Setcolor(f);
            go(explace[wh[f]][f], exy);
            for (unsigned int i = 0; i < excontain[wh[f]].size()/2+1; ++i)
                cout << " ";
            --wh[f];
            if (wh[f] < 1)wh[f] = skills;
            go(explace[wh[f]][f], exy);
            cout << excontain[wh[f]];
            if(ch[f][wh[f]]!=2)++ch[f][wh[f]];
            go(place[wh[f]][f][0], place[wh[f]][f][1]);
            cout << sign;
            Choosecolor(ch[f][wh[f]]);
            cout << contain[wh[f]];
        }
        if(GetKeyState('S')<0&&able[f][1]) {
            if(ch[f][wh[f]]!=2)--ch[f][wh[f]];
            able[f][1] = 0;
            go(place[wh[f]][f][0], place[wh[f]][f][1]);
            Setcolor(f);
            cout << " ";
            Choosecolor(ch[f][wh[f]]);
            cout<< contain[wh[f]];
            Setcolor(f);
            go(explace[wh[f]][f], exy);
            for (unsigned int i = 0; i < excontain[wh[f]].size()/2+1; ++i)
                cout << " ";
            ++wh[f];
            if (wh[f] > skills)wh[f] = 1;
            go(explace[wh[f]][f], exy);
            cout << excontain[wh[f]];
            if (ch[f][wh[f]] != 2)++ch[f][wh[f]];
            go(place[wh[f]][f][0], place[wh[f]][f][1]);
            cout << sign;
            Choosecolor(ch[f][wh[f]]);
            cout << contain[wh[f]];
        }
        if (GetKeyState('J') < 0 && able[f][2]) {
            able[f][2] = 0;
            if (ch[f][wh[f]] != 2 && count[f] < 2) {
                ++ch[f][wh[f]];
                ++count[f];
            } else if(ch[f][wh[f]]==2) {
                --ch[f][wh[f]];
                --count[f];
            }
            go(place[wh[f]][f][0], place[wh[f]][f][1]);
            Setcolor(f);
            cout << sign;
            Choosecolor(ch[f][wh[f]]);
            cout << contain[wh[f]];
        }
        f = 1;
        if (GetKeyState(VK_UP) < 0 && able[f][0]) {
            if (ch[f][wh[f]] != 2)--ch[f][wh[f]];
            able[f][0] = 0;
            go(place[wh[f]][f][0], place[wh[f]][f][1]);
            Setcolor(f);
            cout << " ";
            Choosecolor(ch[f][wh[f]]);
            cout << contain[wh[f]];
            Setcolor(f);
            go(explace[wh[f]][f], exy);
            for (unsigned int i = 0; i < excontain[wh[f]].size()/2+1; ++i)
                cout << " ";
            --wh[f];
            if (wh[f] < 1)wh[f] = skills;
            go(explace[wh[f]][f], exy);
            cout << excontain[wh[f]];
            if (ch[f][wh[f]] != 2)++ch[f][wh[f]];
            go(place[wh[f]][f][0], place[wh[f]][f][1]);
            cout << sign;
            Choosecolor(ch[f][wh[f]]);
            cout << contain[wh[f]];
        }
        if (GetKeyState(VK_DOWN) < 0 && able[f][1]) {
            if (ch[f][wh[f]] != 2)--ch[f][wh[f]];
            able[f][1] = 0;
            go(place[wh[f]][f][0], place[wh[f]][f][1]);
            Setcolor(f);
            cout << " ";
            Choosecolor(ch[f][wh[f]]);
            cout << contain[wh[f]];
            Setcolor(f);
            go(explace[wh[f]][f], exy);
            for (unsigned int i = 0; i < excontain[wh[f]].size()/2+1; ++i)
                cout << " ";
            ++wh[f];
            if (wh[f] > skills)wh[f] = 1;
            go(explace[wh[f]][f], exy);
            cout << excontain[wh[f]];
            if (ch[f][wh[f]] != 2)++ch[f][wh[f]];
            go(place[wh[f]][f][0], place[wh[f]][f][1]);
            cout << sign;
            Choosecolor(ch[f][wh[f]]);
            cout << contain[wh[f]];
        }
        if (GetKeyState(VK_NUMPAD1)<0 && able[f][2]) {
            able[f][2] = 0;
            if (ch[f][wh[f]] != 2 && count[f] < 2) {
                ++ch[f][wh[f]];
                ++count[f];
            } else if (ch[f][wh[f]] == 2) {
                --ch[f][wh[f]];
                --count[f];
            }
            go(place[wh[f]][f][0], place[wh[f]][f][1]);
            Setcolor(f);
            cout << sign;
            Choosecolor(ch[f][wh[f]]);
            cout << contain[wh[f]];
        }
    }
    Backcolor(1);
    int _s=0;
    for (int i = 1; i <= skills; ++i) {
        if (ch[0][i] == 2) {
            if (i > skills - skilled)skill1[_s] = skills - i - 2;
            else skill1[_s] = i;
            ++_s;
        }
    }
    _s = 0;
    for (int i = 1; i <= skills; ++i) {
        if (ch[1][i] == 2) {
            if (i > skills - skilled)skill2[_s] = skills - i - 2;
            else skill2[_s] = i;
            ++_s;
        }
    }
    Sleep(1000);
}
void Getmove() {
    BoomGet();
    if (GetKeyState('W') >= 0)dj1 = 0;
    if (GetKeyState(VK_UP) >= 0)dj2 = 0;
    if (GetKeyState('K') >= 0)s11 = 0;
    if (GetKeyState('L') >= 0)s12 = 0;
    if (GetKeyState(VK_NUMPAD2) >= 0)s21 = 0;
    if (GetKeyState(VK_NUMPAD3) >= 0)s22 = 0;
    if (skill1[0] == 2)s11 = 1;
    if (skill1[1] == 2)s12 = 1;
    if (skill2[0] == 2)s21 = 1;
    if (skill2[1] == 2)s22 = 1;
    if ((!p1.flying)&&(!p1.loving)) {
        if (dj1 == 0 && GetKeyState('W') < 0 && (p1.jh <= jumph || ((skill1[0] == -1 || skill1[1] == -1) && p1.jh <= 2 * jumph))) {
            dj1 = 1;
            if ((skill1[0] == -1 || skill1[1] == -1) && p1.jh >= 2 * jumph && !p1.fly)p1.jh = 3 * jumph;
            else if (p1.jh >= jumph && !p1.fly)p1.jh = 2 * jumph;
            else p1.jh = p1.j + jumph;
            p1.fly = 0;
            p1.jump();
        }
        if (GetKeyState('A') < 0 && p1.x > 1) {
            p1.move(1);
        }
        if (GetKeyState('D') < 0 && p1.x < 188) {
            p1.move(2);
        }
        if (!p1.gaying) {
            if (GetKeyState('J') < 0 && da1 == 0) {
                da1 = 6;
                p1.attack();
            }
            if (GetKeyState('K') < 0 && s11 == 0) {
                s11 = 1;
                p1.skill(skill1[0], 0);
            }
            if (GetKeyState('L') < 0 && s12 == 0) {
                s12 = 1;
                p1.skill(skill1[1], 1);
            }
        }
    }
    if ((!p2.flying)&&(!p2.loving)) {
        if (!p2.gaying) {
            if (GetKeyState(VK_NUMPAD1) < 0 && da2 == 0) {
                da2 = 6;
                p2.attack();
            }
            if (GetKeyState(VK_NUMPAD2) < 0 && s21 == 0) {
                s21 = 1;
                p2.skill(skill2[0], 0);
            }
            if (GetKeyState(VK_NUMPAD3) < 0 && s22 == 0) {
                s22 = 1;
                p2.skill(skill2[1], 1);
            }
        }
        if (dj2 == 0 && GetKeyState(VK_UP) < 0 && (p2.jh <= jumph || ((skill2[0] == -1 || skill2[1] == -1) && p2.jh <= 2 * jumph))) {
            dj2 = 1;
            if ((skill2[0] == -1 || skill2[1] == -1) && p2.jh >= 2 * jumph && !p2.fly)p2.jh = 3 * jumph;
            else if (p2.jh >= jumph && !p2.fly)p2.jh = 2 * jumph;
            else p2.jh = p2.j + jumph;
            p2.fly = 0;
            p2.jump();
        }
        if (GetKeyState(VK_LEFT) < 0 && p2.x > 1) {
            p2.move(1);
        }
        if (GetKeyState(VK_RIGHT) < 0 && p2.x < 188) {
            p2.move(2);
        }
    }
}
void BoomGet() {
    if ((!p1.flying)&&(!p1.loving)&&(!p1.gaying)) {
        if (skill1[0] == 2 && cool[0][0] <= 0) {
            if (GetKeyState('K') < 0)++boom1;
            if (boom1 > 30 || (GetKeyState('K') >= 0 && boom1)) {
                p1.skill(2, 0);
                boom1 = 0;
            }
        }
        if (skill1[1] == 2 && cool[0][1] <= 0) {
            if (GetKeyState('L') < 0)++boom1;
            if (boom1 > 30 || (GetKeyState('L') >= 0 && boom1)) {
                p1.skill(2, 1);
                boom1 = 0;
            }
        }
    }
    if (p2.flying||p2.loving||p2.gaying)return;
    if (skill2[0] == 2&&cool[1][0]<=0) {
        if (GetKeyState(VK_NUMPAD2) < 0)++boom2;
        if (boom2 > 30 || (GetKeyState(VK_NUMPAD2) >= 0 && boom2)) {
            p2.skill(2,0);
            boom2 = 0;
        }
    }
    if (skill2[1] == 2&&cool[1][1]<=0) {
        if (GetKeyState(VK_NUMPAD3) < 0)++boom2;
        if (boom2 > 30 || (GetKeyState(VK_NUMPAD3) >= 0 && boom2)) {
            p2.skill(2,1);
            boom2 = 0;
        }
    }
}
void mapprint() {
    for (int i = 1; i <= 188; ++i)
        cout << " ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_BLUE | BACKGROUND_INTENSITY);
    for (int i = 1; i <= 80; ++i)
        cout << " ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY | BACKGROUND_GREEN | BACKGROUND_BLUE);
    cout << " player1 ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_INTENSITY);
    cout << "┃";
    Setcolor(1);
    cout << " player2 ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_RED | BACKGROUND_INTENSITY);
    for (int i = 1; i <= 80; ++i)
        cout << " ";
    go(1, 42);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_INTENSITY);
    for (int i = 1; i <= 188; ++i)
        cout << (char)22;
    Backcolor(1);
    go(20-name1.size()/2, 44);
    cout << name1;
    go(8, 46);
    cout << "技能一: ";
    _skillprint(0, 0);
    go(8, 48);
    cout << "技能二: ";
    _skillprint(0, 1);
    Setcolor(1);
    go(160-name2.size()/2, 44);
    cout << name2;
    go(145, 46);
    cout << "技能一: ";
    _skillprint(1, 0);
    go(145, 48);
    cout << "技能二: ";
    _skillprint(1, 1);
    Backcolor(1);
}
void _skillprint(int a,int b) {
    if (!a) {
        if (!b) {
            if (skill1[0] == 1)cout << "闪现 0.0 s";
            else if (skill1[0] == 2)cout << "手雷 0.0 s";
            else if (skill1[0] == 3)cout << "魅惑 0.0 s";
            else if (skill1[0] == 4)cout << "捡肥皂 0.0 s";
            else if (skill1[0] == -1)cout << "三段跳 -";
            else if (skill1[0] == -2)cout << "弹射 -";

        } else {
            if (skill1[1] == 1)cout << "闪现 0.0 s";
            else if (skill1[1] == 2)cout << "手雷 0.0 s";
            else if (skill1[1] == 3)cout << "魅惑 0.0 s";
            else if (skill1[1] == 4)cout << "捡肥皂 0.0 s";
            else if (skill1[1] == -1)cout << "三段跳 -";
            else if (skill1[1] == -2)cout << "弹射 -";
        }
    } else {
        if (!b) {
            if (skill2[0] == 1)cout << "闪现 0.0 s";
            else if (skill2[0] == 2)cout << "手雷 0.0 s";
            else if (skill2[0] == 3)cout << "魅惑 0.0 s";
            else if (skill2[0] == 4)cout << "捡肥皂 0.0 s";
            else if (skill2[0] == -1)cout << "三段跳 -";
            else if (skill2[0] == -2)cout << "弹射 -";
        } else {
            if (skill2[1] == 1)cout << "闪现 0.0 s";
            else if (skill2[1] == 2)cout << "手雷 0.0 s";
            else if (skill2[1] == 3)cout << "魅惑 0.0 s";
            else if (skill2[1] == 4)cout << "捡肥皂 0.0 s";
            else if (skill2[1] == -1)cout << "三段跳 -";
            else if (skill2[1] == -2)cout << "弹射 -";
        }
    }
}
void skillprint(int a, int b) {
    if (!a) {
        if (!b)go(27, 46);
        else go(27, 48);
    } else {
        if (!b)go(164, 46);
        else go(164, 48);
    }
    Setcolor(a);
    printf("%.1f", cool[a][b]);
    if (cool[a][b] < 9.9)cout << " ";
    Backcolor(a);
}
void winprint(bool f) {
    Sleep(1000);
    system("cls");
    string winner;
    if (!f)winner = name1;
    else winner = name2;
    go(91 - winner.size() / 2, 20);
    Setcolor(f);
    cout << winner << " Win !";
    Sleep(3000);
}
int main() {
    system("color B9");
    movewindow();
    system("mode con lines=60 cols=188");
    start1();
    HideCursor();
gamestart:
    system("cls");
    p1.a = 1;
    p2.a = 2;
    p1.b[0] = 17;
    p1.b[1] = 16;
    p2.b[0] = 17;
    p2.b[1] = 16;
    hit[0] = 14;
    hit[1] = 36;
    p1.x = 10;
    p1.y = bottom-28;
    p2.x = 160;
    p2.y = bottom-28;
    p1.j = 0;
    p2.j = 0;
    p1.life = 80;
    p2.life = 80;
    p1.fly = 1;
    p2.fly = 1;
    p1.flying = 0;
    p2.flying = 0;
    p1.gaying = 0;
    p2.gaying = 0;
    p1.myself = 0;
    p2.myself = 1;
    p1.dir = 1;
    start2();
    system("cls");
    mapprint();
    p1.print();
    p2.print();
    bool flag = 0;
    float count=0;
    int num = 0;
    Sleep(500);
    bool flying = 0;
    while (p1.life > -1 && p2.life > -1) {
        ++count;
        ++num;
        if (num >= 1000)num = 0;
        if (da1)--da1;
        if (da2)--da2;
        if (p1.loving) {
            --p1.loving;
            if (num% 5 == 0) {
                if (p1.x > p2.x)p1.move(1);
                else p1.move(2);
            }
            if (!p1.loving)p1.print();
        }
        if (p2.loving) {
            --p2.loving;
            if (num % 5 == 0) {
                if (p2.x > p1.x)p2.move(1);
                else p2.move(2);
            }
            if (!p2.loving)p2.print();
        }
        if (p1.gaying)--p1.gaying;
        if (p2.gaying)--p2.gaying;
        if (p1.fly&& p1.y < bottom) {
            p1.clear();
            ++p1.y;
            p1.print();
        }
        if (p2.fly&& p2.y < bottom) {
            p2.clear();
            ++p2.y;
            p2.print();
        }
        if (p1.y == bottom) {
            p1.jh = 0;
            p1.fly = 0;
            p1.j = 0;
            flying = 1;
        }
        if (p2.y == bottom) {
            p2.jh = 0;
            p2.fly = 0;
            p2.j = 0;
        }
        if (p1.j) {
            if (!p1.fly)p1.jump();
            else --p1.j;
        }
        if (p2.j) {
            if (!p2.fly)p2.jump();
            else --p2.j;
        }
        if (p1.flying)p1.flown();
        if (p2.flying)p2.flown();
        if(flying)Getmove();
        if (count >= 2.5) {
            count -= 2.5;
            for (register int i = 0; i <= 1; ++i)
                for (register int j = 0; j <= 1; ++j) {
                    if (cool[i][j] > 0) {
                        cool[i][j] -= 0.1;
                        if (cool[i][j] < 0)cool[i][j] = 0;
                        skillprint(i, j);
                    }
                }
        }
        if (!flag&&p1.x == p2.x)flag = 1;
        if (flag && (p1.x != p2.x || p1.y != p2.y)) {
            flag = 0;
            p1.print();
            p2.print();
        }
        int strb = bu.size();
        for (int i = 0; i < strb; ++i) {
            if (bu[i].soap) {
                if (bu[i].fly()) {
                    bu.erase(bu.begin() + i);
                    --i;
                    --strb;
                    break;
                }
            } else if (bu[i].boom || bu[i].love) {
                if (bu[i].fly() || bu[i].fly()) {
                    bu.erase(bu.begin() + i);
                    --i;
                    --strb;
                    break;
                }
            } else if (bu[i].fly() || bu[i].fly()||bu[i].fly()) {
                bu.erase(bu.begin() + i);
                --i;
                --strb;
                break;
            }
        }
        Sleep(40 - strb / 5);
    }
    winprint(p1.life < p2.life);
    goto gamestart;
}
  1. 海战

#include <cstdio>
#include <ctime> //rand()%(x) 0~x-1 int
#include <windows.h> //停顿:Sleep();
#include <cstdlib> //清屏:system("cls");
#include <conio.h> //getch(); char
#include <iostream>
#include <cstring> //未知 :□; 打中 :◎; 未打中:○ 船:★;
using namespace std;
int rest[3][5],r1,r2; //rest[1]:玩家的海域; rest[2]:电脑的海域 r1:玩家还剩船数; r2:电脑还剩船数
int b1[12][12],b2[12][12]; //0:空海; 1:船只; 2:打中; 3:边界 4:未打中 5:沉船
int c1[12][12],c2[12][12]; //c1:玩家海域的颜色 c2:电脑海域颜色
int fx[8][2]= {{0,1},{1,0},{0,-1},{-1,0},{1,1},{-1,-1},{1,-1},{-1,1}};
int now[2][2]; //now[左/右][x/y] 光标
string a1[12][12],a2[12][12];
int fd [500][2],head=0,tail=0;
const long long wdmm=0;
long long cjzt=0,wdm;


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 gotoxy1(int x,int y) { //位置函数(左边棋盘)(行为x 列为y)
    COORD pos;
    pos.X=2*(y+5);
    pos.Y=x+1;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void gotoxy2(int x,int y) { //位置函数(右边棋盘)(行为x 列为y)
    COORD pos;
    pos.X=2*(y+18);
    pos.Y=x+1;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}

void check2(int x,int y) {
    int k=0,kx,ky,f=1;
    for (int i=0; i<=3; i++) {
        if (b2[x+fx[i][0]][y+fx[i][1]]==2) k=i;
        if (b2[x+fx[i][0]][y+fx[i][1]]==1) f=0;
    }
    for (kx=x,ky=y; b2[kx][ky]==2; kx+=fx[k][0],ky+=fx[k][1]);
    if (b2[kx][ky]==1) f=0;
    if (f) {
        int w=0;
        color(12);
        for (kx=x,ky=y; b2[kx][ky]==2; kx+=fx[k][0],ky+=fx[k][1]) {
            gotoxy2(kx,ky);
            a2[kx][ky]="※";
            c2[kx][ky]=12;
            cout <<"※";
            w++;
        }
        for (kx=x+fx[(k+2)%4][0],ky=y+fx[(k+2)%4][1]; b2[kx][ky]==2; kx+=fx[(k+2)%4][0],ky+=fx[(k+2)%4][1]) {
            gotoxy2(kx,ky);
            a2[kx][ky]="※";
            c2[kx][ky]=12;
            cout <<"※";
            w++;
        }

        if (w>0) {
            rest[2][w]--;
            r2--;
            if (rest[2][w]>0) color(14);
            else color(11);
            gotoxy2(5-w,16);
            printf("*%d",rest[2][w]);
        }
    }
}

int move1() {
    if (r1*r2==0) return(1);

    color(5);
    gotoxy1(14,4);
    printf("电脑开炮");
    color(13);
    gotoxy2(14,4);
    printf("玩家开炮");

    int kx=now[1][0],ky=now[1][1],lastx,lasty,f=1;
    char ch;
    gotoxy2(kx,ky);
    color(11);
    if (a2[kx][ky]!=" ")cout <<a2[kx][ky];
    else cout <<"▂";
    gotoxy2(kx,ky);
    while (f) {
        ch=getch();
        if (ch=='1' || ch=='a') {
            kx=now[1][0]+fx[2][0];
            ky=now[1][1]+fx[2][1];
        }
        if (ch=='2' || ch=='s') {
            kx=now[1][0]+fx[1][0];
            ky=now[1][1]+fx[1][1];
        }
        if (ch=='3' || ch=='d') {
            kx=now[1][0]+fx[0][0];
            ky=now[1][1]+fx[0][1];
        }
        if (ch=='5' || ch=='w') {
            kx=now[1][0]+fx[3][0];
            ky=now[1][1]+fx[3][1];
        }
        if (kx>0 && kx<=10 && ky>0 && ky<=10) {
            gotoxy2(now[1][0],now[1][1]);
            color(c2[now[1][0]][now[1][1]]);
            cout <<a2[now[1][0]][now[1][1]];
            gotoxy2(kx,ky);
            color(11);
            if (a2[kx][ky]!=" ")cout <<a2[kx][ky];
            else cout <<"▂";
            gotoxy2(kx,ky);
            now[1][0]=kx;
            now[1][1]=ky;
        }

        if ((ch=='0' || ch==' ')&& b2[kx][ky]<=1) {
            if (b2[kx][ky]==1) {
                b2[kx][ky]=2;
                a2[kx][ky]="◎";
                c2[kx][ky]=4;
            }
            if (b2[kx][ky]==0) {
                b2[kx][ky]=4;
                a2[kx][ky]=" ";
            }
            gotoxy2(kx,ky);
            color(c2[kx][ky]);
            cout <<a2[kx][ky];
            f=0;
            check2(kx,ky);
            color (7);
            gotoxy2(12,4);
            cout <<"(";
            color(6);
            cout <<ky;
            color(7);
            cout <<",";
            color(2);
            cout <<kx;
            color(7);
            cout<<") ";
            if (b2[kx][ky]==2) move1();
        }

        if (ch=='8' || ch=='g') {
            if(cjzt=1023577928566) {
                for (int i=1; i<=10; i++) for (int j=1; j<=10; j++)
                        if (b2[i][j]==1) {
                            gotoxy2(i,j);
                            color(10);
                            printf("Ω");
                        }
            }
            char ccc=getch();
            for (; ccc!='8' && ccc!='g'; ccc=getch());
            for (int i=1; i<=10; i++)for (int j=1; j<=10; j++) {
                    gotoxy2(i,j);
                    color(c2[i][j]);
                    cout <<a2[i][j];
                }
            gotoxy2(kx,ky);
            color(11);
            if (a2[kx][ky]!=" ")cout <<a2[kx][ky];
            else cout <<"▂";
            gotoxy2(kx,ky);
        }

        if (ch=='4' || ch=='q') return(0);
    }
    return(1);
}



int ok(int x,int y) {
    int nnn=0;
    if (b1[x][y]==2 || b1[x][y]==4 || b1[x][y]==5) return(0);
    for (int i=0; i<=7; i++) {
        if (b1[x+fx[i][0]][y+fx[i][1]]==2) nnn++;
        if (b1[x+fx[i][0]][y+fx[i][1]]==5) return(0);
    }
    if (nnn>1) return(0);
    return(1);
}

void check1(int x,int y) {
    int k=0,kx,ky,f=1;
    for (int i=0; i<=3; i++) {
        if (b1[x+fx[i][0]][y+fx[i][1]]==2) k=i;
        if (b1[x+fx[i][0]][y+fx[i][1]]==1) f=0;
    }
    for (kx=x,ky=y; b1[kx][ky]==2; kx+=fx[k][0],ky+=fx[k][1]);
    if (b1[kx][ky]==1) f=0;

    if (f) {
        int w=0;
        color(12);
        for (kx=x,ky=y; b1[kx][ky]==2; kx+=fx[k][0],ky+=fx[k][1]) {
            gotoxy1(kx,ky);
            b1[kx][ky]=5;
            a1[kx][ky]="※";
            c1[kx][ky]=12;
            cout <<"※";
            w++;
        }
        for (kx=x+fx[(k+2)%4][0],ky=y+fx[(k+2)%4][1]; b1[kx][ky]==2; kx+=fx[(k+2)%4][0],ky+=fx[(k+2)%4][1]) {
            gotoxy1(kx,ky);
            b1[kx][ky]=5;
            a1[kx][ky]="※";
            c1[kx][ky]=12;
            cout <<"※";
            w++;
        }

        if (w>0) {
            rest[1][w]--;
            r1--;
            if (rest[1][w]>0) color(14);
            else color(11);
            gotoxy1(5-w,-5);
            printf("%d*",rest[1][w]);
        }
    }
}

void move2() {
    if (r1*r2==0) return;

    color(13);
    gotoxy1(14,4);
    printf("电脑开炮");
    color(5);
    gotoxy2(14,4);
    printf("玩家开炮");

    Sleep(750);
    int kx=0,ky=0,over=0;

    while (tail>head) {
        head++;
        kx=fd[head][0];
        ky=fd[head][1];
        if (ok(kx,ky)) {
            over=1;
            break;
        }
    }
    while (!over) {
        kx=rand()%(10)+1;
        ky=rand()%(10)+1;
        if (ok(kx,ky)) over=1;
    }

    if (b1[kx][ky]==1) {
        b1[kx][ky]=2;
        a1[kx][ky]="◎";
        c1[kx][ky]=4;
    }
    if (b1[kx][ky]==0) {
        b1[kx][ky]=4;
        a1[kx][ky]=" ";
    }

    gotoxy1(kx,ky);
    color(11);
    printf("⊕");
    Sleep(600);
    gotoxy1(kx,ky);
    color(c1[kx][ky]);
    cout <<a1[kx][ky];
    color (7);
    gotoxy1(12,4);
    cout <<"(";
    color(6);
    cout <<ky;
    color(7);
    cout <<",";
    color(2);
    cout <<kx;
    color(7);
    cout<<") ";

    check1(kx,ky);

    if ((b1[kx][ky]==2 || b1[kx][ky]==5)&& r1*r2>0) {
        int i=rand()%(4);
        for (int ii=0; ii<=3; ii++) {
            int px=kx+fx[i][0],py=ky+fx[i][1];
            if (px>0 && px<=10 && py>0 && py<=10) {
                tail++;
                fd[tail][0]=px;
                fd[tail][1]=py;
            }
            i=(i+1)%4;
        }
        move2();
    }
}

void put() {
    int k=4;
    while (k--) {
        for (int i=1; i<=4-k; i++) {
            int f1=0,f2=0;
            int dir1,dir2;
            dir1=rand()%(2);
            dir2=rand()%(2);
            while (!f1) {
                f1=1;
                int lx=rand()%(10)+1;
                int ly=rand()%(10)+1;
                for(int nx=lx-1; nx<=lx+fx[dir1][0]*k+1; nx++)
                    for (int ny=ly-1; ny<=ly+fx[dir1][1]*k+1; ny++)
                        if(b1[nx][ny]==1) {
                            f1=0;
                            break;
                        }

                for (int nx=lx; nx<=lx+fx[dir1][0]*k; nx++)
                    for (int ny=ly; ny<=ly+fx[dir1][1]*k; ny++)
                        if (b1[nx][ny]==3) {
                            f1=0;
                            break;
                        }

                if (f1) {
                    for (int jx=lx,jy=ly; jx<=lx+fx[dir1][0]*k && jy<=ly+fx[dir1][1]*k; jx+=fx[dir1][0],jy+=fx[dir1][1]) {
                        b1[jx][jy]=1;
                        c1[jx][jy]=15;
                        color(15);
                        gotoxy1(jx,jy);
                        printf("□");
                    }
                }
            }
            while (!f2) {
                f2=1;
                int lx=rand()%(10)+1;
                int ly=rand()%(10)+1;
                for(int nx=lx-1; nx<=lx+fx[dir2][0]*k+1; nx++)
                    for (int ny=ly-1; ny<=ly+fx[dir2][1]*k+1; ny++)
                        if(b2[nx][ny]==1) {
                            f2=0;
                            break;
                        }

                for (int nx=lx; nx<=lx+fx[dir2][0]*k; nx++)
                    for (int ny=ly; ny<=ly+fx[dir2][1]*k; ny++)
                        if (b2[nx][ny]==3) {
                            f2=0;
                            break;
                        }

                if (f2) {
                    for (int jx=lx,jy=ly; jx<=lx+fx[dir2][0]*k && jy<=ly+fx[dir2][1]*k; jx+=fx[dir2][0],jy+=fx[dir2][1])
                        b2[jx][jy]=1;
                }
            }
            int a=1;
        }
    }
}

void reset() {
    system("cls");
    color(15);
    gotoxy(18,10);
    printf("按 0 重排战船; 按任意键开始与电脑对战");

    color(9);
    gotoxy(0,9 );
    printf("玩家海域");
    gotoxy(0,22);
    printf("电脑海域");

    for (int i=1; i<=4; i++) rest[1][i]=rest[2][i]=5-i;
    for (int i=1; i<=10; i++) {
        b1[0][i]=b1[i][0]=b2[0][i]=b2[i][0]=3;
        b1[11][i]=b1[i][11]=b2[11][i]=b2[i][11]=3;
    }
    color(8);
    for (int i=1; i<=10; i++)for (int j=1; j<=10; j++) c1[i][j]=c2[i][j]=8;
    for (int i=1; i<=10; i++)for (int j=1; j<=10; j++) {
            b1[i][j]=b2[i][j]=0;
            a1[i][j]="□";
            gotoxy1(i,j);
            cout <<a1[i][j];
            a2[i][j]="□";
            gotoxy2(i,j);
            cout <<a2[i][j];
        }
    color(14);
    gotoxy1(1,-5);
    printf("%d*□□□□",rest[1][4]);
    gotoxy1(2,-5);
    printf("%d*□□□ ",rest[1][3]);
    gotoxy1(3,-5);
    printf("%d*□□ ",rest[1][2]);
    gotoxy1(4,-5);
    printf("%d*□ ",rest[1][1]);
    gotoxy2(4,12);
    printf(" □*%d",rest[2][1]);
    gotoxy2(3,12);
    printf(" □□*%d",rest[2][2]);
    gotoxy2(2,12);
    printf(" □□□*%d",rest[2][3]);
    gotoxy2(1,12);
    printf("□□□□*%d",rest[2][4]);

    color(2);
    for (int i=1; i<=10; i++) {
        gotoxy1(i,11);
        cout <<i;
        gotoxy2(i,11);
        cout <<i;
    }
    color(6);
    for (int i=1; i<=10; i++) {
        gotoxy1(11,i);
        cout <<i;
        gotoxy2(11,i);
        cout <<i;
    }
    color(7);
    gotoxy1(12,4);
    printf("( , )");
    gotoxy2(12,4);
    printf("( , )");

    put();

    now[0][0]=now[0][1]=now[1][0]=now[1][1]=1;
    r1=r2=10;

    char res=getch();
    if (res=='0') reset();
}

int main() {

    int gameover=1;
    cout<<"请输入密码,暂无密码请按“0”"<<endl;
    cin>>wdm;
    if(wdm==wdmm) {
        cjzt=1023577928566;
        cout<<"请稍后 .";
        Sleep(100);
        system("cls");
        cout<<"请稍后 ..";
        Sleep(100);
        system("cls");
        cout<<"请稍后 ...";
        Sleep(100);
        system("cls");
        cout<<"请稍后 ... .";
        Sleep(100);
        system("cls");
        cout<<"请稍后 ... ..";
        Sleep(100);
        system("cls");
        cout<<"请稍后 ... ...";
        Sleep(100);
        cout<<"请稍后 .";
        Sleep(100);
        system("cls");
        cout<<"请稍后 ..";
        Sleep(100);
        system("cls");
        cout<<"请稍后 ...";
        Sleep(100);
        system("cls");
        cout<<"请稍后 ... .";
        Sleep(100);
        system("cls");
        cout<<"请稍后 ... ..";
        Sleep(100);
        system("cls");
        cout<<"请稍后 ... ...";
        system("cls");
    } else {
        cout<<"请获取密码后重试";
        return 0;
    }

    while (gameover) {
        srand(time(NULL));
        reset();
        gotoxy(18,10);
        printf(" ");
        int haha=0;
        while (r1*r2) {
            if (!move1()) {
                haha=1;    //玩家(haha==1说明中途退出)
                break;
            }
            move2(); //电脑
        }
        gotoxy(18,0);
        if (haha) printf("怎么中途退出了...\n\n");
        else if (r1==0) printf("很遗憾,你输了...\n\n");
        else if (r2==0) printf("恭喜你,你赢了!!!\n\n");
        printf("按1退出; 按其它键继续\n>>");
        if (getch()=='1') gameover=0;
    }
}
  1. 井字棋(鼠标点击版)

#include<cstdio>
#include<windows.h>
#include<ctime>
int a[4][4],i,j,xc,yc,mouse=0,ok=0,record[2][9],foot=9,winner,first=0,who=0;
void Place(const int x, const int y) {
    COORD PlaceCursorHere;
    PlaceCursorHere.X = y;
    PlaceCursorHere.Y = x;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), PlaceCursorHere);
    return;
}
void color(int x) {
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x);
}
int search(int x0,int y0,int x,int y) {
    mouse=GetAsyncKeyState(VK_LBUTTON);
    POINT pt;
    HWND h=GetForegroundWindow();
    GetCursorPos(&pt);
    ScreenToClient(h,&pt);
    if(pt.x>=x0&&pt.y>=y0&&pt.x<=x&&pt.y<=y) {
        if(mouse!=0) {
            Sleep(100);
            return 2;
        } else return 1;
    } else return 0;
}
bool check(int x) {
    int b=0,c=0,d=0,e=0;
    for(i=1; i<=3; i++) {
        for(j=1; j<=3; j++) {
            b+=a[i][j];
            c+=a[j][i];
        }
        d+=a[i][i];
        e+=a[i][4-i];
        if(b==x||c==x||d==x||e==x) return true;
        b=0;
        c=0;
    }
    return false;
}
void pcmove() {
    int x=10,b=0,c=0,d=0,e=0;
    xc=0;
    yc=0;
    while(x>0) {
        for(i=1; i<=3; i++) {
            b=0;
            c=0;
            for(j=1; j<=3; j++) {
                b+=a[i][j];
                c+=a[j][i];
            }
            d+=a[i][i];
            e+=a[i][4-i];
            if(b==x) {
                for(j=1; j<=3; j++) if(a[i][j]==0) {
                        xc=i;
                        yc=j;
                        return;
                    }
            }
            if(c==x) {
                for(j=1; j<=3; j++) if(a[j][i]==0) {
                        xc=j;
                        yc=i;
                        return;
                    }
            }
            if(d==x) {
                for(j=1; j<=3; j++) if(a[j][j]==0) {
                        xc=yc=j;
                        return;
                    }
            }
            if(e==x) {
                for(j=1; j<=3; j++) if(a[j][4-j]==0) {
                        xc=j;
                        yc=4-j;
                        return;
                    }
            }
        }
        x-=8;
    }
    if(a[2][2]==0) {
        xc=yc=2;
        return;
    }
    x=2;
    while(x>0) {
        for(i=1; i<=3; i+=x) for(j=1; j<=3; j+=x) if(a[i][j]==0) {
                    xc=i;
                    yc=j;
                    return;
                }
        x--;
    }
}
void show() {
    int x=foot;
    for(i=1; i<=3; i++) for(j=1; j<=3; j++) if(a[i][j]!=0) {
                if(a[i][j]==1) color(15);
                else color(11);
                Place(2*i-1,4*j-2);
                printf("●");
            }
    color(15);
    Place(7,0);
    if(who==0) {
        if(foot%2==1) printf("1号");
        else printf("2号");
    } else printf("电脑");
    if(who==0||first==1) x--;
    printf("下子:(%d,%d)",record[0][8-x],record[1][8-x]);
}
void button(int x) {
    if(x<3) {
        Place(x*3,15);
        printf("┌┄┄┐");
        Place(x*3+1,17);
        if(x==0) {
            if(ok==0) printf("开始");
            else printf("悔棋");
        }
        if(x==1) printf("重来");
        if(x==2) printf("退出");
        Place(x*3+2,15);
        printf("└┄┄┘");
    }
    if(x>2&&x<6) {
        Place(10,(x-4)*7);
        printf("┌┄┐");
        Place(11,(x-4)*7+2);
        if(x==4) printf("是");
        else printf("否");
        Place(12,(x-4)*7);
        printf("└┄┘");
    }
    if(x>5&&x<8) {
        Place(10,(x-6)*12);
        printf("┌┄┄┄┄┐");
        Place(11,(x-6)*12+2);
        if(x==6) printf("人机对战");
        else printf("人人对战");
        Place(12,(x-6)*12);
        printf("└┄┄┄┄┘");
    }
    if(x>7) {
        Place(10,(x-8)*12);
        printf("┌┄┄┄┄┐");
        Place(11,(x-8)*12+2);
        if(x==8) printf(" 我先手 ");
        else printf("电脑先手");
        Place(12,(x-8)*12);
        printf("└┄┄┄┄┘");
    }
}
void menu(int x) {
    int k,l;
    if(x==0) {
        if(ok==0) {
            ok=1;
            return;
        } else if(9-foot>1) {
            foot+=2;
            for(i=9-foot; i<=11-foot; i++) {
                a[record[0][i]][record[1][i]]=0;
                record[0][i]=record[1][i]=0;
            }
            for(i=1; i<=3; i++) for(j=1; j<=3; j++) {
                    Place(2*i-1,4*j-2);
                    printf(" ");
                }
            show();
        }
    }
    if(x>0&&x<3) {
        for(l=10; l<=12; l++) for(j=1; j<=22; j++) {
                Place(l,j);
                printf(" ");
            }
        Place(9,1);
        printf("你想");
        if(x==1) printf("重来吗?");
        if(x==2) printf("退出吗?");
        button(4);
        button(5);
        while(1) {
            mouse=GetAsyncKeyState(VK_LBUTTON);
            for(i=0; i<=1; i++) {
                k=search(7+i*55,165,40+i*55,200);
                if(k!=2) {
                    if(k==1) color(15);
                    else color(7);
                    button(i+4);
                } else {
                    for(l=9; l<=12; l++) for(j=1; j<=12; j++) {
                            Place(l,j);
                            printf(" ");
                        }
                    if(i==0) {
                        if(x==1) ok=2;
                        else exit(0);
                    }
                    return;
                }
            }
            Sleep(50);
        }
    }
    if(x>2&&x<5) {
        if(x==3) {
            who=1;
            return;
        } else {
            who=0;
            return;
        }
    }
    if(x>4) {
        if(x==5) {
            first=0;
            return;
        } else {
            first=1;
            return;
        }
    }
}
void click() {
    for(i=0; i<=2; i++) {
        mouse=GetAsyncKeyState(VK_LBUTTON);
        int k=search(125,i*50+5,175,i*50+40);
        if(k!=2) {
            if(k==1) color(15);
            else color(7);
            button(i);
            color(7);
        } else {
            menu(i);
            return;
        }
    }
    Sleep(50);
}
void humove() {
    while(1) {
        for(i=1; i<=3; i++) for(j=1; j<=3; j++) if(search(7+(i-1)*32,7+(j-1)*32,7+i*32,7+j*32)==2&&a[j][i]==0) {
                    if(who==0&&foot%2!=1) a[j][i]=5;
                    else a[j][i]=1;
                    record[0][9-foot]=j;
                    record[1][9-foot]=i;
                    return;
                }
        click();
        if(ok==2) return;
    }
}
void replace() {
    int k,l,p,q;
    Place(7,0);
    for(i=1; i<=15; i++) printf(" ");
    for(i=1; i<=3; i++) for(j=1; j<=3; j++) {
            Place(2*i-1,4*j-2);
            printf(" ");
            a[i][j]=0;
        }
    for(i=0; i<2; i++) for(j=0; j<9; j++) record[i][j]=0;
    foot=9;
    winner=0;
    first=0;
    who=0;
    ok=1;
    button(6);
    button(7);
    while(1) {
        for(i=0; i<=1; i++) {
            mouse=GetAsyncKeyState(VK_LBUTTON);
            k=search(i*80+7,165,i*80+103,200);
            q=search(125,105,175,140);
            if(k!=2) {
                if(k==1) color(15);
                else color(7);
                button(i+6);
                color(7);
            } else {
                menu(i+3);
                for(l=10; l<=12; l++) for(j=1; j<=22; j++) {
                        Place(l,j);
                        printf(" ");
                    }
                if(who==1) {
                    button(7);
                    button(8);
                    while(1) {
                        for(j=0; j<=1; j++) {
                            mouse=GetAsyncKeyState(VK_LBUTTON);
                            k=search(j*80+7,165,j*80+103,200);
                            q=search(125,105,175,140);
                            if(k!=2) {
                                if(k==1) color(15);
                                else color(7);
                                button(j+8);
                                color(7);
                            } else {
                                menu(j+5);
                                for(l=10; l<=12; l++) for(p=1; p<=22; p++) {
                                        Place(l,p);
                                        printf(" ");
                                    }
                                return;
                            }
                            if(q!=2) {
                                if(q==1) color(15);
                                else color(7);
                                button(2);
                                color(7);
                            } else menu(2);
                        }
                        Sleep(50);
                    }
                }
                return;
            }
            if(q!=2) {
                if(q==1) color(15);
                else color(7);
                button(2);
                color(7);
            } else menu(2);
        }
        Sleep(50);
    }
}
int main() {
    printf("┌─┬─┬─┐\n\n├─┼─┼─┤\n\n├─┼─┼─┤\n\n└─┴─┴─┘\n\n");
    for(i=0; i<3; i++) button(i);
    while(ok==0) click();
    while(1) {
        replace();
        while(foot>0&&ok!=0) {
            if(first!=1) {
                humove();
                show();
                if(check(3)) {
                    winner=1;
                    ok=0;
                    break;
                }
                foot--;
                if(foot<=0||ok==0||ok==2) break;
            }
            if(who==0&&check(15)) {
                winner=2;
                ok=0;
                break;
            }
            if(who!=0) {
                pcmove();
                record[0][9-foot]=xc;
                record[1][9-foot]=yc;
                a[xc][yc]=5;
                show();
                if(check(15)) {
                    winner=2;
                    ok=0;
                }
                foot--;
                first=0;
            }
        }
        if(ok==2) {
            ok=1;
            continue;
        }
        Place(7,0);
        for(i=1; i<=15; i++) printf(" ");
        Place(7,4);
        color(15);
        if(winner==0) printf("平局!");
        if(who!=0) {
            if(winner==1) printf("你赢了!");
            if(winner==2) printf("你输了!");
            Sleep(50);
        } else {
            if(winner==1) printf("1号赢了!");
            if(winner==2) printf("2号赢了!");
            Sleep(50);
        }
        ok=0;
        while(ok==0) click();
    }
}
  1. 胎神之路

#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
using namespace std;
int m[10001][21]={
{-1,0,0,0,0,18,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,1,1,1,1,1,1,1,1,1},
{-1,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{-1,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{-1,19,0,0,0,0,0,1,1,1,0,0,12,0,0,0,0,0,0,0,0},
{-1,13,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0},
{-1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,4,0,0,0,0},
{-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{-1,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1},
{-1,0,0,0,2,2,0,0,3,3,0,0,6,6,0,0,0,0,0,0,0},
{-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0},
{-1,15,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0},
{-1,0,0,0,0,0,0,0,0,0,0,0,0,16,17,0,0,0,0,0,0},
{-1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1},
{-1,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{-1,0,0,0,1,1,0,0,2,2,0,0,0,1,1,1,0,0,0,0,0},
};
int X,Y,dx,dy,tX,zX,zY,Sstar,Sboom,Win;
int Ee,Fen,RR,Slep,K,S,Er,Ice,Fang,Can;
int Ta,Zha,Bai,Yin,Su,U,TT,Ty,sy;
void Color(int a)
{
    a+=Bai*20;
    if(a==0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    if(a==1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
    if(a==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
    if(a==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    if(a==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_GREEN|BACKGROUND_BLUE|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    if(a%20==9) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_RED|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    if(a==10) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);
    else if(a>20) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
}
void SetPos(int x,int y)
{
    COORD pos;
    pos.X=y*2-1,pos.Y=26-x;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void Star();
void Wo(int x)
{
    SetPos(X-K,Y),cout<<"  "; //清除上一次残影
    if(Can!=0) {SetPos(X-K,Y),Color(10),cout<<"●";int R=rand()%5;if(R==0&&Y<20) Y++;if(R==1&&Y>1) Y--;}//兴奋
    if((m[X][Y]==1||m[X][Y]==7)&&Ta==0) X++; //跳上白块
    if(X<=0) X=dx,Y=dy;  //复活
    if(X-K>23) tX=0,X=K+23;  //高度上限
    if(tX!=0&&Ta==0) tX--,X+=2;  //上跳
    if(Ta!=0) {tX=0;if(m[X-1][Y]==0||m[X-1][Y]==4||m[X-1][Y]==5||(m[X-1][Y]>=9&&m[X-1][Y]<=18)) m[X-1][Y]=7;} //云鞋走路
    if(m[X][Y]==6) X--;  //隐形块
    if(m[X+1][Y]==6){tX=0;m[X+1][Y]=7;if(m[X+1][Y-1]==6) m[X+1][Y-1]=7;if(m[X+1][Y+1]==6) m[X+1][Y+1]=7;Fen+=2;} //隐形块
    if(m[X-1][Y]==6){tX=0;m[X-1][Y]=7;if(m[X-1][Y-1]==6) m[X-1][Y-1]=7;if(m[X-1][Y+1]==6) m[X+1][Y+1]=7;Fen+=2;} //隐形块
    if(m[X][Y+1]==6){tX=0;m[X][Y+1]=m[X][Y+2]=7;Fen+=2;} if(m[X][Y-1]==6){tX=0;m[X][Y-1]=m[X][Y-2]=7;Fen+=2;} //隐形块
    if(m[X-1][Y]==0||m[X-1][Y]==4||m[X-1][Y]==5||(m[X-1][Y]>=9&&m[X-1][Y]<=20)) {X--;} //掉落
    if(m[X][Y]==4) Fen+=5,m[X][Y]=5,dx=X,dy=Y; //复活点
    if(m[X][Y]==16) m[X][Y]=0,Sstar++,Star(),SetPos(X-K,Y),cout<<"  ";if(m[X+1][Y]==16) m[X+1][Y]=0,Sstar++,Star(),SetPos(X-K+1,Y),cout<<"  "; //星星
    if(m[X-1][Y]==1||m[X-1][Y]==2||m[X-1][Y]==3||m[X-1][Y]==7) tX=Er=0; //跳跃次数清零
    if(m[X-1][Y]==2||m[X][Y]==2||Ta!=0) tX+=5; //弹跳块
    if(m[X-1][Y]==10) m[X-1][Y]=3,Sboom++;if(m[X][Y]==10) m[X][Y]=3,X++,Sboom++; //隐形炸弹块
    if(m[X-1][Y]==3||m[X][Y]==3) //炸弹块
    {
        if(Zha==0)
        {
            Zha++;
            SetPos(X+1-K,Y-1),Color(5),cout<<"■";SetPos(X+1-K,Y+1),Color(5),cout<<"■";SetPos(X+1-K,Y),Color(5),cout<<"■";SetPos(X-1-K,Y-1),Color(5),cout<<"■";
            SetPos(X-1-K,Y+1),Color(5),cout<<"■";SetPos(X-1-K,Y),Color(5),cout<<"■";SetPos(X-K,Y-1),Color(5),cout<<"■";SetPos(X-K,Y+1),Color(5),cout<<"■";
            SetPos(X-K,Y),Color(5),cout<<"■";Sleep(300);SetPos(X+1-K,Y-1),Color(5),cout<<"  ";
            SetPos(X+1-K,Y+1),Color(5),cout<<"  ";SetPos(X+1-K,Y),Color(5),cout<<"  ";SetPos(X-1-K,Y-1),Color(5),cout<<"  ";SetPos(X-1-K,Y+1),Color(5),cout<<"  ";
            SetPos(X-1-K,Y),Color(5),cout<<"  ";SetPos(X-K,Y-1),Color(5),cout<<"  ";SetPos(X-K,Y+1),Color(5),cout<<"  ";SetPos(X-K,Y),Color(5),cout<<"  "; //动画
        }if(m[X][Y]==3) X++;
        if(Fang==0) X=dx,Y=dy,Fen-=5; //复活
    }else Zha=0;
    if(x==3) {int U=rand()%10;SetPos(X-K,Y);if(U==0) Color(6),cout<<"●";} //隐身
    else if(Fang!=0) SetPos(X-K,Y),Color(2),cout<<"●"; //爆衣
    else if(Can!=0) SetPos(X-K,Y),Color(4),cout<<"●"; //兴奋
    else if(x==2) SetPos(X-K,Y),Color(5),cout<<"●"; //云鞋
    else if(x==1) SetPos(X-K,Y),Color(1),cout<<"●"; //普通
}
void Cout(int i,int j,int a)
{
    if(m[i][j]==1) SetPos(i-K,j),Color(0),cout<<"■";
    if(m[i][j]==2) SetPos(i-K,j),Color(5),cout<<"■";
    if(m[i][j]==3) SetPos(i-K,j),Color(4),cout<<"■";
    if(m[i][j]==4) SetPos(i-K,j),Color(3),cout<<"▋";
    if(m[i][j]==5&&(i!=X||j!=Y)) SetPos(i-K,j),Color(2),cout<<"▋";
    if(m[i][j]==6&&a==1) SetPos(i-K,j),Color(7),cout<<"■",m[i][j]=7,Fen++;
    if(m[i][j]==7&&a==4) SetPos(i-K,j),cout<<"  ",m[i][j]=0;
    if(m[i][j]==7&&a!=4) SetPos(i-K,j),Color(7),cout<<"■";
//  if(m[i][j]==8) SetPos(i-K,j),cout<<"  ";
    if(m[i][j]==9) SetPos(i-K,j),Color(0),cout<<"←→左右移动";
    if(m[i][j]==11&&Ee==0) SetPos(i-K,j),Color(0),cout<<"弹跳块  炸弹块  隐形块";
    if(m[i][j]==11&&Ee==1) SetPos(i-K,j),Color(0),cout<<"弹跳块 ",Color(4),cout<<"隐形炸弹块",Color(0),cout<<" 隐形块";
    if(m[i][j]==12&&Ee==0) SetPos(i-K,j),Color(0),cout<<"    激活复活点";
    if(m[i][j]==12&&Ee==1) SetPos(i-K,j),Color(0),cout<<"出复活点",Color(3),cout<<"几率已增加";
    if(m[i][j]==13) SetPos(i-K,j),Color(0),cout<<"按↑跳跃,可二段跳";
    if(m[i][j]==14) SetPos(i-K,j),Color(0),cout<<"从现在开始随机出图啦";
    if(m[i][j]==15&&Ee==0) SetPos(i-K,j),Color(5),cout<<"1000分通关!",Color(0),cout<<"空格暂停";
    if(m[i][j]==15&&Ee==1) SetPos(i-K,j),Color(5),cout<<"探到40个通关!",Color(0),cout<<"空格暂停";
    if(m[i][j]==15&&Ee==2) SetPos(i-K,j),Color(5),cout<<"捉到20个通关!",Color(0),cout<<"空格暂停";
    if(m[i][j]==16) SetPos(i-K,j),Color(5),cout<<"★";
    if(m[i][j]==17&&Ee==0) SetPos(i-K,j),Color(0),cout<<"里有神秘物品!";
    if(m[i][j]==17&&Ee==1) SetPos(i-K,j),Color(0),cout<<"里有",Color(2),cout<<"防爆护罩!",Color(0);
    if(m[i][j]==17&&Ee==2) SetPos(i-K,j),Color(2),cout<<"它会动啦!",Color(0);
    if(m[i][j]==18) SetPos(i-K,j),Color(0),cout<<"不要让你的角色掉到视线以下!";
    if(m[i][j]==19) SetPos(i-K,j),Color(0),cout<<"按↓下降";
    if(m[i][j]==20&&Ee==2) SetPos(i-K,j),Color(3),cout<<"出现几率已增加",Color(0);
    //这里若加字的话,需在前面改 (m[X-1][Y]>=9&&m[X-1][Y]<=20) 一下
    Color(0);
}
void Map(int x1,int x2,int a)
{
    SetPos(25,2);if(Bai!=0||Yin!=0||Can!=0) Color(9);else Color(1);
    if(Ee==0) cout<<"分数:"<<Fen<<"                     ",Color(0);if(Ee==1) cout<<"已探测:"<<Sboom<<"                     ",Color(0);if(Ee==2) cout<<"已收集:"<<Sstar<<"                     ",Color(0);
    SetPos(24,2);if(Ice!=0) Color(8);else Color(1);cout<<"速度:"<<Slep<<"                     ",Color(0);
    bool Yan=0;
    for(register int i=x1;i>=x2;i--)
    for(register int j=1;j<=20;j++) Cout(i,j,a);
    if(Yin!=0) Wo(3);
    else if(Ta!=0) Wo(2);
    else if(a==0) Wo(1);
    else if(a==2) SetPos(X-K,Y),Color(1),cout<<"▲";
}
void MoveStar(int x1,int x2)
{
    int n[30][21];memset(n,0,sizeof(n));
    for(register int i=x1;i>=x2;i--)
    for(register int j=1;j<=20;j++)
    {
        if(m[i][j]==16&&n[i-K][j]==0)
        {
            int kl=rand()%4;
            if(kl==0&&i-K<22&&m[i+1][j]==0) m[i][j]=0,m[i+1][j]=16,n[i+1-K][j]=1,SetPos(i-K,j),cout<<"  ",SetPos(i+1-K,j),cout<<"★";
            if(kl==1&&i-1>K&&m[i-1][j]==0) m[i][j]=0,m[i-1][j]=16,n[i-1-K][j]=1,SetPos(i-K,j),cout<<"  ",SetPos(i-1-K,j),cout<<"★";
            if(kl==2&&j+1<20&&m[i][j+1]==0) m[i][j]=0,m[i][j+1]=16,n[i-K][j+1]=1,SetPos(i-K,j),cout<<"  ",SetPos(i-K,j+1),cout<<"★";
            if(kl==3&&j-1>1&&m[i][j-1]==0) m[i][j]=0,m[i][j-1]=16,n[i-K][j-1]=1,SetPos(i-K,j),cout<<"  ",SetPos(i-K,j-1),cout<<"★";
        }
    }
}
void Sheng()
{
    RR++;
    if(K<-8) RR=5;
    if(K==-8) RR=0;
    if(RR==3) {int r=rand()%2;if(r==0) RR=0;}
    if(RR==4) RR=0;
    if(RR==0)
    {
        Ax: int Bx=0;
        for(int i=1;i<=20;i++) m[K+22][0]=0;
        for(int i=1;i<=20;i++)
        {
            int R=rand()%50;
            if(R<=10) {int S=rand()%3+1; for(int j=i;j<=i+S;j++) if(j<=20) m[K+22][j]=1;i+=S+1;Bx=1;continue;}
            if(R>10&&R<=12) {for(int j=i;j<=i+1;j++) if(j<=20) m[K+22][j]=2; i+=2;Bx=1;continue;}
            if(R>12&&R<=14) {for(int j=i;j<=i+1;j++) if(j<=20) m[K+22][j]=3; i+=2;continue;}
            if(R>14&&R<=16) {for(int j=i;j<=i+1;j++) if(j<=20) m[K+22][j]=6; i+=2;continue;}
            if(R==17) {m[K+22][i]=m[K+22][i+1]=m[K+22][i+2]=1; m[K+23][i+1]=4; i+=2;continue;}
            if(R>17&&R<=20&&Ee==1) {m[K+22][i]=m[K+22][i+1]=m[K+22][i+2]=1; m[K+23][i+1]=4; i+=2;continue;}
            if(R>20&&R<=30&&Ee==1) m[K+22][i]=10; i++;
        }if(Bx==0) goto Ax;
    }
    int Q=rand()%30; if(Q==0) {int QQ=rand()%20+1; if(m[K+22][QQ]==0) m[K+22][QQ]=16;}
    else if(Q<=2&&Ee==2) {int QQ=rand()%20+1; if(m[K+22][QQ]==0) m[K+22][QQ]=16;}
}
void Star()
{
    int W=rand()%10;if(K<20) W=rand()%7;if(Ee==1) W=3;
    if(W==0) {Color(5);cout<<"火箭!";Sleep(1000);tX=0;for(int i=1;i<=15;i++) {if(X-K<20) X+=2; else X++; Sheng(),K++,Fen++,Map(K+22,K-3,2),system("cls");}m[X-2][Y]=m[X-2][Y-1]=6,S=1;Sleep(10);}
    if(W==1) {Color(5);cout<<"透视眼!";Sleep(1000);system("color 3F");Sleep(100);if(X>2) m[X-2][Y]=m[X-2][Y-1]=6;Map(K+22,K-3,1);system("color 0F");}
    if(W==2) {Color(5);cout<<"减速!";Sleep(1000);system("color 1F");Map(K+22,K-3,3);Ice=10;system("color 0F");if(X>2&&K>10) m[X-2][Y]=m[X-2][Y-1]=6;}
    if(W==3) {Color(5);cout<<"防爆护罩!";Sleep(1000);Fang=15;if(X>2&&K>10) m[X-2][Y]=m[X-2][Y-1]=6;}
    if(W==4) {Color(5);cout<<"白内障!";Sleep(1000);system("color 5F");Map(K+22,K-3,0);Bai=15;system("color 0F");if(X>2&&K>10) m[X-2][Y]=m[X-2][Y-1]=6;}
    if(W==5) {Color(5);cout<<"隐身!";Sleep(1000);system("color 2F");Yin=15;if(X>2) m[X-2][Y]=m[X-2][Y-1]=6;Map(K+22,K-3,0);system("color 0F");}
    if(W==6) {Color(5);cout<<"兴奋剂!";Sleep(1000);system("color 4F");Sleep(100);Can=15;if(X>2) m[X-2][Y]=m[X-2][Y-1]=6;Map(K+22,K-3,1);system("color 0F");}
    if(W==7) {Color(5);cout<<"踏云靴!";Sleep(1000);system("color 6F");Sleep(100);Ta=10;}
    if(W==8) {Color(5);cout<<"平台!";Sleep(1000);system("color 7F");Sleep(100);for(int i=1;i<=20;i++) m[X-1][i]=1;Map(K+22,K-3,1);system("color 0F");}
    if(W==9) {Color(5);cout<<"炸弹陷阱!";Sleep(1000);system("color 4F");for(int i=0;i<=5;i++){int kX=rand()%9-4;int kY=rand()%9-4;if(Y+kY>0&&Y+kY<=20) m[X+kX][Y+kY]=3;}tX=0;if(X>1) m[X-1][Y]=6;Map(K+22,K-3,0);system("color 0F");}
}
void Start()
{
    Color(5);
    SetPos(25,2);cout<<"   ■■■     ■    ";
    SetPos(24,2);cout<<"   ■  ■    ■     ";
    SetPos(23,2);cout<<"   ■■■  ■    ■ ";
    SetPos(22,2);cout<<"   ■  ■ ■■■■■  注意!";
    SetPos(21,2);cout<<"   ■  ■           ";
    SetPos(20,2);cout<<"   ■■■  ■■■■   按键模式已修改!";
    SetPos(19,2);cout<<"   ■  ■  ■    ■ ";
    SetPos(18,2);cout<<"   ■  ■  ■    ■   现在需要同时按才";
    SetPos(17,2);cout<<"■■   ■  ■■■■         可左右跳!";
    SetPos(14,2);cout<<"        ■         ■    ";
    SetPos(13,2);cout<<"         ■        ■    ";
    SetPos(12,2);cout<<"      ■■■   ■■■■■";
    SetPos(11,2);cout<<"         ■    ■  ■  ■";
    SetPos(10,2);cout<<"        ■     ■■■■■";
    SetPos(9,2); cout<<"      ■ ■■  ■  ■  ■";
    SetPos(8,2); cout<<"     ■  ■ ■ ■■■■■";
    SetPos(7,2); cout<<"         ■        ■    ";
    SetPos(6,2); cout<<"         ■        ■    ";
    SetPos(5,2); cout<<"         ■        ■    之 路";
    SetPos(3,2);Color(0);cout<<"按 y 确定!";SetPos(3,10);Color(9);cout<<"    开始游戏!    ";SetPos(2,10);Color(0);cout<<"    炸弹风暴!    ";SetPos(1,10);Color(0);cout<<"    夺星之战!    ";
    SetPos(-1,1);Color(3);cout<<"注意!这里 绝对不能是拼音输入法!";
    SetPos(-2,5);Color(3);cout<<"↓";Color(0);
    char tt;Ee=0;
    while(tt!='y')
    {
        tt=_getch();
        if(tt==72&&Ee!=0) Ee--;
        if(tt==80&&Ee!=2) Ee++;
        SetPos(3,10);if(Ee==0) Color(9);else Color(0);cout<<"    开始游戏!    ";Color(0);
        SetPos(2,10);if(Ee==1) Color(9);else Color(0);cout<<"    炸弹风暴!    ";Color(0);
        SetPos(1,10);if(Ee==2) Color(9);else Color(0);cout<<"    夺星之战!    ";Color(0);
    }system("cls");
    if(Ee==1) m[9][8]=m[9][9]=m[9][10]=m[9][11]=m[9][12]=10,m[9][14]=m[9][15]=6;
}
void Return()
{
    for(int i=0;i<=5;i++)
    {
        system("color 1A");Sleep(10);
        system("color 2B");Sleep(10);
        system("color 3C");Sleep(10);
        system("color 4D");Sleep(10);
        system("color 5D");Sleep(10);
        system("color 6E");Sleep(10);
        system("color 7F");Sleep(10);
    }system("color 0F");Map(K+22,K-3,4);system("cls");
    while(K>-6) {for(int i=0;i<=20;i++) m[K+21][i]=0;K--;}
    m[6][16]=4;m[12][13]=16;
    m[9][12]=m[9][13]=6;system("cls");
}
int main()
{
    system("mode con cols=42 lines=30");
    CONSOLE_CURSOR_INFO cursor_info={1,0};
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
    srand((unsigned)time(NULL));
    Start();
    ST:
    X=3,Y=2,dx=3,dy=2,K=-7;
    tX=Fen=RR=S=Er=Sstar=Sboom=Win=0;
    Ta=Fang=Ice=Bai=Yin=Can=0;
    Map(K+22,K-3,0);
    while(X>K-3||dx>K-3)
    {
        S++,U++;
        if(Fen<0) Fen=0;
        if(Ee==0&&Fen>1000) {Win=1;break;}if(Ee==1&&Sboom>=40) {Win=1;break;}if(Ee==2&&Sstar>=20) {Win=1;break;}
        if(K<=5) Slep=20;if(K>5&&K<=10) Slep=15;if(K>10&&K<=20) Slep=10;if(K>20&&K<=30) Slep=8;if(K>30&&K<=70) Slep=7;if(K>70&&K<=150) Slep=6;if(K>150&&K<=250) Slep=5;if(K>250&&K<=400) Slep=4;if(K>400&&K<=600) Slep=3;if(K>600) Slep=2;
        if(Sstar<=5) Su=5;if(Sstar>5&&Sstar<=10) Su=4;if(Sstar>10&&Sstar<=15) Su=3;if(Sstar>15&&Sstar<=20) Su=2;if(Sstar>20&&Sstar<=30) Su=1;
        if(Ice!=0) Slep=20;
        if(X<=K-3&&dx>K-3) X=dx,Y=dy;
        if(S==Slep)
        {
            K++,S=0;
            if(Bai!=0||Yin!=0||Can!=0) Fen+=2;else Fen++;
            if(Ta>0) Ta--;if(Fang>0) Fang--;if(Bai>0) Bai--;if(Ice>0) Ice--;if(Yin>0) Yin--;if(Can>0) Can--;
            if(Ta<0) Ta=0;if(Fang<0) Fang=0;if(Bai<0) Bai=0;if(Ice<0) Ice=0;if(Yin<0) Yin=0;if(Can<0) Can=0;
            system("cls"),Sheng();
        }
        if(GetAsyncKeyState(VK_UP)&0x8000&&TT==0&&Ta==0&&Er<2) TT++,tX+=4,Er++;
        else if(GetAsyncKeyState(VK_UP)&0x8000&&TT==0&&Can!=0) TT++,tX+=7,Er++;
        else if(GetAsyncKeyState(VK_UP)&0x8000&&TT==0&&Ta!=0) SetPos(X-K,Y),cout<<"  ",X++,tX=Er=0;
        if(GetAsyncKeyState(VK_DOWN)&0x8000&&Ty==0) Ty++,SetPos(X-K,Y),cout<<"  ",tX=0,X-=2;
        if((GetAsyncKeyState(VK_UP) & 0x8000) ?0:1) TT=0;
        if((GetAsyncKeyState(VK_DOWN) & 0x8000) ?0:1) Ty=0;
        if(GetAsyncKeyState(VK_LEFT)&0x8000&&Y>1) SetPos(X-K,Y),cout<<"  ",Y--;
        if(GetAsyncKeyState(VK_RIGHT)&0x8000&&Y<20) SetPos(X-K,Y),cout<<"  ",Y++;
        if(kbhit()) {char g=_getch();if(g==' ') Sleep(100),SetPos(24,8),sy++,Color(0),system("pause");}
        if(sy>=1) SetPos(24,8),cout<<"                           ",sy=0;
        if(U>=Su) {U=0;if(Ee==2) MoveStar(K+22,K-3);}
        Map(K+22,K-3,0); Sleep(50);
    }
    if(Win==0) {SetPos(25,8),system("color 7F"),Color(4),cout<<"You! Die!!!",Sleep(1000);}
    else {SetPos(25,8),system("color 6E"),Color(3),cout<<"You! Win!!!",Sleep(1000);}
    SetPos(24,5),cout<<"Please point 'y' to Play AGain.";Color(0);
    A:char e=_getch();if(e=='y') Return();else goto A;goto ST;
    return 0;
}
  1. 愤怒的小鸟

#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
using namespace std;
const double pi=3.1415926536;
int toint(float a){return ((int)(a*10+5))/10;}
void Color(int a)
{
    if(a==0||a==14||a==20) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    if(a==1||a==12) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    if(a==4||a==11) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
    if(a==5||a==13) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    if(a==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_BLUE);
    if(a==15) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    if(a==16) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
    if(a==17) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);
    if(a==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
    if(a==9) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|BACKGROUND_RED|BACKGROUND_GREEN);
}
void SetPos(float x,float y)
{
    int xx=toint(x),yy=toint(y);
    COORD pos;pos.X=yy*2,pos.Y=xx;SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
struct node
{
    int W,W2,S,mS;
    float X,Y;
    float vx,vy;
    float ax,ay;
    bool go,boom;
}blt[100001],pig[100001],boo[100001];
int T,yX,yY,Xy,put,K,K2,Sle,What;
int Bot,Pit,Blt,Pig,Sco,pigk,scok;
int m[41][41];
void Cout(int a,int x,int y)
{
    if(a==1) SetPos(x,y),Color(5),cout<<put<<' ';
    if(y==202)
    {
        SetPos(pig[a].X,pig[a].Y);cout<<"  ";
        if((pig[a].W==2||pig[a].W==3)&&pig[a].X>=2) SetPos(pig[a].X-2,pig[a].Y);cout<<"  ",SetPos(pig[a].X-1,pig[a].Y);cout<<"  ";
        if(pig[a].W==4) SetPos(pig[a].X,pig[a].Y-1),cout<<"  ";
        if(pig[a].W==5) SetPos(pig[a].X-1,pig[a].Y),cout<<"  ",SetPos(pig[a].X-1,pig[a].Y-1),cout<<"  ";
    }
    if(a==2)
    for(int i=0;i<=40;i++)
    for(int j=0;j<=40;j++)
    {
        if(i<=18&&m[i][j]==1) SetPos(i,j),Color(7),cout<<"■";
        if(m[i][j]>=2&&m[i][j]<=19) SetPos(i,j),Color(5),cout<<"█",m[i][j]++;
        if(m[i][j]>19&&m[i][j]<=29) SetPos(i,j),Color(0),cout<<"█",m[i][j]++;
        if(m[i][j]==30) SetPos(i,j),Color(0),cout<<"  ",m[i][j]=0;
        if(m[i][j]>=31&&m[i][j]<=49) SetPos(i,j),Color(0),cout<<"■",m[i][j]++;
        if(m[i][j]==50) SetPos(i,j),Color(7),cout<<"■",m[i][j]=1;
    }
    if(y==666)
    {
        SetPos(blt[a].X,blt[a].Y);
        Color(10+blt[a].W),cout<<"●";
    }Color(0);
}
void Go(int a)
{
    SetPos(blt[a].X,blt[a].Y);cout<<"  ";
    blt[a].X+=blt[a].vx/2;blt[a].Y+=blt[a].vy/2;blt[a].vx+=blt[a].ax/2;blt[a].vy+=blt[a].ay/2;
    if(blt[a].X>=20) blt[a].X=19;
    if(blt[a].X>20||blt[a].Y>38||blt[a].X<0||blt[a].Y<=0) blt[a].go=1;
    if(blt[a].W2==1&&blt[a].Y>=Xy) blt[a].go=1,Sle=0;//地跑鸟
    if(blt[a].W2==0)
    {
        for(int i=0;i<=blt[a].vx/2+1;i++)
        {
            if(blt[a].vx>0&&m[toint(blt[a].X)+i][toint(blt[a].Y)]==1) //上反弹
            {
                if(blt[a].W!=5) blt[a].boom=1;
                blt[a].X=toint(blt[a].X)+i-1,blt[a].Y+=blt[a].vy/2,blt[a].vx=-blt[a].vx*0.4,blt[a].vy=blt[a].vy*0.8;
                if(blt[a].W==3) blt[a].ax=0.5;if(blt[a].W==7) blt[a].vx*=2;
                if(blt[a].W==10) blt[a].go=1,Bot++,boo[Bot].X=blt[a].X,boo[Bot].Y=blt[a].Y,boo[Bot].S=1,boo[Bot].mS=4;
            }
            if(blt[a].vx<0&&m[toint(blt[a].X)-i][toint(blt[a].Y)]==1) //下反弹
            {
                if(blt[a].W!=5) blt[a].boom=1;
                blt[a].X=toint(blt[a].X)+i+1,blt[a].Y+=blt[a].vy/2,blt[a].vx=-blt[a].vx,blt[a].vy=blt[a].vy*0.8;
                if(blt[a].W==3) blt[a].ax=0.5;if(blt[a].W==7) blt[a].vx*=2;
                if(blt[a].W==10) blt[a].go=1,Bot++,boo[Bot].X=blt[a].X,boo[Bot].Y=blt[a].Y,boo[Bot].S=1,boo[Bot].mS=4;
            }
        }
        if(abs(blt[a].vx)<=0.1&&abs(blt[a].vy)<=0.1&&abs(blt[a].ay)<=0.1)
        {
            blt[a].go=1;
            if(blt[a].W==5) Bot++,boo[Bot].X=blt[a].X,boo[Bot].Y=blt[a].Y,boo[Bot].S=1,boo[Bot].mS=4,blt[a].go=1;
        }
    }
    if(blt[a].go==0) Cout(a,0,666);
}
void Kill(int a)
{
    if(pig[a].go==0&&pig[a].W!=2&&pig[a].W!=3&&pig[a].Y<16) Cout(a,202,202),pig[a].Y=16;
    if(pig[a].go==0&&pig[a].W==4&&pig[a].Y<20) pig[a].W=1;
    int R=rand()%50;Cout(a,202,202);
    /清除猪猪
    pig[a].X+=pig[a].vx/2;pig[a].Y+=pig[a].vy/2;pig[a].vx+=pig[a].ax/2;pig[a].vy+=pig[a].ay/2;
    for(int i=-2;i<=pig[a].vx/2+1;i++)
    {
        if(m[toint(pig[a].X)+i][toint(pig[a].Y)]==1) //上反弹
        pig[a].X=toint(pig[a].X)+i-1,pig[a].Y+=pig[a].vy/2,pig[a].vx=-pig[a].vx*0.5,pig[a].vy=pig[a].vy*0.8;
    }
    for(int i=Blt-10;i<=Blt;i++)
    {
        if(pig[a].W==5&&blt[i].go==0&&abs(pig[a].X-blt[i].X)<=1&&abs(pig[a].Y-blt[i].Y)<=1) {m[toint(pig[a].X)-1][toint(pig[a].Y)]=2,pig[a].W2++;Sco+=2;break;}
        if(pig[a].W==5&&m[toint(pig[a].X)][toint(pig[a].Y)]>=2&&m[toint(pig[a].X)][toint(pig[a].Y)]<30) {m[toint(pig[a].X)-1][toint(pig[a].Y)]=2,pig[a].W2++;Sco+=2;break;}
        if(blt[i].go==0&&abs(pig[a].X-blt[i].X)<=1&&abs(pig[a].Y-blt[i].Y)<=1)
        {
            if(pig[a].W==6) Bot++,boo[Bot].X=pig[a].X,boo[Bot].Y=pig[a].Y,boo[Bot].S=1,boo[Bot].mS=4,blt[i].go=1;
            m[toint(pig[a].X)][toint(pig[a].Y)]=2,pig[a].go=1,Pig--,Sco+=10;break;
        }
        if(m[toint(pig[a].X)][toint(pig[a].Y)]>=2&&m[toint(pig[a].X)][toint(pig[a].Y)]<30)
        {
            if(pig[a].W==6) Bot++,boo[Bot].X=pig[a].X,boo[Bot].Y=pig[a].Y,boo[Bot].S=1,boo[Bot].mS=4;
            pig[a].go=1,Pig--,Sco+=10;break;
        }
        if((pig[a].W==2||pig[a].W==3)&&blt[i].go==0&&abs(pig[a].X-2-blt[i].X)<=1&&abs(pig[a].Y-blt[i].Y)<=1) {m[toint(pig[a].X)][toint(pig[a].Y)]=2,pig[a].go=1,Pig--,Sco+=10;break;}
        if((pig[a].W==2||pig[a].W==3)&&m[toint(pig[a].X-2)][toint(pig[a].Y)]>=2&&m[toint(pig[a].X-2)][toint(pig[a].Y)]<30) {pig[a].go=1,Pig--,Sco+=10;break;}
    }
    /弄死猪猪
    if(pig[a].go==0)
    {
        if(pig[a].go==0&&pig[a].W!=2&&pig[a].W!=3&&pig[a].Y<16) Cout(a,202,202),pig[a].Y=16;
        if(pig[a].go==0&&pig[a].W==4&&pig[a].Y<20) pig[a].W=1;
        int Xx=toint(pig[a].X),Xy=toint(pig[a].Y);
        if(pig[a].W==6) SetPos(pig[a].X,pig[a].Y),Color(9),cout<<"TN",Color(0);
        else{
        SetPos(pig[a].X,pig[a].Y),Color(2),cout<<"●";
        if((pig[a].W==2||pig[a].W==3)&&pig[a].X>=2) SetPos(pig[a].X-2,pig[a].Y),Color(0),cout<<"○",SetPos(pig[a].X-1,pig[a].Y),cout<<"|";
        if(pig[a].W==4) SetPos(pig[a].X,pig[a].Y-1),Color(2),cout<<"﹃";
        if(pig[a].W==5)
        {
            SetPos(pig[a].X-1,pig[a].Y),Color(8);SetPos(pig[a].X-1,pig[a].Y-1),cout<<"▁";
            if(pig[a].W2==0)cout<<"▅";if(pig[a].W2==1)cout<<"▃";if(pig[a].W2==2)cout<<"▂";if(pig[a].W2==3) pig[a].W=1,pig[a].W2=0,SetPos(pig[a].X-1,pig[a].Y-1),cout<<"  ";
        }
        }
        /输出猪猪
        if(pig[a].W==2&&pig[a].X>pig[a].S) pig[a].W=3,pig[a].ax=-0.4,pig[a].vx=1.5;
        else if(pig[a].W==3&&pig[a].X<=pig[a].S) pig[a].W=2,pig[a].ax=0.4,pig[a].vx=-1.5;
        if((pig[a].W==2||pig[a].W==3)&&(pig[a].Y<=10||pig[a].Y>=38)) pig[a].vy*=-1;
        if(pig[a].W==4&&R==0&&pig[a].X==20) pig[a].vx=-((rand()%40)/10);
        if(pig[a].W==4)
        {
            int r=rand()%20;
            for(int i=Blt-10;i<=Blt;i++) if(r<=5&&blt[i].go==0&&pig[a].Y-blt[i].Y<=5&&abs(blt[i].X-pig[a].X)<=1.5&&r<5) r=0;
            if(r==0)
            {
                m[toint(pig[a].X)][toint(pig[a].Y)-2]=10;m[toint(pig[a].X)][toint(pig[a].Y)-3]=2;
                for(int j=toint(pig[a].Y)-1;j>=toint(pig[a].Y)-5;j--)
                {
                    for(int i=Blt-10;i<=Blt;i++) if(blt[i].go==0&&!(blt[i].W==3&&blt[i].boom==1)&&blt[i].W2==0&&toint(blt[i].Y)==j&&abs(blt[i].X-pig[a].X)<=2) blt[i].vy=-2;
                    for(int i=Pit-50;i<=Pit;i++) if(pig[i].go==0&&toint(pig[i].Y)==j&&abs(pig[i].X-pig[a].X)<=2) pig[i].vy=-1;
                }
            }
        }
        /移动猪猪
        if(pig[a].go==0&&pig[a].W!=2&&pig[a].W!=3&&pig[a].Y<16) Cout(a,202,202),pig[a].Y=16;
        if(pig[a].go==0&&pig[a].W==4&&pig[a].Y<20) pig[a].W=1;
        if(pig[a].X>20||pig[a].Y>38||pig[a].X<0||pig[a].Y<=0) pig[a].go=1,Pig--,Cout(a,202,202);
        /清除猪猪
    }
}
void Creat(int a,int p)
{
    if(a==-1&&p==-1)
    {
        Blt++;blt[Blt].W=What;blt[Blt].W2=1;
        blt[Blt].vy=1;blt[Blt].X=19;blt[Blt].Y=0;blt[Blt].boom=1;
    }
    else if(a==0&&p==-1)
    {
        int u=rand()%7+1,U=rand()%30;
        if(u>=5) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].ax=0.5,pig[Pit].W=1;
        if(u==1) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].vy=0.5,pig[Pit].ax=0.5,pig[Pit].S=rand()%5+7,pig[Pit].W=2;
        if(u==2) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].ax=0.5,pig[Pit].W=4;
        if(u==3) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].ax=0.5,pig[Pit].W=5;
        if(u==4) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].ax=0.5,pig[Pit].W=6;
        if(U==1) Bot++,boo[Bot].Y=rand()%13+15,boo[Bot].X=(rand()%4)*3+8,boo[Bot].S=0,boo[Bot].mS=rand()%2+2,boo[Bot].W2=1;
    }
    else
    {
        Blt++;blt[Blt].W=What;
        if(a==1) blt[Blt].X=yX;blt[Blt].Y=yY;blt[Blt].ax=0.5; //抛物线
        blt[Blt].vx=-3.5*sin(p*pi/180);
        blt[Blt].vy=3*cos(p*pi/180);
        if(p<=45) blt[Blt].vy*=1+(0.33-0.01*(45-p));
        if(p>=45) blt[Blt].vy*=1+(0.33-0.01*(p-45));
        if(blt[Blt].W==6) blt[Blt].vy*=1.2,blt[Blt].ax=0.4;
    }
}
void Boom(int a)
{
    if(boo[a].W2==0)
    {
        int ms=boo[a].mS,s=boo[a].S,x=boo[a].X,y=boo[a].Y;
        if(s==ms) return;
        for(int i=x-s;i<=x+s;i++)
        for(int j=y-s;j<=y+s;j++)
        {
            float k=(i-x)*(i-x)+(j-y)*(j-y)-s*s;
            if(k<=s&&k>=-s&&i<=20&&j<=38&&i>=0&&j>0&&m[i][j]!=1) m[i][j]=2;
        }boo[a].S++;
    }
    if(boo[a].W2==1)
    {
        int ms=boo[a].mS,s=boo[a].S,x=boo[a].X,y=boo[a].Y;
        if(s==ms) return;
        if(y-s>10) m[x][y-s]=31-31*(boo[a].W2-1);
        if(y+s<40) m[x][y+s]=31-31*(boo[a].W2-1);
        boo[a].S++;
    }
}
void Move(int a)
{
    Color(5);
    if(a==-2) SetPos(17,Xy),cout<<"        ",SetPos(18,Xy),cout<<"        ",SetPos(19,Xy),cout<<"        ",SetPos(20,Xy),cout<<"       ";
    if(a==-1) SetPos(17,Xy),cout<<"        ",SetPos(18,Xy),cout<<"  ┃  ┃",SetPos(19,Xy),cout<<"  ╰┳╯",SetPos(20,Xy),cout<<"     ▏";
    if(a==0) SetPos(18,Xy),cout<<"  ┃",Color(What+10),cout<<"●",Color(5),cout<<"┃",SetPos(19,Xy),cout<<"  ╰┳╯",SetPos(20,Xy),cout<<"     ▏";
    if(a==1) SetPos(18,Xy),cout<<"  ",Color(What+10),cout<<"●",Color(5),cout<<"  ┃",SetPos(19,Xy),cout<<"  ╰┳╯",SetPos(20,Xy),cout<<"     ▏";
    if(a==2) SetPos(18,Xy),Color(What+10),cout<<"●",Color(5),cout<<"┃  ┃",SetPos(19,Xy),cout<<"  ╰┳╯",SetPos(20,Xy),cout<<"     ▏";
    if(a==3) SetPos(18,Xy),cout<<"  ┃  ┃",SetPos(19,Xy),Color(What+10),cout<<"●",Color(5),cout<<"╰┳╯",SetPos(20,Xy),cout<<"     ▏";
    if(a==4) SetPos(18,Xy),cout<<"  ┃  ┃",SetPos(19,Xy),cout<<"  ╰┳╯",SetPos(20,Xy),Color(What+10),cout<<"●",Color(5),cout<<"   ▏";
    if(a==5) SetPos(18,Xy),cout<<"  ┃  ┃",SetPos(19,Xy),cout<<"  ╰┳╯",SetPos(20,Xy),cout<<"  ",Color(What+10),cout<<"●",Color(5),cout<<" ▏";
    if(a==6) SetPos(18,Xy),cout<<"  ┃  ┃",SetPos(19,Xy),cout<<"  ╰┳╯",SetPos(20,Xy),cout<<"    ",Color(What+10),cout<<"●",Color(5),cout<<" ";
    Color(0);
}
void Start()
{
    char g;Color(5);system("cls");
    SetPos(1,1);cout<<"------- 愤 怒 的 小 鸟 -------";Color(0);
    SetPos(3,1);cout<<"空格瞄准,按X触发小胎技能,←→移动弹弓";
    SetPos(5,1);cout<<"猪猪技能自动触发,空中会有墙出现。";
    SetPos(7,1);cout<<"危险值由命中率,猪的存活时间计算!";
    SetPos(9,1);cout<<"危险值点满后失败!1500分通关!";
    SetPos(1,20);cout<<"-------- 小 鸟 技 能 --------";
    SetPos(3,20);Color(11),cout<<"●",Color(0),cout<<":无技能";
    SetPos(5,20);Color(12),cout<<"●",Color(0),cout<<":分身!不同分身初速度大小相同,";
    SetPos(6,20);cout<<"        方向不同。";
    SetPos(7,20);Color(13),cout<<"●",Color(0),cout<<":加速!以当前速度做匀速直线运动,";
    SetPos(8,20);cout<<"          且免疫狙击猪的冲击。";
    SetPos(9,20);Color(14),cout<<"●",Color(0),cout<<":投蛋!并获得向上速度做匀速直线";
    SetPos(10,20);cout<<"          运动,快达可以穿墙。";
    SetPos(11,20);Color(15),cout<<"●",Color(0),cout<<":爆炸!";
    SetPos(13,20);Color(16),cout<<"●",Color(0),cout<<":回旋!开始做向左加速运动!发射";
    SetPos(14,20);cout<<"          时获得双倍水平速度。";
    SetPos(15,20);Color(17),cout<<"●",Color(0),cout<<":[被动] 弹跳力为普通鸟三倍。发射";
    SetPos(16,20);cout<<"          时获得1.5倍水平、竖直速度。";
    SetPos(11,1);cout<<"-------- 猪 猪 技 能 --------";
    SetPos(13,2);Color(2),cout<<"●",Color(0),cout<<":无技能";
    SetPos(14,1);Color(8),cout<<"▁▅";
    SetPos(15,2);Color(2),cout<<"●",Color(0),cout<<":防御力为普通猪三倍";
    SetPos(16,2);cout<<"○";
    SetPos(17,2);cout<<"│:做空中简谐运动,受死范围";
    SetPos(18,2);Color(2),cout<<"●",Color(0),cout<<"  为普通猪两倍。";
    SetPos(19,2);cout<<"    有几率跳起或发射冲击波,冲";
    SetPos(20,1);Color(2),cout<<"﹃●",Color(0),cout<<":炸开小鸟与同类,可以引爆TNT!";
    SetPos(18,20);Color(5),cout<<"按 y 开始游戏!";
    A:if(kbhit()) g=_getch();
    if(g!='y') goto A;
}
int main()
{
    system("mode con cols=79 lines=22");
    CONSOLE_CURSOR_INFO cursor_info={1,0};
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
    srand((unsigned)time(NULL));St:Start();system("cls");
    memset(blt,0,sizeof(blt));memset(pig,0,sizeof(pig));
    memset(boo,0,sizeof(boo));memset(m,0,sizeof(m));
    T=put=K=K2=Sle=What=Pig=Sco=0;pigk=scok=-1;
    Xy=4,yX=18,yY=6;Blt=20,Bot=20,Pit=60;Color(7);
    SetPos(19,14);cout<<"■";
    SetPos(20,13);cout<<" █▍";m[19][14]=m[20][13]=m[20][14]=1;
    SetPos(21,0);for(int i=0;i<39;i++) cout<<"■",m[21][i]=1;
    Color(0);What=rand()%5+1;
    while(1)
    {
        if(Sco>=1500) break;
        T++;K=0;Color(0);
        if(Sco!=scok) SetPos(1,1),cout<<"分数:"<<Sco<<' ';
        if(Pig!=pigk){SetPos(3,1);cout<<"危险值:";int aa=min(Sco/100,10);Pig+=aa;
        SetPos(3,5);if(Pig<=2) Color(2);else if(Pig<=4) Color(16);else if(Pig<=6) Color(7);else if(Pig<=9) Color(6);
        else if(Pig<=12) Color(3);else if(Pig<=15) Color(17);else Color(11);
        for(int i=1;i<=Pig;i++) cout<<"■";Color(0);cout<<' '<<Pig;for(int i=1;i<=5;i++) cout<<"  ";
        if(Pig>18) break;Pig-=aa;}
        scok=Sco;pigk=Pig;
        if(GetAsyncKeyState(VK_LEFT)&0x8000&&Xy>0) Move(-2),Xy--,K=1;
        if(GetAsyncKeyState(VK_RIGHT)&0x8000&&Xy<10) Move(-2),Xy++,K=1;
        if(K==1)
        {
            if(put==0&&Sle==0) Move(0);
            else Move(-1);
        }
        if(kbhit())
        {
            char g=_getch();
            if(g=='x'||g=='X')
            {
                for(int i=Blt-10;i<=Blt;i++)
                if(blt[i].go==0&&blt[i].boom==0&&blt[i].W!=1&&blt[i].W!=7)
                {
                    blt[i].boom=1;
                    if(blt[i].W==2)
                    {
                        Blt++;blt[Blt].W=2;blt[Blt].vy=blt[i].vy*1.2;blt[Blt].vx=blt[i].vx+1;
                        blt[Blt].ax=blt[i].ax;blt[Blt].X=blt[i].X;blt[Blt].Y=blt[i].Y;blt[Blt].boom=1;
                        Blt++;blt[Blt].W=2;blt[Blt].vy=blt[i].vy*0.7;blt[Blt].vx=blt[i].vx-1;
                        blt[Blt].ax=blt[i].ax;blt[Blt].X=blt[i].X;blt[Blt].Y=blt[i].Y;blt[Blt].boom=1;
                    }
                    if(blt[i].W==3) blt[i].vy=fmax(blt[i].vy*1.5,2.5),blt[Blt].vx+=1,blt[i].ax=0;
                    if(blt[i].W==4)
                    {
                        blt[i].vx=-3;blt[i].ax=0.1;Blt++;blt[Blt].boom=1;blt[Blt].W=10;
                        blt[Blt].X=blt[i].X;blt[Blt].Y=blt[i].Y;blt[Blt].ax=blt[i].ax,blt[Blt].vx=1;
                    }
                    if(blt[i].W==5) Bot++,boo[Bot].X=blt[i].X,boo[Bot].Y=blt[i].Y,boo[Bot].S=1,boo[Bot].mS=5,blt[i].go=1;
                    if(blt[i].W==6) blt[i].ay=-1,blt[i].ax=0.3,blt[i].vx=min(blt[i].vx/2,(float)0);
                    break;
                }
            }
        }
        if(GetAsyncKeyState(' ')&0x8000&&K==0&&Sle==0)
        {
            if(put<=5) Move(1),yX=18,yY=Xy+1;
            else if(put<=20) Move(2),yX=18,yY=Xy;
            else if(put<=40) Move(3),yX=19,yY=Xy;
            else if(put<=60) Move(4),yX=20,yY=Xy;
            else if(put<=80) Move(5),yX=20,yY=Xy+1;
            else Move(6),yX=20,yY=Xy+2;
            if(put==0) K2=1;if(put==90) K2=-1;
            if(K2==1) put+=min(rand()%7+1,90-put);
            if(K2==-1) put-=min(rand()%7+1,put);
            Cout(1,17,Xy+2);
        }
        if((!(GetAsyncKeyState(' ')&0x8000)&&(put!=0))||(put!=0&&K==1))
        Move(-1),Creat(1,put),put=0,yX=18,yY=5,Sle=1,What=rand()%7+1,Creat(-1,-1),Sco=max(Sco-5,0);
        for(int i=Blt-10;i<=Blt;i++) if(blt[i].go==0) Go(i);
        for(int i=Bot-10;i<=Bot;i++) if(boo[i].go==0) Boom(i),Cout(2,0,0);
        for(int i=Pit-50;i<=Pit;i++) if(pig[i].go==0) Kill(i);
        if(Sle!=0) Move(-1);
        else if(put==0) Move(0);
        if(T%300==0) system("cls"),pigk=scok=-1;
        if(T%100==0)
        {
            Color(7);
            for(int i=0;i<=18;i++)
            for(int j=0;j<=40;j++) if(m[i][j]==1&&T%100==0) SetPos(i,j),cout<<"■";
            SetPos(19,14),cout<<"■",SetPos(20,13),cout<<" █▍";
            SetPos(21,0);for(int i=0;i<39;i++) cout<<"■";Color(0);
        }
        if(T%min(50,(2000-Sco)/30)==0) Pig++,Creat(0,-1);
        Sleep(30);
    }
    if(Sco<1500) {SetPos(9,17);system("color 7F");Color(11);cout<<"YOU DIE !";}
    else {SetPos(9,17);system("color 6E");Color(5);cout<<"YOU WIN !";}
    SetPos(11,16);Sleep(1000);cout<<"play again? (y/n)";Sleep(1000);char g;
    A:if(kbhit()) g=_getch();SetPos(18,0);
    if(g=='n') return 0;
    else if(g!='y') goto A;
    else if(g=='y') goto St;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值