j2游戏第二弹!

· · 个人记录

学校曾经流行的一个小游戏

三年前萌生了把它变成电脑游戏的念头

两年前开始编写

一年半前编完

今天发了出来

这是我的第一个游戏

那时,我才接触C++没多久

曾今这个梦想遥不可及

但现在实现了!

预告:j2游戏第三弹:丧尸危机改编版与第四弹:商业帝国即将来袭!


#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
string myt,comt,comm[7]={"","心","盾","枪","高级盾","反弹","世界末日"};
int myh,comh;
void xc(string c,string m)
{
    if(c=="心") 
    {
        comh++;
    }
    if(m=="心")
    {
        myh++;
    }
    if(c=="枪"||c=="高级盾")
    {
        comh--;
    }
    if(m=="枪"||m=="高级盾")
    {
        myh--;
    }
    if(c=="反弹")
    {
        comh-=2;
    }
    if(m=="反弹")
    {
        myh-=2;
    }
    if(c=="世界末日")
    {
        comh-=3;
    }
    if(m=="世界末日")
    {
        myh-=3;
    }
}
void bxc(string c,string m)
{
    if(c=="心") 
    {
        comh++;
    }
    if(m=="心")
    {
        myh++;
    }
    if(c=="枪"||c=="高级盾")
    {
        comh--;
    }
    if(m=="枪"||m=="高级盾")
    {
        myh++;
    }
    if(c=="反弹")
    {
        comh-=2;
    }
    if(m=="反弹")
    {
        myh+=2;
    }
    if(c=="世界末日")
    {
        comh-=3;
    }
    if(m=="世界末日")
    {
        myh+=3;
    }
}
bool f(string s)
{
    if(((myh<1)&&(myt=="枪"||myt=="高级盾"))||((myh<2)&&myt=="反弹")||(myh<3)&&myt=="世界末日")
    {
        return true;
    }
    else
    {
        return false;
    }
}
char win(string c,string m)
{
    if(c=="枪"&&m=="心"||c=="世界末日"&&!(m=="高级盾"||m=="黑洞"||m=="枪"||m=="世界末日"||m=="反弹")||c=="反弹"&&(m=="枪"||m=="世界末日")||(c=="专属技能——双枪"&&!(m=="反弹"||m=="高级盾")))
    {
        return 'c';
    }
    if(m=="枪"&&c=="心"||m=="世界末日"&&!(c=="高级盾"||c=="黑洞"||c=="枪"||c=="世界末日"||c=="反弹")||m=="反弹"&&(c=="枪"||c=="世界末日"||c=="专属技能——双枪"))
    {
        return 'm';
    }
    return 'n';
}
void sleep(float i)
{
    Sleep(i*1000);
}
void kill_writer_g()
{
    cout<<"第一回合:心"<<endl;
    cout<<"第二~七回合:盾"<<endl;
    cout<<"第八回合:心"<<endl;
    cout<<"第九回合:反弹(击杀!)"<<endl;
    sleep(7);
    system("cls");
}
void com()
{
    myh=comh=0;
    int j=0;
    while(1)
    {
        j++;
        cout<<"请问您要出什么?(心、盾、枪、高级盾、世界末日、反弹)"<<endl;
        cout<<"你剩余心数:"<<myh<<endl;
        cout<<"计算机剩余心数:"<<comh<<endl;
        cin>>myt;
        if(f(myt))
        {
            cout<<"犯规,你已输"<<endl; 
            cout<<"You lose!"<<endl;
            sleep(4);
            system("cls");
            break;
        }
        cout<<"本轮计算机使用了";
        switch(comh)
        {
            case 0:
                if(j==1||myh-1==0)
                {
                    comt="心";
                    cout<<comt<<endl;
                    if(win(comt,myt)=='m')
                    {
                        cout<<"电脑失败!"<<endl;
                        cout<<"You win!"<<endl;
                        sleep(4);
                        system("cls");
                        return;
                    }
                    xc(comt,myt);
                }
                else
                {
                    comt=comm[rand()%2+1];
                    cout<<comt<<endl;
                    if(win(comt,myt)=='m')
                    {
                        cout<<"电脑失败!"<<endl;
                        cout<<"You win!"<<endl;
                        sleep(4);
                        system("cls");
                        return; 
                    }
                    xc(comt,myt);
                }
                break;
            case 1:
                if(myh>=3)
                {
                    comt=comm[rand()%4+1];
                }
                else
                {
                    comt=comm[rand()%3+1];
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                xc(comt,myt);
                break;
            case 2:
                comt=comm[rand()%5+1];
                if(myh-1==0&&comt=="反弹")
                {
                    comt=comm[rand()%4+1];
                }
                if(myh<3&&comt=="高级盾")
                {
                    comt="盾"; 
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                xc(comt,myt);
                break;
            default:
                comt=comm[rand()%6+1];
                if(myh-1==0&&comt=="反弹")
                {
                    comt=comm[rand()%4+1];
                }
                if(myh<3&&comt=="高级盾")
                {
                    comt="盾"; 
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                xc(comt,myt);
                break;
        }
    }
}
void writer()
{
    myh=0;
    int j=1;
    comh=1;
    while(j<=10)
    {
        bool h=false;
        cout<<"请问您要出什么?(心、盾、枪、高级盾、世界末日、反弹)"<<endl;
        cout<<"你剩余心数:"<<myh<<endl;
        cout<<"作者剩余心数:"<<comh<<endl;
        cin>>myt;
        if(f(myt))
        {
            cout<<"犯规,你已输"<<endl; 
            cout<<"You lose!"<<endl;
            sleep(4);
            system("cls");
            return;
        }
        cout<<"作者(j2)使用了";
        switch(j)
        {
            case 1:
                comt="心";
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"作者:我竟然被你打败了!我不服啊啊啊!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                xc(comt,myt);
                break;
            case 2:
                comt="专属技能——黑洞";
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"作者:我竟然被你打败了!我不服啊啊啊!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(myt=="心")
                {
                    myh--;
                    comh++;
                }
                xc("黑洞",myt);
                break;
            case 3:
                comt="枪";
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"作者:我竟然被你打败了!我不服啊啊啊!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                xc(comt,myt);
                break;
            case 4:
                comt="专属技能——黑洞";
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"作者:我竟然被你打败了!我不服啊啊啊!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(myt=="心")
                {
                    myh--;
                    comh++;
                }
                xc("黑洞",myt);
                break;
            case 5:
                if(comh<2)
                {
                    comt="专属技能——黑洞";
                    h=true;
                }
                else
                {
                    comt="枪";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"作者:我竟然被你打败了!我不服啊啊啊!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(h)
                {
                    if(myt=="心")
                    {
                        myh--;
                        comh++;
                    }
                    xc("黑洞",myt);
                }
                else
                {
                    xc(comt,myt);
                }
                h=false;
                break;
            case 6:
                if(comh<1)
                {
                    comt="专属技能——黑洞";
                    h=true;
                }
                else
                {
                    comt="枪";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"作者:我竟然被你打败了!我不服啊啊啊!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(h)
                {
                    if(myt=="心")
                    {
                        myh--;
                        comh++;
                    }
                    xc("黑洞",myt);
                }
                else
                {
                    xc(comt,myt);
                }
                h=false;
                break;
            case 7:
                comt="高级盾";
                if(myh<3&&comt=="高级盾")
                {
                    if(comh<1)
                    {
                        comt="专属技能——黑洞";
                        h=true;
                    }
                    else
                    {
                        comt="枪";
                    }
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"作者:我竟然被你打败了!我不服啊啊啊!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(h)
                {
                    if(myt=="心")
                    {
                        myh--;
                        comh++;
                    }
                    xc("黑洞",myt);
                }
                else
                {
                    xc(comt,myt);
                }
                h=false;
                break;
            case 8:
                comt="专属——无敌心";
                cout<<comt<<endl;
                xc("心",myt);
                break;
            case 9:
                if(comh>=2)
                {
                    if(comh>=3)
                    {
                        comt="世界末日";
                    }
                    else
                    {
                        comt="专属技能——双枪";
                    }
                }
                else
                {
                    comt="枪";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"作者:我竟然被你打败了!我不服啊啊啊!"<<endl;
                    cout<<"You win!"<<endl;
                    if(MessageBox(0,TEXT("你都能击败我了,可以退出游戏了吗?"),TEXT("无奈的作者曰"),MB_OKCANCEL|MB_ICONINFORMATION)!=IDOK)
                    {
                        sleep(4);
                        system("cls");
                        return;
                    }
                    else
                    {
                        MessageBox(0,TEXT("算了,你还可以和电脑打"),TEXT("多变的作者曰"),MB_OK);
                        system("cls");
                        return;
                    }
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                xc(comt,myt);
                break;
            default:
                cout<<"/nothing/"<<endl<<"作者:你竟然撑住了9个回合!根据挑战作者规则,游戏到此结束,算平局!"<<endl;
                sleep(5);
                system("cls");
                return;
        }
        j++;
    }
}
void gfjs()
{
    cout<<"价目:"<<endl;
    cout<<"0心:1.盾"<<endl;
    cout<<"1心:2.枪,3.高级盾"<<endl;
    cout<<"2心:4.反弹"<<endl;
    cout<<"3心:5.世界末日"<<endl;
    sleep(1);
    cout<<"可以输入对应号码详细查询"<<endl;
    sleep(0.5);
    cout<<"输入其他任何即可退出"<<endl;
    int n;
    cin>>n;
    switch(n)
    {
        case 1:
            cout<<"盾,可防御枪"<<endl;
            sleep(3);
            break; 
        case 2:
            cout<<"枪,最弱的攻击性武器,只能在对方是心时击败,战力很弱,但是消耗的心只有1颗,受众人欢迎"<<endl;
            sleep(5);
            break;
        case 3:
            cout<<"高级盾,盾的进化版,可以防住世界末日和枪,但要消耗1颗心"<<endl;
            sleep(5);
            break;
        case 4:
            cout<<"反弹,顾名思义,可以完全反弹对方的攻击,防御性招数,需要2颗心,有些人认为偏贵(比如作者)"<<endl;
            sleep(5);
            break;
        case 5:
            cout<<"世界末日,击败除高级盾和反弹外的一切,横扫千军!而且只要3颗心!"<<endl;
            sleep(5);
            break;
        default:
            system("cls");
            return;
    }
    system("cls");
    gfjs();
}
void zzjs()
{
    if(MessageBox(0,TEXT("你确定要看吗?"),TEXT("作者曰"),MB_OKCANCEL|MB_ICONINFORMATION)!=IDOK)
    {
        system("cls");
        return;
    }
    cout<<"作者简介:"<<endl;
    cout<<"姓:贾"<<endl;
    cout<<"名:自己猜!"<<endl;
    cout<<"最常用的“化名”:j2"<<endl;
    cout<<"最喜欢的动物:猫"<<endl;
    cout<<"口头禅:喵!!!"<<endl;
    sleep(10);
    system("cls");
    return;
}
void yxjj()
{
    cout<<"此游戏由曾在南京外国语学校仙林分校四年级13班火爆一时的包包心改编过来"<<endl;
    sleep(1.5);
    cout<<"此游戏为基础版,高级版请静待作者更新"<<endl;
    sleep(1.5);
    cout<<"作者在玩此游戏时曾用枪连续击败过敌人5次哦"<<endl;
    sleep(1.5);
    cout<<"不知道玩法可以在玩法介绍中查看哦"<<endl;
    system("pause");
    system("cls");
    return;
}
void yxjs()
{
    cout<<"请选择……"<<endl;
    sleep(1);
    cout<<"1.作者介绍 2.游戏简介 其他:退出此界面"<<endl;
    int n;
    cin>>n;
    switch(n)
    {
        case 1:
            zzjs();
            break;
        case 2:
            yxjj();
            break;
        default:
            system("cls");
            return;
    }
    yxjs();
}
void gzjs()
{
    cout<<"此游戏玩法:"<<endl;
    sleep(1);
    cout<<"1.出心即可获取心"<<endl;
    sleep(1);
    cout<<"2.拥有足够的心后,可以出各种攻击对战,双方同时出击!"<<endl;
    sleep(1);
    cout<<"3.所有攻击在真实包包心中为手势,但在这里只能是文字"<<endl;
    sleep(1);
    cout<<"4.对方攻击你你当回合若防御住则无伤!"<<endl;
    sleep(1);
    cout<<"5.只要攻击成功,对方就会输掉!"<<endl;
    system("pause");
    gfjs();
}
void wx()
{
    myh=5;
    comh=2; 
    int j=0;
    while(1)
    {
        j++;
        cout<<"请问您要出什么?(心、盾、枪、高级盾、世界末日、反弹)"<<endl;
        cout<<"你剩余心数:"<<myh<<endl;
        cout<<"计算机剩余心数:"<<comh<<endl;
        cin>>myt;
        if(f(myt))
        {
            cout<<"犯规,你已输"<<endl; 
            cout<<"You lose!"<<endl;
            sleep(4);
            system("cls");
            break;
        }
        cout<<"本轮计算机使用了";
        switch(comh)
        {
            case 0:
                if(myh-1==0)
                {
                    comt="心";
                    cout<<comt<<endl;
                    if(win(comt,myt)=='m')
                    {
                        cout<<"电脑失败!"<<endl;
                        cout<<"You win!"<<endl;
                        sleep(4);
                        system("cls");
                        return;
                    }
                    xc(comt,myt);
                }
                else
                {
                    comt=comm[rand()%2+1];
                    cout<<comt<<endl;
                    if(win(comt,myt)=='m')
                    {
                        cout<<"电脑失败!"<<endl;
                        cout<<"You win!"<<endl;
                        sleep(4);
                        system("cls");
                        return; 
                    }
                    xc(comt,myt);
                }
                break;
            case 1:
                if(myh>=3)
                {
                    comt=comm[rand()%4+1];
                }
                else
                {
                    comt=comm[rand()%3+1];
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                xc(comt,myt);
                break;
            case 2:
                comt=comm[rand()%5+1];
                if(myh-1==0&&comt=="反弹")
                {
                    comt=comm[rand()%4+1];
                }
                if(myh<3&&comt=="高级盾")
                {
                    comt="盾"; 
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                xc(comt,myt);
                break;
            default:
                comt=comm[rand()%6+1];
                if(myh-1==0&&comt=="反弹")
                {
                    comt=comm[rand()%4+1];
                }
                if(myh<3&&comt=="高级盾")
                {
                    comt="盾"; 
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                xc(comt,myt);
                break;
        }
    }
}
void gd()
{
    int j=0;
    myh=0;
    comh=3;
    while(1)
    {
        j++;
        cout<<"请问您要出什么?(心、盾、枪、高级盾、世界末日、反弹)"<<endl;
        cout<<"你剩余心数:"<<myh<<endl;
        cout<<"计算机剩余心数:"<<comh<<endl;
        cin>>myt;
        cout<<"本轮计算机使用了";
        switch(comh)
        {
            case 0:
                if(myh-1==0)
                {
                    comt="心";
                    cout<<comt<<endl;
                    if(win(comt,myt)=='m')
                    {
                        cout<<"电脑失败!"<<endl;
                        cout<<"You win!"<<endl;
                        sleep(4);
                        system("cls");
                        return;
                    }
                    bxc(comt,myt);
                }
                else
                {
                    comt=comm[rand()%2+1];
                    cout<<comt<<endl;
                    if(win(comt,myt)=='m')
                    {
                        cout<<"电脑失败!"<<endl;
                        cout<<"You win!"<<endl;
                        sleep(4);
                        system("cls");
                        return; 
                    }
                    bxc(comt,myt);
                }
                break;
            case 1:
                if(myh>=3)
                {
                    comt=comm[rand()%4+1];
                }
                else
                {
                    comt=comm[rand()%3+1];
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                bxc(comt,myt);
                break;
            case 2:
                comt=comm[rand()%5+1];
                if(myh-1==0&&comt=="反弹")
                {
                    comt=comm[rand()%4+1];
                }
                if(myh<3&&comt=="高级盾")
                {
                    comt="盾"; 
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                bxc(comt,myt);
                break;
            default:
                comt=comm[rand()%6+1];
                if(myh-1==0&&comt=="反弹")
                {
                    comt=comm[rand()%4+1];
                }
                if(myh<3&&comt=="高级盾")
                {
                    comt="盾"; 
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                if(comh>=4&&comt=="心")
                {
                    comt="枪";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                bxc(comt,myt);
                break;
        }
    }
    return;
}
void k1(int t)
{
    myh=comh=t;
    int j=0;
    while(1)
    {
        j++;
        cout<<"请问您要出什么?(心、盾、枪、高级盾、世界末日、反弹)"<<endl;
        cout<<"你剩余心数:"<<myh<<endl;
        cout<<"计算机剩余心数:"<<comh<<endl;
        cin>>myt;
        if(f(myt))
        {
            cout<<"犯规,你已输"<<endl; 
            cout<<"You lose!"<<endl;
            sleep(4);
            system("cls");
            break;
        }
        cout<<"本轮计算机使用了";
        switch(comh)
        {
            case 0:
                if(myh-1==0)
                {
                    comt="心";
                    cout<<comt<<endl;
                    if(win(comt,myt)=='m')
                    {
                        cout<<"电脑失败!"<<endl;
                        cout<<"You win!"<<endl;
                        sleep(4);
                        system("cls");
                        return;
                    }
                    xc(comt,myt);
                }
                else
                {
                    comt=comm[rand()%2+1];
                    cout<<comt<<endl;
                    if(win(comt,myt)=='m')
                    {
                        cout<<"电脑失败!"<<endl;
                        cout<<"You win!"<<endl;
                        sleep(4);
                        system("cls");
                        return; 
                    }
                    xc(comt,myt);
                }
                break;
            case 1:
                if(myh>=3)
                {
                    comt=comm[rand()%4+1];
                }
                else
                {
                    comt=comm[rand()%3+1];
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                xc(comt,myt);
                break;
            case 2:
                comt=comm[rand()%5+1];
                if(myh-1==0&&comt=="反弹")
                {
                    comt=comm[rand()%4+1];
                }
                if(myh<3&&comt=="高级盾")
                {
                    comt="盾"; 
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                xc(comt,myt);
                break;
            default:
                comt=comm[rand()%6+1];
                if(myh-1==0&&comt=="反弹")
                {
                    comt=comm[rand()%4+1];
                }
                if(myh<3&&comt=="高级盾")
                {
                    comt="盾"; 
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                if(comh>=4&&comt=="心")
                {
                    comt="枪";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"你失败!"<<endl;
                    cout<<"You lose!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                xc(comt,myt);
                break;
        }
    }
}
void wd()
{
    myh=comh=0;
    int j=0;
    while(1)
    {
        j++;
        cout<<"请问您要出什么?(心、盾、枪、高级盾、世界末日、反弹)"<<endl;
        cout<<"你剩余心数:"<<myh<<endl;
        cout<<"计算机剩余心数:"<<comh<<endl;
        cin>>myt;
        if(f(myt))
        {
            cout<<"犯规,你已输"<<endl; 
            cout<<"You lose!"<<endl;
            sleep(4);
            system("cls");
            break;
        }
        cout<<"本轮计算机使用了";
        switch(comh)
        {
            case 0:
                if(j==1||myh-1==0)
                {
                    comt="心";
                    cout<<comt<<endl;
                    if(win(comt,myt)=='m')
                    {
                        cout<<"电脑失败!"<<endl;
                        cout<<"You win!"<<endl;
                        sleep(4);
                        system("cls");
                        return;
                    }
                    xc(comt,myt);
                }
                else
                {
                    comt=comm[rand()%2+1];
                    cout<<comt<<endl;
                    if(win(comt,myt)=='m')
                    {
                        cout<<"电脑失败!"<<endl;
                        cout<<"You win!"<<endl;
                        sleep(4);
                        system("cls");
                        return; 
                    }
                    xc(comt,myt);
                }
                break;
            case 1:
                if(myh>=3)
                {
                    comt=comm[rand()%4+1];
                }
                else
                {
                    comt=comm[rand()%3+1];
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"无敌buff触发!"<<endl;
                    sleep(1.5);
                }
                xc(comt,myt);
                break;
            case 2:
                comt=comm[rand()%5+1];
                if(myh-1==0&&comt=="反弹")
                {
                    comt=comm[rand()%4+1];
                }
                if(myh<3&&comt=="高级盾")
                {
                    comt="盾"; 
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"无敌buff触发!"<<endl;
                    sleep(1.5);
                }
                xc(comt,myt);
                break;
            default:
                comt=comm[rand()%6+1];
                if(myh-1==0&&comt=="反弹")
                {
                    comt=comm[rand()%4+1];
                }
                if(myh<3&&comt=="高级盾")
                {
                    comt="盾"; 
                }
                if(myh==0&&comt=="盾")
                {
                    comt="心";
                }
                cout<<comt<<endl;
                if(win(comt,myt)=='m')
                {
                    cout<<"电脑失败!"<<endl;
                    cout<<"You win!"<<endl;
                    sleep(4);
                    system("cls");
                    return; 
                }
                if(win(comt,myt)=='c')
                {
                    cout<<"无敌buff触发!"<<endl;
                    sleep(1.5);
                }
                xc(comt,myt);
                break;
        }
    }
    return;
}
void wgchoose()
{
    int n;
    system("cls");
    cout<<"请选择 外挂 游戏模式:"<<endl;
    sleep(1);
    cout<<"1.超多心模式(电脑2心) 2.攻击倒贴心模式 3.开局双方获得n心模式 4.无敌模式 其他:立即退出"<<endl;
    cin>>n;
    switch(n)
    {
        case 1:
            wx();
            break;
        case 2:
            gd();
            break;
        case 3:
            int t;
            cout<<"开局获得多少心?(1~3)";
            cin>>t;
            k1(t);
            break;
        case 4:
            wd();
            break;
        default:
            return;
    }
    wgchoose();
}
void choose()
{
    system("cls");
    int n;
    string str;
    cout<<"请选择游戏模式:"<<endl;
    sleep(1);
    cout<<"1.你VS计算机 2.你VS作者 3.你VS匹配对手 4.介绍规则(新手请输入4) 5.游戏介绍 6.退出游戏 7.击败作者攻略(需要密码解锁,我才不愿意让你那么轻松的看到!) 未知.隐藏模式"<<endl;
    cin>>n;
    switch(n)
    {
        case 1:
            com();
            break;
        case 2:
            writer();
            break;
        case 3:
            cout<<"作者还未开发出此功能,先玩玩别的吧"<<endl;
            sleep(1.5);
            system("cls");
            choose();
            break;
        case 4:
            gzjs();
            choose();
            break;
        case 5:
            yxjs();
            choose();
            break;
        case 6:
            exit(0);
        case 7:
            MessageBox(0,TEXT("想看打败我的方法,哼!\n你倒是输入密码啊?"),TEXT("作者曰"),MB_OK);
            cout<<"密码?"<<endl;
            cin>>str;
            if(str=="C++1415926")
            {
                cout<<"密码正确"<<endl;
                sleep(1.5);
                system("cls");
                kill_writer_g();
                choose();
                break;
            }
            else
            {
                cout<<"密码错误!还想看怎么击败我?!"<<endl;
                sleep(3);
                system("cls");
                choose();
            }
        case 37:
            cout<<"你竟然发现了隐藏模式——外挂模式!"<<endl;
            sleep(3);
            wgchoose();
            break;
        default:
            cout<<"你都不想玩吗?那你就退出算了"<<endl;
            sleep(1);
            cout<<"什么?你想玩?"<<endl;
            sleep(1);
            system("cls");
            choose();
            break;
    }
    choose();
}
int main()
{
    string p;
    cout<<setw(64)<<"包 包 心 内 测 版"<<endl;
    cout<<setw(64)<<" 全部完成后公开 "<<endl;
    MessageBox(0,TEXT("如果你不知道密码,请不要乱输!"),TEXT("作者忠告"),MB_OK);
    cout<<"请输入密码:";
    cin>>p;
    if(p=="1415926")
    {
        for(int k=1;k<=5;k++)
        {
            system("cls");
            sleep(0.1);
            cout<<"loading......"<<endl;
            cout<<"加载中......"<<endl;
            sleep(1);
        }
        system("cls");
        cout<<"登录成功"<<endl;
        sleep(2);
        system("cls");
        cout<<"欢迎进入游戏"<<endl;
        sleep(1);
        cout<<"此游戏持续加工中,目前暂未完全完成,还可能会出现bug,请体谅!"<<endl;
        sleep(3.5);
        system("cls");
        choose();
    }
    else
    {
        MessageBox(0,TEXT("嘿,你到底是不是内部人员?\n我知道了!"),TEXT("愤怒的作者曰"),MB_OK); 
        cout<<"你不是内部人员,滚吧!"<<endl;
        sleep(1);
        cout<<"还得我请你?";
        sleep(1);
    }
    return 0;
}```