c++狼人杀12人标准场有发言有选警附exe文件

· · 休闲·娱乐

当前最新版:v.1.8.3

标题是不是非常的美好~~,作为狼人杀玩家,应该都懂c++上你能玩到什么,但是,没有发言的狼人杀是没有精髓的!!! 所以,本人尝试着写了一点套路化、模板化的发言,就是希望可以摆脱我以前玩过的c++狼人杀一局游戏只能靠猜来投票,没有什么游戏体验。不过期望也不要太高,不会有点狼坑也不会有盘逻辑,这些太为难电脑和作者了。只是有简单的站边、投谁。

当然,本着自己写一个自己喜欢的游戏的原则,这里面有对跳预言家和狼队自刀啊倒钩啊绑票之类的东西。虽然不指望电脑可以随机得多高端,但是基本的游戏环境还是可以的。1个人和11个电脑随机控制的玩,电脑是没有透视天眼什么的,全凭概率。

由于作者水平原因,游戏可能有茫茫多的bug。尤其集中在站边以及发言投票板块,可能一局好端端的游戏被整一下心态都要炸了。所以我就加了个重新随机身份的道具,聊以补偿。你也可以在文件里要多少输入多少,开心就好~~~。

如果你觉得实在玩不赢,还有开天眼功能,当然,狼人杀开天眼赢也没什么意思:)。开的方法游戏里有。

整体码量还是挺大,目前2600行,断断续续写了一个月吧。

bug多啊,想说可以留言,有时间就改改。

创作思路

游戏主体

while循环不断反复日夜同时判断结束。选警单独写。

站边凭借概率加上查杀金水警徽流银水等带来的隐性条件,投票同站边的预言家

预言家通过发言顺序、报验人、警徽流确定归票。

除预言家的不会进行归票,就算有警徽也一样。

女巫猎人有对跳会先带对跳,其次是概率带狼。

主界面

很好实现(相对而言)。有再加个评分系统的想法。

感谢

网上搜都可以看到的狼人杀online(就是6~12个人那个,应该都见过)。我水平有限,“存活”“已死亡”的彩色字体和号码牌显示是借鉴的。所以我也不太好挂资源上收费。以下是有借鉴的代码段,不得不说写的真高端~~~

Link

一点感慨:开源为他人搭建了一个站在巨人肩上的位置,我们以此为基却早就不知其模样。

网上有太多声称原创的了,没法@就在此手动ღ( ´・ᴗ・` )比心~~~

想了想,还是把代码放上来吧。如果哪一天在别人收录的什么c++小游戏合集、机房颓废的人的电脑上看到了自己的程序应该也是一件开心的事吧。(虽然没人知道就是了)

附代码一份,后续有更新的话也会改。只不过经常鸽~~

编译选项请开启

-std=c++14 
BY:mRXxy0o0

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#pragma GCC optimize(2)
using namespace std;
const int cnt_templat=2,cnt_gailv=24,cnt_daoju=1;
const string templat[cnt_templat]={"12人预女猎白\n","12人石像鬼守墓人\n"};
const string jobs[cnt_templat][12]={{"平民","平民","平民","平民","预言家","女巫","猎人","白痴","狼人","狼人","狼人","狼人"},{"平民","平民","平民","平民","预言家","女巫","猎人","守墓人","狼人","狼人","狼人","石像鬼"}}; 
int mode,gailv[cnt_gailv+1],job_pos[5],id_dat,cnt_night,cnt_day,jinghui,my,langdao,cnt_life,cnt_wol;
int chushigl[cnt_gailv+1],daoju[cnt_daoju+1],gp[13],cp;
vector<pair<int,bool> >ck_res;
vector<int>side,silver,killby[13],goldby[13],starby[13],dead,wolf;
bool admit;
int TLE;
struct node{
    int id,show,star1,star2,ckwho,team,chsize;
    bool alive,check,up_star,up_yu,ckres,bs;
    string job;
}player[13];
struct hapen{
    int who,been;
    string what,what1;
}date[100];
struct tp{
    int tot,id;
}tou[13];
void devide(int tim){
    for(int i=1;i<=120;i++) printf("-"),Sleep(tim);
    cout<<"\n";
}
bool is_in(vector<int> tt,int x){
    for(int a:tt)
        if(a==x) return 1;
    return 0;
}
bool cmp(tp x,tp y){
    return x.tot>y.tot;
}
bool crdd(int x,int y){
    return is_in(dead,y);
}
void init_chushigl(){
    int t=0;
    chushigl[++t]=55;
    chushigl[++t]=10;
    chushigl[++t]=45;
    chushigl[++t]=45;
    chushigl[++t]=20;
    chushigl[++t]=15;
    chushigl[++t]=70;
    chushigl[++t]=50;
    chushigl[++t]=10;
    chushigl[++t]=30;
    chushigl[++t]=10;
    chushigl[++t]=60;
    chushigl[++t]=40;
    chushigl[++t]=80;
    chushigl[++t]=20;
    chushigl[++t]=10;
    chushigl[++t]=99;
    chushigl[++t]=40;
    chushigl[++t]=80;
    chushigl[++t]=85;
    chushigl[++t]=60;
    chushigl[++t]=80;
    chushigl[++t]=80;
    chushigl[++t]=50; 
}
void print_gailv(){
    int t=0;
    cout<<t<<". 好人站边正确概率(指不开视角的好人选择预言家的正确率):"<<gailv[++t]<<"% + (游戏天数-1) x 5%\n";
    cout<<t<<". 好人改票概率(指好人听完发言后改变站边概率):"<<gailv[++t]<<"%\n";
    cout<<t<<". 女巫毒狼概率(非首夜且无对跳):"<<gailv[++t]<<"%\n";
    cout<<t<<". 猎人带狼概率(无对跳):"<<gailv[++t]<<"%\n";
    cout<<t<<". 预言家无警徽流时验狼概率(非首夜):"<<gailv[++t]<<"%\n";
    cout<<t<<". 白痴被狼人抗推概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 狼人刀神概率(非首夜):"<<gailv[++t]<<"%\n";
    cout<<t<<". 狼人悍跳发查杀概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 狼人悍跳发预言家查杀概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 狼人悍跳发神查杀概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 狼人悍跳发狼人查杀概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 一狼悍跳概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 两狼悍跳概率(100% - 一狼悍跳概率):"<<gailv[++t]<<"%\n";
    cout<<t<<". 两狼上警概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 三狼上警概率(100% - 两狼上警概率):"<<gailv[++t]<<"%\n";
    cout<<t<<". 狼人自刀概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 女巫首夜使用解药概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 狼人倒钩概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 女巫上警概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 发金水站边概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 被打警徽流站边概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 狼人被查杀时跳神概率:"<<gailv[++t]<<"%\n";
    cout<<t<<". 狼人被查杀时跳女巫概率(不然就是猎人):"<<gailv[++t]<<"%\n";
    cout<<t<<". 狼人跳女巫发队友银水概率(不然就发好人):"<<gailv[++t]<<"%\n";
    devide(0);
    cout<<"注:所有概率为玩家不为该角色时,电脑自动决策的概率\n";
} 
void print_daoju(){
    int t=0;
    cout<<t<<". 【道具卡-再抽一次】 x "<<daoju[++t]<<"\n";
}
void tuichu(string pos){
    system("cls");
    system("color fc");
    cout<<"程序陷入死循环,即将退出,会以【道具卡-再抽一次】补偿\n:)\n";
    cout<<"exit code:"<<pos<<"\n";
    devide(10);
    system("pause");
    exit(0);
}
bool is_over(){
    int god_cnt=0,per_cnt=0,wol_cnt=0;
    for(int i=1;i<=12;i++){
        if(player[i].alive){
            if(player[i].job=="狼人") wol_cnt++;
            else if(player[i].job=="平民") per_cnt++;
            else god_cnt++;
        }
    }
    if(!god_cnt||!per_cnt){
        system("cls");
        system("color fc");
        cout<<"游戏结束,狼人胜利!\n";
        return 1;
    }
    if(!wol_cnt){
        system("cls");
        system("color fc");
        cout<<"游戏结束,好人胜利!\n";
        return 1;
    }
    return 0;
}
void fupan(){
    devide(0);
    for(int i=1;i<=12;i++) {
        cout<<i<<"号位:"<<player[i].job<<"\n";
    }
    for(int i=1;i<=id_dat;i++){
        if(date[i].what=="第 ") devide(0);
        if(date[i].who!=-1) cout<<date[i].who;
        cout<<date[i].what;
        if(date[i].been!=-1) cout<<date[i].been;
        cout<<date[i].what1;
    }
    devide(0);
    system("pause");
}
namespace yunvliebai{
    int duwho,hate_lr,hate_nv,upwu_cnt;
    bool jieyao,duyao,bcf,up_truewu;
    void print(int ti,int str){
        HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
        if(ti)
            SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY);
        else
            SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
        if(ti) cout << "\t\t\t第" << cnt_day << "天 \n";
        else cout << "\t\t\t第" << cnt_night << "晚 \n";
        cout << "我的位置:" << my << "号" << endl;
        for(int i = 1; i <= 6; i++)
            cout << i << "号位 ";
        puts("");
        for(int i=1;i<=6;i++){
            if(player[i].alive){
                if(ti){
                    if((str==1&&player[i].up_star)||(str==2&&player[i].up_yu)||jinghui==i) SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                    else SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_GREEN);
                }
                else{
                    if((str==1&&player[i].up_star)||(str==2&&player[i].up_yu)||jinghui==i) SetConsoleTextAttribute(handle, FOREGROUND_RED | FOREGROUND_GREEN);
                    else SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_GREEN);
                }
                printf("存活  ");
            }
            else{
                if(ti)
                    SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_RED);
                else
                    SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED);
                cout<<"已死亡 ";
            }
        }
        if(ti)
            SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY);
        else
            SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
        puts("");
        for(int i=1;i<=6;i++){
            if(my==i||admit){
                cout<<player[i].job<<" ";
                if(player[i].job!="预言家") cout<<" ";
                continue;
            }
            if(job_pos[4]==i&&bcf){
                cout<<"白痴 ";
                continue;
            }
            if(!player[i].show)
                cout << "未知  ";
            else{
                if(is_in(wolf,i))
                    cout << "狼人  ";
                else
                    cout << "好人  ";
            }
        }
        cout<<"\n\n";
        for(int i=7;i<=12;i++)
            cout << i << "号位 ";
        puts("");
        for(int i=7;i<=12;i++){
            if(player[i].alive){
                if(ti){
                    if((str==1&&player[i].up_star)||(str==2&&player[i].up_yu)||jinghui==i) SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
                    else SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_GREEN);
                }
                else{
                    if((str==1&&player[i].up_star)||(str==2&&player[i].up_yu)||jinghui==i) SetConsoleTextAttribute(handle, FOREGROUND_RED | FOREGROUND_GREEN);
                    else SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_GREEN);
                }
                cout << "存活  ";
            }
            else{
                if(ti)
                    SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_RED);
                else
                    SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED);
                cout<< "已死亡 ";
            }
            if(i>=10) cout<<" ";
        }
        if(ti)
            SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY);
        else
            SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
        puts("");
        for(int i=7;i<=12;i++){
            if(my==i||admit){
                cout<<player[i].job<<" ";
                if(player[i].job!="预言家") cout<<" ";
                if(i>=10) cout<<" ";
                continue;
            }
            if(job_pos[4]==i&&bcf){
                cout<<"白痴 ";
                continue;
            }
            if(!player[i].show)
                cout << "未知  ";
            else{
                if(is_in(wolf,i))
                    cout << "狼人  ";
                else
                    cout << "好人  ";
            }
            if(i>=10) cout<<" ";
        }
        cout<<"\n\n";
    }
    void character(){
        rech:system("cls");
        bool fg[13]={0};
        int t;
        for(int i=0;i<12;i++){
            do t=rand()%12+1;
            while(fg[t]);
            fg[t]=1;
            player[t].id=t,player[t].alive=true,player[t].job=jobs[mode][i],player[t].check=false,player[t].show=false;
            player[t].up_star=0,player[t].up_yu=0;
            player[t].star1=player[t].star2=0;
            player[t].ckwho=0,player[t].ckres=0;
            player[t].team=0,player[t].chsize=0;
            player[t].bs=0;
        }
        for(int i=1;i<=12;i++){
            if(player[i].job=="预言家") job_pos[1]=i;
            else if(player[i].job=="女巫") job_pos[2]=i;
            else if(player[i].job=="猎人") job_pos[3]=i;
            else if(player[i].job=="白痴") job_pos[4]=i;
        }
        cout<<"随机编号为:";
        my=rand()%12+1;
        cout<<my<<"\n";
        cout<<"你的身份是:"<<player[my].job<<"\n";
        if(player[my].job=="狼人")
            for(int i=1;i<=12;i++)
                if(player[i].job=="狼人") player[i].show=true;
        if(admit){
            for(int i=1;i<=6;i++) cout<<player[i].job<<"  ";
            cout<<"\n";
            for(int i=7;i<=12;i++) cout<<player[i].job<<"  ";
            cout<<"\n";
        }
        devide(0);
        if(daoju[1]){
            cout<<"你当前拥有【道具卡-再抽一次】x "<<daoju[1]<<",1.使用   2.不使用\n";
            cin>>t; 
            if(t==1){
                daoju[1]--;
                fstream fs;
                fs.open("狼人杀Data.txt",ios::out);
                for(int i=1;i<=cnt_gailv;i++) fs<<gailv[i]<<" ";
                fs<<"\n";
                for(int i=1;i<=cnt_daoju;i++) fs<<daoju[i]<<" ";
                fs<<"\n"<<0<<"\n";
                fs.close();
                goto rech;
            }
        }
        system("pause");
        fstream fs;
        fs.open("狼人杀Data.txt",ios::out);
        for(int i=1;i<=cnt_gailv;i++) fs<<gailv[i]<<" ";
        fs<<"\n";
        for(int i=1;i<=cnt_daoju;i++) fs<<daoju[i]<<" ";
        fs<<"\n"<<1<<"\n";
        fs.close();
        for(int i=1;i<=12;i++){
            if(player[i].job=="狼人"||player[i].job=="石像鬼"){
                wolf.push_back(i);
            }
        }
    }
    void be_nv(int x){
        upwu_cnt++;
        cout<<"跳女巫,";
        if(silver.size()) cout<<"刀口 ";
        else cout<<"无刀口 ";
        if(player[x].job!="女巫"){
            for(int i=1;i<=silver.size();i++){
                int t=rand()%100+1;
                if(t<=gailv[24]){
                    int t1=rand()%12+1;
                    TLE=0;
                    while(player[t1].job!="狼人"||t1==x){
                        t1=rand()%12+1;
                        TLE++;
                        if(TLE>100000) tuichu("悍跳女巫发狼人银水");
                    }
                    cout<<t1<<"号 ";
                }
                else{
                    int t1=rand()%12+1;
                    TLE=0;
                    while(player[t1].job=="狼人"){
                        t1=rand()%12+1;
                        TLE++;
                        if(TLE>100000) tuichu("悍跳女巫发好人银水");
                    }
                    cout<<t1<<"号 ";
                }
            }
            puts("");
            hate_nv=x;
            for(int a:killby[x]) goldby[job_pos[2]].push_back(a);
            for(int a:goldby[x]) killby[job_pos[2]].push_back(a);
        }
        else{
            up_truewu=1;
            for(int a:silver) cout<<a<<"号 ";
            puts("");
        }
    }
    void be_lr(int x){
        cout<<"跳猎人\n";
        if(player[x].job!="猎人"){
            hate_lr=x;
            for(int a:killby[x]) goldby[job_pos[3]].push_back(a);
            for(int a:goldby[x]) killby[job_pos[3]].push_back(a);
        }
    }
    void say_water(int x){//平民跳神挡刀?? 
        if(player[x].up_yu) cout<<"我可是真预啊\n";
        else if(player[x].job=="狼人"){
            int t=rand()%100+1;
            if(t<=gailv[22]&&(upwu_cnt<=1||player[x].alive)){
                int t1=rand()%100+1;
                if(t1<=gailv[23]&&upwu_cnt<=1){
                    be_nv(x);
                }
                else be_lr(x);
            }
            else cout<<"跳民\n";
        }
        else if(player[x].job=="女巫") be_nv(x);
        else if(player[x].job=="猎人") be_lr(x);
        else if(player[x].job=="白痴") cout<<"跳白痴\n";
        else cout<<"跳民\n";
    }
    void speak(int x){
        if(x==my){
            int chose,t,t1;
            if(player[x].up_yu){
                chose=MessageBox(NULL,"是否自动填充昨晚验人信息","发言引导",MB_YESNO|MB_ICONINFORMATION);
                if(chose==6&&player[x].job=="预言家"){
                    cout<<player[x].ckwho;
                    if(player[x].ckres){
                        cout<<"金水,";
                        goldby[player[x].ckwho].push_back(x);
                    }
                    else{
                        cout<<"查杀,";
                        if(!player[player[x].ckwho].bs) player[player[x].ckwho].bs=killby[player[x].ckwho].empty();
                        killby[player[x].ckwho].push_back(x);
                    }
                }
                else{
                    MessageBox(NULL,"请在主界面输入昨晚查验的人","发言引导",MB_OK|MB_ICONINFORMATION);
                    cin>>t;
                    chose=MessageBox(NULL,"他的身份是好人?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                    if(chose==6){
                        cout<<"金水,";
                        goldby[t].push_back(x);
                    }
                    else{
                        cout<<"查杀,";
                        if(!player[t].bs) player[t].bs=killby[t].empty();
                        killby[t].push_back(x);
                    }
                }
                if(jinghui==my){
                    cout<<"警徽流";
                    MessageBox(NULL,"请在主界面输入警徽流","发言引导",MB_OK|MB_ICONINFORMATION);
                    cin>>t>>t1;
                    cout<<"顺验\n";
                    player[x].star1=t;
                    starby[t].push_back(x);
                    player[x].star2=t1;
                    starby[t1].push_back(x);
                }
                cout<<"号票出";
                MessageBox(NULL,"请在主界面输入归票","发言引导",MB_OK|MB_ICONINFORMATION);
                cin>>t;
                gp[x]=t;
            }
            else{
                if(player[x].bs){
                    chose=MessageBox(NULL,"你已被查杀,是否拍身份?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                    if(chose==6){
                        player[x].bs=0;
                        chose=MessageBox(NULL,"是否填充真实身份?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                        cout<<"跳"; 
                        if(chose==6){
                            cout<<player[x].job<<"\n";
                        }
                        else{
                            MessageBox(NULL,"请在主界面输入身份","发言引导",MB_OK|MB_ICONINFORMATION);
                            string tt;
                            cin>>tt;
                            if(tt=="猎人"){
                                hate_lr=x;
                                for(int a:killby[x]) goldby[job_pos[3]].push_back(a);
                                for(int a:goldby[x]) killby[job_pos[3]].push_back(a);
                            }
                            else if(tt=="女巫"){
                                cout<<",刀口 ";
                                MessageBox(NULL,"请在主界面输入刀口","发言引导",MB_OK|MB_ICONINFORMATION);
                                string tt1;
                                cin>>tt1;
                                cout<<"号\n";
                                hate_nv=x;
                                for(int a:killby[x]) goldby[job_pos[2]].push_back(a);
                                for(int a:goldby[x]) killby[job_pos[2]].push_back(a);
                            }
                        }
                    }
                }
                else{
                    chose=MessageBox(NULL,"是否拍身份?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                    if(chose==6){
                        player[x].bs=0;
                        chose=MessageBox(NULL,"是否填充真实身份?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                        cout<<"跳"; 
                        if(chose==6){
                            cout<<player[x].job<<"\n";
                        }
                        else{
                            MessageBox(NULL,"请在主界面输入身份","发言引导",MB_OK|MB_ICONINFORMATION);
                            string tt;
                            cin>>tt;
                            if(tt=="猎人"){
                                hate_lr=x;
                                for(int a:killby[x]) goldby[job_pos[3]].push_back(a);
                                for(int a:goldby[x]) killby[job_pos[3]].push_back(a);
                            }
                            else if(tt=="女巫"){
                                cout<<",刀口 ";
                                MessageBox(NULL,"请在主界面输入刀口","发言引导",MB_OK|MB_ICONINFORMATION);
                                string tt1;
                                cin>>tt1;
                                cout<<"号\n";
                                hate_nv=x;
                                for(int a:killby[x]) goldby[job_pos[2]].push_back(a);
                                for(int a:goldby[x]) killby[job_pos[2]].push_back(a);
                            }
                        }
                    }
                }
                cout<<"站边";
                MessageBox(NULL,"请在主界面输入站边","发言引导",MB_OK|MB_ICONINFORMATION);
                cin>>t;
                cout<<"挂票";
                MessageBox(NULL,"请在主界面输入准备投的人","发言引导",MB_OK|MB_ICONINFORMATION);
                cin>>t;
                cout<<"号\n";
                gp[x]=t; 
            }
            devide(10);
            return ;
        }
        if(is_in(wolf,x)&&(2*cnt_wol>cnt_life||(2*cnt_wol==cnt_life&&(!jinghui||player[jinghui].job=="狼人")))){//狼队绑票 
            if(!cp){
                cp=rand()%12+1;
                TLE=0;
                while(!player[cp].alive||player[cp].job=="狼人"){
                    cp=rand()%12+1;
                    TLE++;
                    if(TLE>100000) tuichu("狼队绑票");
                }
            }
            gp[x]=cp;
            cout<<"认狼\n出"<<cp<<"号\n";
            devide(10);
            return ;
        }
        if(player[x].up_yu){
            int t,f=0;
            cout<<player[x].ckwho;
            if(player[x].ckres){
                cout<<"金水,";
                goldby[player[x].ckwho].push_back(x);
            }
            else{
                cout<<"查杀,";
                if(!player[player[x].ckwho].bs) player[player[x].ckwho].bs=killby[player[x].ckwho].empty();
                killby[player[x].ckwho].push_back(x);
            }
            t=rand()%12+1;//逐个确定 
            if(side.size()>1){
                TLE=0;
                while(!is_in(side,t)||t==x){
                    t=rand()%12+1;
                    TLE++;
                    if(TLE>100000) tuichu("起跳预当晚有查杀归票");
                }
                gp[x]=t;
            }
            else{
                if(player[x].job=="预言家"){
                    int f=0;
                    for(pair<int,bool> aa:ck_res){
                        if(!aa.second&&player[aa.first].alive){
                            f=1;
                            gp[x]=aa.first;
                            break;
                        }
                    }
                    if(!f){
                        int t1=rand()%100+1,icnt=0;
                        for(int j=1;j<=12;j++) if(player[j].alive&&!is_in(wolf,j)&&!player[j].check&&j!=x) icnt++;
                        if(t1<=gailv[1]+(cnt_day-1)*5&&icnt){
                            TLE=0;
                            while(!player[t].alive||!is_in(wolf,t)){
                                t=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("起跳预概率归票狼人");
                            }
                        }
                        else{
                            TLE=0;
                            while(!player[t].alive||is_in(wolf,t)||(t==job_pos[4]&&bcf)||t==x||player[t].check){
                                t=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("起跳预概率归票好人");
                            }
                        }
                        gp[x]=t;
                    }
                }
                else{
                    if(!player[x].ckres&&player[player[x].ckwho].alive) gp[x]=player[x].ckwho;
                    else{
                        int t1=rand()%100+1;
                        if(t1<=gailv[6]&&!bcf&&player[job_pos[4]].alive){
                            gp[x]=job_pos[4];
                        }
                        else{
                            TLE=0;
                            while(!player[t].alive||is_in(wolf,t)||(t==job_pos[4]&&cnt_life-cnt_wol>1)||t==player[x].ckwho){
                                t=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("悍跳预归票好人");
                            }
                            gp[x]=t;
                        }
                    }
                }
            }
            cout<<"号票出"<<gp[x]<<"\n";
            if(is_in(side,player[x].star2)||!player[player[x].star2].alive||(player[x].star2==job_pos[4]&&bcf)||player[player[x].star2].check||player[x].star2==player[x].star1||gp[x]==player[x].star2){
                t=rand()%12+1;
                TLE=0;
                while(is_in(side,t)||!player[t].alive||(t==job_pos[4]&&bcf)||player[t].check||gp[x]==t){
                    t=rand()%12+1;
                    TLE++;
                    if(TLE>100000) tuichu("改第二警徽流");
                }
                player[x].star2=t;
                f=1;
            }
            if(is_in(side,player[x].star1)||!player[player[x].star1].alive||(player[x].star1==job_pos[4]&&bcf)||player[player[x].star1].check||gp[x]==player[x].star1){
                player[x].star1=player[x].star2;
                t=rand()%12+1;
                TLE=0;
                while(is_in(side,t)||!player[t].alive||(t==job_pos[4]&&bcf)||t==player[x].star1||player[t].check||gp[x]==t){
                    t=rand()%12+1;
                    TLE++;
                    if(TLE>100000) tuichu("改第一警徽流");
                }
                player[x].star2=t;
                f=1;
            }
            if(jinghui==x){
                if(f) cout<<"改";
                cout<<"警徽流"<<player[x].star1<<" "<<player[x].star2<<"顺验\n"; 
            }
            devide(10);
            return ;
        }
        if(player[x].bs) say_water(x),player[x].bs=0;
        cout<<"站边"<<player[x].team<<"\n";
        if(x==job_pos[2]&&hate_nv){
            be_nv(x);
        }
        if(x==job_pos[3]&&hate_lr){
            be_lr(x);
        }
        cout<<"挂票";
        if(gp[player[x].team]&&gp[player[x].team]!=x&&player[gp[player[x].team]].alive){
            cout<<gp[player[x].team]<<"号\n";
            gp[x]=gp[player[x].team];
        }
        else{
            if(side.size()-is_in(side,player[x].team)>0){
                int t=rand()%12+1;
                TLE=0;
                while(!is_in(side,t)||t==player[x].team||(t==job_pos[4]&&bcf)){
                    t=rand()%12+1;
                    TLE++;
                    if(TLE>100000) tuichu("重新站边");
                }
                cout<<t<<"号\n";
                gp[x]=t;
            }
            else{
                int t=rand()%100+1,t2=rand()%100+1;
                if(t<=gailv[1]+5*(cnt_day-1)&&(!is_in(wolf,x)||(cnt_wol>2&&t2<=gailv[18]))&&(cnt_wol>1||player[player[x].team].job!="狼人")){
                    int t1=rand()%12+1;
                    TLE=0;
                    while(!player[t1].alive||!is_in(wolf,t1)||t1==player[x].team||t1==x){
                        t1=rand()%12+1;
                        TLE++;
                        if(TLE>100000) tuichu("站边已死,概率投狼");
                    }
                    cout<<t1<<"号\n";
                    gp[x]=t1;
                }
                else{
                    int t1=rand()%12+1,nono=0;
                    while(!player[t1].alive||is_in(wolf,t1)||(t1==job_pos[4]&&bcf)||t1==player[x].team||t1==x){
                        t1=rand()%12+1;
                        nono++;
                        if(nono>1000) break;
                    }
                    TLE=0;
                    if(nono>1000)
                        while(!player[t1].alive||!is_in(wolf,t1)||t1==player[x].team||t1==x){
                            t1=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("站边已死,概率投好人却只能投狼");
                        }
                    cout<<t1<<"号\n";
                    gp[x]=t1;
                }
            }
        }
        devide(10); 
    }
    void speak_star(int x){
        if(x==my){
            int chose,t,t1;
            chose=MessageBox(NULL,"是否跳预言家","发言引导",MB_YESNO|MB_ICONINFORMATION);
            if(chose==6){
                chose=MessageBox(NULL,"是否自动填充昨晚验人信息","发言引导",MB_YESNO|MB_ICONINFORMATION);
                if(chose==6&&(player[x].job=="预言家"||player[x].up_yu)){
                    cout<<player[x].ckwho;
                    if(player[x].ckres){
                        cout<<"金水,";
                        goldby[player[x].ckwho].push_back(x);
                    }
                    else{
                        cout<<"查杀,";
                        player[player[x].ckwho].bs=killby[player[x].ckwho].empty();
                        killby[player[x].ckwho].push_back(x);
                    }
                }
                else{
                    MessageBox(NULL,"请在主界面输入昨晚查验的人","发言引导",MB_OK|MB_ICONINFORMATION);
                    cin>>t;
                    chose=MessageBox(NULL,"他的身份是好人?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                    if(chose==6){
                        cout<<"金水,";
                        goldby[t].push_back(x);
                    }
                    else{
                        cout<<"查杀,";
                        if(!player[t].bs) player[t].bs=killby[t].empty();
                        killby[t].push_back(x);
                    }
                }
                cout<<"警徽流";
                MessageBox(NULL,"请在主界面输入两个警徽流","发言引导",MB_OK|MB_ICONINFORMATION);
                cin>>t>>t1;
                cout<<"顺验\n";
                player[x].star1=t;
                player[x].star2=t1;
                starby[t].push_back(x);
                starby[t1].push_back(x);
                player[x].up_yu=1;
                side.push_back(x);
            }
            else{
                if(player[x].bs){
                    chose=MessageBox(NULL,"你已被查杀,是否拍身份?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                    if(chose==6){
                        player[x].bs=0;
                        chose=MessageBox(NULL,"是否填充真实身份?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                        cout<<"跳"; 
                        if(chose==6){
                            cout<<player[x].job<<"\n";
                        }
                        else{
                            MessageBox(NULL,"请在主界面输入身份","发言引导",MB_OK|MB_ICONINFORMATION);
                            string tt;
                            cin>>tt;
                            if(tt=="猎人"){
                                hate_lr=x;
                                for(int a:killby[x]) goldby[job_pos[3]].push_back(a);
                                for(int a:goldby[x]) killby[job_pos[3]].push_back(a);
                            }
                            else if(tt=="女巫"){
                                cout<<",刀口 ";
                                MessageBox(NULL,"请在主界面输入刀口","发言引导",MB_OK|MB_ICONINFORMATION);
                                string tt1;
                                cin>>tt1;
                                cout<<"号\n";
                                hate_nv=x;
                                for(int a:killby[x]) goldby[job_pos[2]].push_back(a);
                                for(int a:goldby[x]) killby[job_pos[2]].push_back(a);
                            }
                        }
                    }
                }
                cout<<"站边";
                MessageBox(NULL,"请在主界面输入站边,0为后置位预言家","发言引导",MB_OK|MB_ICONINFORMATION);
                cin>>t;
                if(!t) cout<<"后置位预言家";
                cout<<"\n"<<x<<"号玩家退水\n";
            }
            devide(10);
            return ;
        }
        if(player[x].ckwho){
            player[x].team=x;
            if(!player[x].star1){
                int t1=rand()%12+1;
                TLE=0;
                while(t1==x||t1==player[x].ckwho||player[t1].up_star){
                    t1=rand()%12+1;
                    TLE++;
                    if(TLE>100000) tuichu("选择第一警徽流(警上)");
                }
                player[x].star1=t1;
                t1=rand()%12+1;
                TLE=0;
                while(t1==x||t1==player[x].ckwho||t1==player[x].star1||is_in(side,t1)){
                    t1=rand()%12+1;
                    TLE++;
                    if(TLE>100000) tuichu("选择第二警徽流(警上)");
                }
                player[x].star2=t1;
            }
            cout<<player[x].ckwho;
            if(player[x].ckres){
                cout<<"金水,";
                goldby[player[x].ckwho].push_back(x);
            }
            else{
                cout<<"查杀,";
                if(!player[player[x].ckwho].bs) player[player[x].ckwho].bs=killby[player[x].ckwho].empty();
                killby[player[x].ckwho].push_back(x);
            }
            cout<<"警徽流"<<player[x].star1<<" "<<player[x].star2<<"顺验\n";
            starby[player[x].star1].push_back(x);
            starby[player[x].star2].push_back(x);
    //      player[x].ckwho=0;
            side.push_back(x);
            devide(30);
            return ;
        }
        if(player[x].bs) say_water(x),player[x].bs=0;
        if(is_in(wolf,x)){
            if(!side.size()){
                cout<<"划水过麦,警下站边\n"<<x<<"号玩家退水\n";
                devide(5);
            }
            else{
                int t=rand()%100+1;
                if(t<=gailv[18]&&!is_in(killby[x],job_pos[1])){//倒钩+垫飞 
                    player[x].team=job_pos[1];
                }
                else if(side.size()-is_in(side,job_pos[1])-killby[x].size()+is_in(killby[x],job_pos[1])>0){
                    int t1=rand()%12+1;
                    TLE=0;
                    while(!is_in(side,t1)||is_in(killby[x],t1)||t1==job_pos[1]){
                        t1=rand()%12+1;
                        TLE++;
                        if(TLE>100000) tuichu("狼人不站预言家(警上)");
                    }
                    player[x].team=t1;
                }
                if(player[x].team&&is_in(side,player[x].team)) cout<<"站边"<<player[x].team<<"\n";
                else cout<<"站边后置位预言家\n";
                cout<<x<<"号玩家退水\n";
                devide(15);
            }
            player[x].chsize=side.size();//站边时的视角大小 
            return ;
        }
        if(player[x].job=="女巫"&&langdao==x){
            cout<<"女巫被首刀,昨晚盲毒"<<duwho<<"\n";
            if(!side.size()){
                devide(15);
                return ;
            }
        }
        if(!side.size()){
            cout<<"划水过麦,警下站边\n"<<x<<"号玩家退水\n";
            devide(5);
        }
        else{
            int kb=0;
            for(int a:side){
                if(is_in(killby[x],a)){
                    kb=a;
                    continue;
                }
                if(player[x].job=="女巫"&&is_in(silver,a)){//你永远无法理解的银水情结 
                    player[x].team=a;
                    break;
                }
                if(is_in(goldby[x],a)){//金水 
                    int t=rand()%100+1;
                    if(t<=gailv[20]){
                        player[x].team=a;
                        break;
                    }
                }
                if(is_in(starby[x],a)){//警徽流 
                    int t=rand()%100+1;
                    if(t<=gailv[21]){
                        player[x].team=a;
                        break;
                    }
                }
            }
            if(!player[x].team){//正常站边 
                int t=rand()%100+1;
                if(t<=gailv[1]+(cnt_day-1)*5){//站真预 
                    if(is_in(side,job_pos[1])){
                        player[x].team=job_pos[1];
                    }
                }
                else{//钻狼队 
                    if((int)side.size()-is_in(side,job_pos[1])-(int)killby[x].size()>0){
                        int t1=rand()%12+1;
                        TLE=0;
                        while(!is_in(side,t1)||player[t1].job=="预言家"){
                            t1=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("不站真预(警上)");
                        }
                        player[x].team=t1;
                    }
                    else if(is_in(side,job_pos[1])) player[x].team=job_pos[1];
                }
            }
            if(player[x].team) cout<<"站边"<<player[x].team<<"\n";
            else cout<<"站边后置位预言家\n";
            cout<<x<<"号玩家退水\n";
            devide(15);
        }
        player[x].chsize=side.size();//站边时的视角大小 
    }
    void zb(int x){//视角全面时的站边 
        if(side.size()-killby[x].size()==1){
            for(int a:side)
                if(!is_in(killby[x],a)){
                    player[x].team=a;
                    gp[x]=gp[a];
                    break;
                }
            player[x].chsize=side.size();//站边时的视角大小
            return ;
        }
        if(player[x].job=="狼人"){
            int t=rand()%100+1;
            if((t<=gailv[18]||killby[x].size()>=2)&&is_in(side,job_pos[1])){//倒钩+垫飞
                player[x].team=job_pos[1];
            }
            else{
                if(side.size()-1-killby[x].size()+is_in(killby[x],job_pos[1])>0){
                    int t1=rand()%12+1;
                    TLE=0;
                    while(!is_in(side,t1)||is_in(killby[x],t1)||t1==job_pos[1]){
                        t1=rand()%12+1;
                        TLE++;
                        if(TLE>100000) tuichu("狼人不站真预");
                    }
                    player[x].team=t1;
                }
                else player[x].team=job_pos[1];
            }
            player[x].chsize=side.size();//站边时的视角大小
            gp[x]=gp[player[x].team];
            return ;
        }
        for(int a:side){
            if(is_in(killby[x],a)){
                continue;
            }
            if(player[x].job=="女巫"&&is_in(silver,a)){//你永远无法理解的银水情结 
                player[x].team=a;
                break;
            }
            if(is_in(goldby[x],a)){//金水 
                int t=rand()%100+1;
                if(t<=gailv[20]){
                    player[x].team=a;
                    break;
                }
            }
            if(is_in(starby[x],a)){//警徽流 
                int t=rand()%100+1;
                if(t<=gailv[21]){
                    player[x].team=a;
                    break;
                }
            }
        }
        if(!player[x].team){//正常站边 
            int t=rand()%100+1;
            if(t<=gailv[1]+(cnt_day-1)*5&&is_in(side,job_pos[1])){//站真预 
                player[x].team=job_pos[1];
            }
            else{//钻狼队 
                if(side.size()-1-killby[x].size()>0){
                    int t1=rand()%12+1;
                    TLE=0;
                    while(!is_in(side,t1)||player[t1].job=="预言家"||is_in(killby[x],t1)){
                        t1=rand()%12+1;
                        TLE++;
                        if(TLE>100000) tuichu("好人不站真预");
                    }
                    player[x].team=t1;
                }
                else{
                    player[x].team=job_pos[1];
                }
            }
        }
        gp[x]=gp[player[x].team];
        player[x].chsize=side.size();//站边时的视角大小 
    }
    //接金水、查杀时的站边
    //投票 
    //警徽有悍跳狼 
    void star_day(){
        system("cls");
        system("color F0");
        date[++id_dat].who=-1;
        date[id_dat].what="第 ";
        date[id_dat].been=++cnt_day;
        date[id_dat].what1=" 天-竞选警长\n";
        print(1,0);
        int star_cnt=rand()%9,t;
        for(int i=1;i<=star_cnt;i++){
            t=rand()%12+1;
            TLE=0;
            while(player[t].job=="狼人"||player[t].up_star){
                t=rand()%12+1;
                TLE++;
                if(TLE>100000) tuichu("概率选好人上警");
            }
            player[t].up_star=1;
        }
        player[job_pos[1]].up_star=1;
        int tt=rand()%100+1;
        if(!player[job_pos[2]].alive||tt<=gailv[19]) player[job_pos[2]].up_star=1;
        if(player[my].job!="狼人"){
            cout<<"1.上警 2.不上警\n";
            cin>>t;
            player[my].up_star=2-t;
        }
        system("cls");
        print(1,1);
        star_cnt=0;
        for(int i=1;i<=12;i++){
            if(player[i].up_star) cout<<i<<"号 ",star_cnt++;
        }
        cout<<"共"<<star_cnt<<"人上警\n";
        if(star_cnt==12||!star_cnt){
            cout<<"警徽流失\n";
            date[++id_dat].who=-1;
            date[id_dat].what="";
            date[id_dat].been=star_cnt;
            date[id_dat].what1="人上警,警徽流失\n";
            return ;
        }
        devide(20);
        int pos=rand()%12+1,dit=rand()%2;
        TLE=0;
        while(!player[pos].up_star){
            pos=rand()%12+1;
            TLE++;
            if(TLE>100000) tuichu("随机选警发言第一个");
        }
        cout<<"随机从"<<pos<<"号开始";
        if(dit) cout<<"顺序发言\n";
        else cout<<"逆序发言\n",dit=-1;
        devide(20);
        for(int i=1;i<=star_cnt;i++,pos+=dit){
            if(pos>12) pos=1;
            if(pos<1) pos=12;
            TLE=0;
            while(!player[pos].up_star){
                pos+=dit;
                if(pos>12) pos=1;
                if(pos<1) pos=12;
                TLE++;
                if(TLE>100000) tuichu("找到下一个选警发言者");
            }
            cout<<pos<<"号玩家发言:\n";
            speak_star(pos);
        }
        system("pause");
        system("cls");
        print(1,2);
        int my_tou;
        if(!player[my].up_star){
            MessageBox(NULL,"请在主界面输入投票对象","发言引导",MB_OK|MB_ICONINFORMATION);
            cout<<"当前起跳预言家:";
            for(int a:side) cout<<a<<"号 ";
            cout<<"\n";
            cin>>my_tou;
            system("cls");
            print(1,2);
        }
        memset(tou,0,sizeof tou);
        for(int i=1;i<=12;i++){
            tou[i].id=i;
            if(!player[i].up_star){
                zb(i);
                if(i==my){
                    cout<<i<<"号 投票-> "<<my_tou<<"号\n";
                    tou[my_tou].tot+=2;
                }
                else{
                    cout<<i<<"号 投票-> "<<player[i].team<<"号\n";
                    tou[player[i].team].tot+=2;
                }
                Sleep(50);
            }
        }
        devide(2);
        sort(tou+1,tou+1+12,cmp);
        if(tou[1].tot>tou[2].tot){
            cout<<tou[1].id<<"号当选警长\n\n";
            jinghui=tou[1].id;
            date[++id_dat].who=tou[1].tot/2;
            date[id_dat].what="票   票选->   ";
            date[id_dat].been=jinghui;
            date[id_dat].what1="("+player[jinghui].job+")警长\n";
        }
        else{
            cout<<"平票,请在 ";
            vector<int>hst;
            for(int i=1;i<=12;i++){
                if(tou[i].tot==tou[1].tot) hst.push_back(tou[i].id);
            }
            sort(hst.begin(),hst.end());
            for(int a:hst) cout<<a<<"号 ";
            cout<<"中再次投票\n";
            devide(10);
            int f=1;
            for(int a:hst)
                if(a==my){
                    f=0;
                    break;
                }
            if(f){
                MessageBox(NULL,"请在主界面输入投票对象","发言引导",MB_OK|MB_ICONINFORMATION);
                cin>>my_tou;
                puts("");
            }
            memset(tou,0,sizeof tou);
            for(int i=1;i<=12;i++){
                tou[i].id=i;
                int f=1;
                for(int a:hst)
                    if(a==i){
                        f=0;
                        break;
                    }
                if(f){
                    int t=rand()%100+1;
                    if(player[i].chsize<side.size()||(t<=gailv[2]&&player[i].job!="狼人")) zb(i);
                    if(i==my){
                        if(is_in(hst,my_tou)){
                            cout<<i<<"号 投票-> "<<my_tou<<"号\n";
                            tou[my_tou].tot+=2;
                        }
                        else cout<<i<<"号弃票\n";
                    }
                    else{
                        if(is_in(hst,player[i].team)){
                            cout<<i<<"号 投票-> "<<player[i].team<<"号\n";
                            tou[player[i].team].tot+=2;
                        }
                        else cout<<i<<"号弃票\n";
                    }
                    Sleep(50);
                }
            }
            devide(2);
            sort(tou+1,tou+1+12,cmp);
            if(tou[1].tot>tou[2].tot){
                cout<<tou[1].id<<"号当选警长\n\n";
                jinghui=tou[1].id;
                date[++id_dat].who=tou[1].tot/2;
                date[id_dat].what="票   票选->   ";
                date[id_dat].been=jinghui;
                date[id_dat].what1="("+player[jinghui].job+")警长\n";
            }
            else{
                cout<<"平票,警徽流失\n";
                date[++id_dat].who=-1;
                date[id_dat].what="警徽流失\n";
                date[id_dat].been=-1;
                date[id_dat].what1="";
            }
        }
    }

    void night(){
        system("cls");
        system("color 0F");
        date[++id_dat].who=-1;
        date[id_dat].what="第 ";
        date[id_dat].been=++cnt_night;
        date[id_dat].what1=" 晚\n";
        print(0,0);
        int t;
        langdao=0,duwho=0;
        if(player[my].job=="预言家"&&player[my].alive){
            cout<<"请输入要查验的编号:\n";
            cin>>t;
            while(!player[t].alive||t==my||player[t].check){
                cout<<"输入错误\n";
                cin>>t;
            }
            date[++id_dat].who=my;
            date[id_dat].what="(预言家)   查验 ->   ";
            date[id_dat].been=t;
            player[t].check=true;
            player[my].ckwho=t;
            cout<<"他的身份是:";
            if(player[t].job=="狼人"){
                cout<<"狼人\n";
                player[my].ckres=0;
                date[id_dat].what1="(狼人)\n";
            }
            else{
                cout<<"好人\n";
                player[my].ckres=1;
                date[id_dat].what1="("+player[t].job+")\n";
            }
        }
        else if(player[job_pos[1]].alive){
            int tmp,s1=player[job_pos[1]].star1,s2=player[job_pos[1]].star2;
            player[job_pos[1]].up_yu=1;
            if(s1&&player[s1].alive&&!player[s1].check&&!player[s1].up_yu) tmp=s1,player[job_pos[1]].star1=0;
            else if(s2&&player[s2].alive&&!player[s2].check&&!player[s2].up_yu) tmp=s2,player[job_pos[1]].star2=0;
            else{
                if(cnt_night==1){
                    tmp=rand()%12+1;
                    TLE=0;
                    while(tmp==job_pos[1]){
                        tmp=rand()%12+1;
                        TLE++;
                        if(TLE>100000) tuichu("预言家首夜验人");
                    }
                }
                else{
                    t=rand()%100+1;
                    if(t<=gailv[5]){
                        tmp=rand()%12+1;
                        TLE=0;
                        while(!player[tmp].alive||player[tmp].job=="预言家"||player[tmp].check||player[tmp].job!="狼人"){
                            tmp=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("预言家夜晚查狼");
                        }
                    }
                    else{
                        tmp=rand()%12+1;
                        TLE=0;
                        while(!player[tmp].alive||player[tmp].job=="预言家"||player[tmp].check||player[tmp].job=="狼人"||(tmp==job_pos[4]&&bcf)){
                            tmp=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("预言家夜晚查好人");
                        }
                    }
                }
            }
            date[++id_dat].who=job_pos[1];
            date[id_dat].what="(预言家)   查验 ->   ";
            date[id_dat].been=tmp;
            player[tmp].check=1;
            player[job_pos[1]].ckwho=tmp;
            if(player[tmp].job=="狼人"){
                ck_res.push_back({tmp,false});
                player[job_pos[1]].ckres=0;
                date[id_dat].what1="(狼人)\n";
            }
            else{
                ck_res.push_back({tmp,true});
                player[job_pos[1]].ckres=1;
                date[id_dat].what1="("+player[tmp].job+")\n";
            }
        }
        if(player[my].job=="狼人"&&player[my].alive){
            if(cnt_night==1){
                cout<<"确定狼队上警人数:\n";
                cin>>t;
                for(int i=1;i<=t;i++){
                    cout<<"指定第"<<i<<"个上警狼人编号:\n";
                    int t1;
                    cin>>t1;
                    while(player[t1].job!="狼人"||player[t1].up_star){
                        cout<<"输入错误\n";
                        cin>>t1;
                    }
                    player[t1].up_star=1;
                }
                cout<<"确定悍跳狼个数(0~2)(小于等于上警人数):\n";
                cin>>t;
                for(int i=1;i<=t;i++){
                    cout<<"指定第"<<i<<"个悍跳狼人编号:\n";
                    int t1,t2,t3;
                    cin>>t1;
                    while(player[t1].job!="狼人"||player[t1].up_yu||!player[t1].up_star){
                        cout<<"输入错误\n";
                        cin>>t1;
                    }
                    player[t1].up_yu=1;
                    cout<<"指定发 1.查杀 2.金水:\n";
                    cin>>t2;
                    cout<<"给几号:\n";
                    cin>>t3;
                    player[t1].ckwho=t3;
                    player[t1].ckres=t2-1;
                    cout<<"指定警徽流为(两个人): \n";
                    cin>>t2>>t3;
                    player[t1].star1=t2;
                    player[t1].star2=t3;
                }
            }
            devide(0);
            cout<<"选择刀谁:\n";
            cin>>langdao;
            while(!player[langdao].alive){
                cout<<"输入错误\n";
                cin>>langdao;
            }
            date[++id_dat].who=-1;
            date[id_dat].what="狼人   狼刀 ->   ";
            date[id_dat].been=langdao;
            date[id_dat].what1="("+player[langdao].job+")\n";
        }
        else{
            if(cnt_night==1){
                t=rand()%100+1;
                int t1,t2,t3,t4,t5,t6;
                if(t<=gailv[14]){
                    for(int i=1;i<=2;i++){
                        t1=rand()%12+1;
                        TLE=0;
                        while(player[t1].job!="狼人"||player[t1].up_star){
                            t1=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("首夜随机2狼人上警");
                        }
                        player[t1].up_star=1;
                    }
                    t2=rand()%12+1;
                    TLE=0;
                    while(player[t2].job!="狼人"||!player[t2].up_star){
                        t2=rand()%12+1;
                        TLE++;
                        if(TLE>100000) tuichu("首夜狼人随机悍跳");
                    }
                    player[t2].up_yu=1;
                    t3=rand()%100+1;//发查杀
                    if(t3<=gailv[8]){
                        t4=rand()%100+1;//查杀神
                        if(t4<=gailv[10]){
                            t5=rand()%100+1;//查杀预
                            if(t5<=gailv[9]){
                                player[t2].ckwho=job_pos[1];
                                player[t2].ckres=0;
                            }
                            else{
                                t6=rand()%3+2;
                                player[t2].ckwho=job_pos[t6];
                                player[t2].ckres=0;
                            }
                        }
                        else if(t4<=gailv[10]+gailv[11]){
                            t5=rand()%12+1;
                            TLE=0;
                            while(player[t5].job!="狼人"||t5==t2){
                                t5=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("首夜狼查杀狼");
                            }
                            player[t2].ckwho=t5;
                            player[t2].ckres=0;
                        }
                        else{
                            t5=rand()%12+1;
                            TLE=0;
                            while(player[t5].job!="平民"){
                                t5=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("首夜狼查杀民");
                            }
                            player[t2].ckwho=t5;
                            player[t2].ckres=0;
                        }
                    }
                    else{
                        t4=rand()%12+1;
                        TLE=0;
                        while(t4==t2){
                            t4=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("首夜狼发金水");
                        }
                        player[t2].ckwho=t4;
                        player[t2].ckres=1;
                    }
                }
                else{
                    for(int i=1;i<=3;i++){
                        t1=rand()%12+1;
                        TLE=0;
                        while(player[t1].job!="狼人"||player[t1].up_star){
                            t1=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("首夜随机3狼人上警");
                        }
                        player[t1].up_star=1;
                    }
                    t1=rand()%100+1;//悍跳个数
                    if(t1<=gailv[12]) t1=1;
                    else t1=2;
                    for(int i=1;i<=t1;i++){
                        t2=rand()%12+1;
                        TLE=0;
                        while(player[t2].job!="狼人"||!player[t2].up_star){
                            t2=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("首夜狼人随机悍跳-3");
                        }
                        player[t2].up_yu=1;
                        t3=rand()%100+1;//发查杀 
                        if(t3<=gailv[8]){
                            t4=rand()%100+1;//查杀神 
                            if(t4<=gailv[10]){
                                t5=rand()%100+1;//查杀预 
                                if(t5<=gailv[9]){
                                    player[t2].ckwho=job_pos[1];
                                    player[t2].ckres=0;
                                }
                                else{
                                    t6=rand()%3+2;
                                    player[t2].ckwho=job_pos[t6];
                                    player[t2].ckres=0;
                                }
                            }
                            else if(t4<=gailv[10]+gailv[11]){
                                t5=rand()%12+1;
                                TLE=0;
                                while(player[t5].job!="狼人"||t5==t2){
                                    t5=rand()%12+1;
                                    TLE++;
                                    if(TLE>100000) tuichu("首夜狼查杀狼-3");
                                }
                                player[t2].ckwho=t5;
                                player[t2].ckres=0;
                            }
                            else{
                                t5=rand()%12+1;
                                TLE=0;
                                while(player[t5].job!="平民"){
                                    t5=rand()%12+1;
                                    TLE++;
                                    if(TLE>100000) tuichu("首夜狼查杀民-3");
                                }
                                player[t2].ckwho=t5;
                                player[t2].ckres=0;
                            }
                        }
                        else{
                            t4=rand()%12+1;
                            TLE=0;
                            while(t4==t2){
                                t4=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("首夜狼发金水-3");
                            }
                            player[t2].ckwho=t4;
                            player[t2].ckres=1;
                        }
                    }
                }
            }
            else{
                for(int i=1;i<=12;i++){
                    if(player[i].alive&&player[i].job=="狼人"&&player[i].up_yu){
                        int s1=player[i].star1,s2=player[i].star2;
                        if(s1&&player[s1].alive&&!player[s1].up_yu) player[i].ckwho=s1;
                        else if(s2&&player[s2].alive&&!player[s2].up_yu){
                            player[i].star1=s2;
                            player[i].star2=0;
                        }
                        else{
                            s1=rand()%12+1;
                            TLE=0;
                            while(!player[s1].alive||player[s1].up_yu||(s1==job_pos[4]&&bcf)){
                                s1=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("狼预随机验人");
                            }
                            player[i].star1=s1;
                        }
                        player[i].ckwho=player[i].star1;
                        int t1=rand()%100+1;
                        if(t1<=gailv[8]){
                            player[i].ckres=0;
                        }
                        else{
                            player[i].ckres=1;
                        }
                    }
                }
            }
            int t1=rand()%100+1,t2;
            if(t1<=gailv[16]&&cnt_night<=2&&jieyao&&player[job_pos[2]].alive){//自刀 
                langdao=rand()%12+1;
                TLE=0;
                while(!player[langdao].alive||player[langdao].job!="狼人"){
                    langdao=rand()%12+1;
                    TLE++;
                    if(TLE>100000) tuichu("自刀");
                }
            }
            else if(cnt_night>1){//刀神 
                t2=rand()%100+1;
                if(up_truewu&&player[job_pos[2]].alive) langdao=job_pos[2];
                else if(t2<=gailv[7]){
                    langdao=job_pos[rand()%4+1];
                    TLE=0;
                    while(!player[langdao].alive){
                        langdao=job_pos[rand()%4+1];
                        TLE++;
                        if(TLE>100000) tuichu("刀神");
                    }
                }
                else{
                    langdao=rand()%12+1;
                    TLE=0;
                    while(!player[langdao].alive||player[langdao].job!="平民"){
                        langdao=rand()%12+1;
                        TLE++;
                        if(TLE>100000) tuichu("刀民");
                    }
                }

            }
            else{//乱刀 
                langdao=rand()%12+1;
                TLE=0;
                while(!player[langdao].alive||player[langdao].job=="狼人"){
                    langdao=rand()%12+1;
                    TLE++;
                    if(TLE>100000) tuichu("乱刀");
                }
            }
            if(bcf&&player[job_pos[4]].alive) langdao=job_pos[4];
            date[++id_dat].who=-1;
            date[id_dat].what="狼人   狼刀 ->   ";
            date[id_dat].been=langdao;
            date[id_dat].what1="("+player[langdao].job+")\n";
        }
        if(admit){
            cout<<"狼队计划:\n";
            for(int i=1;i<=12;i++){
                if(player[i].job=="狼人"&&player[i].up_star){
                    if(cnt_night==1) cout<<i<<"上警\n";
                    if(player[i].up_yu){
                        cout<<i<<"发"<<player[i].ckwho;
                        if(player[i].ckres) cout<<"金水"<<"\n";
                        else cout<<"查杀"<<"\n";
                    }
                }
            }
        }
        if(player[my].job=="女巫"&&player[my].alive){
            if(jieyao) cout<<"昨晚,"<<langdao<<"号死了\n";
            nv:cout<<"1.使用解药  2.使用毒药 3.不使用\n";
            t=getch()-'0';
            cout<<t;
            puts("");
            if(t==1){
                if(!jieyao){
                    cout<<"你没有解药\n";
                    goto nv;
                }
                if(langdao==my){
                    cout<<"你不能自救\n";
                    goto nv;
                }
                date[++id_dat].who=my;
                date[id_dat].what="(女巫)   解药 ->   ";
                date[id_dat].been=langdao;
                date[id_dat].what1="("+player[langdao].job+")\n";
                langdao=0;
                jieyao=0;
            }
            else if(t==2){
                if(!duyao){
                    cout<<"你没有毒药\n";
                    goto nv;
                }
                int t1;
                cout<<"请输入要毒的编号:\n";
                cin>>t1;
                date[++id_dat].who=my;
                date[id_dat].what="(女巫)   毒药 ->   ";
                date[id_dat].been=t1;
                date[id_dat].what1="("+player[t1].job+")\n";
                duyao=0;
                duwho=t1;
            }
        }
        else if(player[job_pos[2]].alive){
            if(jieyao) silver.push_back(langdao);
            if(langdao==job_pos[2]){
                if(duyao){
                    duyao=0;
                    if(cnt_night==1){
                        t=rand()%12+1;
                        TLE=0;
                        while(t==job_pos[2]){
                            t=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("首夜女巫被刀盲毒");
                        }
                    }
                    else{
                        int t1=rand()%100+1;
                        if(t1<=gailv[3]){
                            t=rand()%12+1;
                            TLE=0;
                            while(!player[t].alive||player[t].job!="狼人"){
                                t=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("女巫被刀毒狼");
                            }
                        }
                        else{
                            t=rand()%12+1;
                            TLE=0;
                            while(!player[t].alive||player[t].job=="狼人"||t==job_pos[2]||(t==job_pos[4]&&bcf)){
                                t=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("女巫被刀毒好人");
                            }
                        }
                    }
                    if(hate_nv&&player[hate_nv].alive) t=hate_nv;
                    date[++id_dat].who=job_pos[2];
                    date[id_dat].what="(女巫)   毒药 ->   ";
                    date[id_dat].been=t;
                    date[id_dat].what1="("+player[t].job+")\n";
                    duwho=t;
                }
            }
            else{
                if(cnt_night==1){
                    t=rand()%100+1;
                    if(t<=gailv[17]){
                        jieyao=0;
                        date[++id_dat].who=job_pos[2];
                        date[id_dat].what="(女巫)   解药 ->   ";
                        date[id_dat].been=langdao;
                        date[id_dat].what1="("+player[langdao].job+")\n";
                        langdao=0;
                    }
                }
                else{
                    if(jieyao){
                        jieyao=0;
                        date[++id_dat].who=job_pos[2];
                        date[id_dat].what="(女巫)   解药 ->   ";
                        date[id_dat].been=langdao;
                        date[id_dat].what1="("+player[langdao].job+")\n";
                        langdao=0;
                    }
                    else if(duyao){
                        duyao=0;
                        int t1=rand()%100+1;
                        if(t1<=gailv[3]){
                            t=rand()%12+1;
                            TLE=0;
                            while(!player[t].alive||player[t].job!="狼人"){
                                t=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("女巫毒狼");
                            }
                        }
                        else{
                            t=rand()%12+1;
                            TLE=0;
                            while(!player[t].alive||player[t].job=="狼人"||(t==job_pos[4]&&bcf)||t==job_pos[2]){
                                t=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("女巫毒好人");
                            }
                        }
                        if(hate_nv&&player[hate_nv].alive) t=hate_nv;
                        date[++id_dat].who=job_pos[2];
                        date[id_dat].what="(女巫)   毒药 ->   ";
                        date[id_dat].been=t;
                        date[id_dat].what1="("+player[t].job+")\n";
                        duwho=t;
                    }
                }
            }
        }
        if(admit) for(int i=1;i<=id_dat;i++){
            if(date[i].who!=-1) cout<<date[i].who;
            cout<<date[i].what;
            if(date[i].been!=-1) cout<<date[i].been;
            cout<<date[i].what1;
        }
        system("pause");
        if(cnt_night==1) star_day();
    //  cin>>langdao>>duwho;
        dead.clear();
        if(langdao){
            player[langdao].alive=0;
            dead.push_back(langdao);
        }
        if(duwho&&duwho!=langdao){
            player[duwho].alive=0;
            dead.push_back(duwho);
        }
        int chose;
        if(langdao==job_pos[3]&&duwho!=job_pos[3]){
            int t1;
            if(my==job_pos[3]){
                chose=MessageBox(NULL,"你即将出局,是否带走一名玩家?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                if(chose==6){
                    MessageBox(NULL,"请在主界面输入带走对象","发言引导",MB_OK|MB_ICONINFORMATION);
                    cin>>t1;
                    dead.push_back(t1);
                    player[t1].alive=0;
                    cout<<t1<<"号被带走\n\n"; 
                    date[++id_dat].who=my;
                    date[id_dat].what="("+player[my].job+")   带走->   ";
                    date[id_dat].been=t1;
                    date[id_dat].what1="("+player[t1].job+")\n";
                }
            }
            else{
                if(hate_lr&&player[hate_lr].alive){
                    player[hate_lr].alive=0;
                    cout<<hate_lr<<"号被带走\n\n"; 
                    dead.push_back(hate_lr);
                    date[++id_dat].who=langdao;
                    date[id_dat].what="("+player[langdao].job+")   带走->   ";
                    date[id_dat].been=hate_lr;
                    date[id_dat].what1="("+player[hate_lr].job+")\n";
                }
                else{
                    t1=rand()%100+1;
                    if(t1<=gailv[4]){
                        int t2=rand()%12+1;
                        TLE=0;
                        while(!player[t2].alive||player[t2].job!="狼人"){
                            t2=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("猎人被刀带狼");
                        }
                        dead.push_back(t2);
                        player[t2].alive=0;
                        cout<<t2<<"号被带走\n\n"; 
                        date[++id_dat].who=langdao;
                        date[id_dat].what="("+player[langdao].job+")   带走->   ";
                        date[id_dat].been=t2;
                        date[id_dat].what1="("+player[t2].job+")\n";
                    }
                    else{
                        int t2=rand()%12+1;
                        TLE=0;
                        while(!player[t2].alive||player[t2].job=="狼人"||(t2==job_pos[4]&&bcf)){
                            t2=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("猎人被刀带好人");
                        }
                        dead.push_back(t2);
                        player[t2].alive=0;
                        cout<<t2<<"号被带走\n\n"; 
                        date[++id_dat].who=langdao;
                        date[id_dat].what="("+player[langdao].job+")   带走->   ";
                        date[id_dat].been=t2;
                        date[id_dat].what1="("+player[t2].job+")\n";
                    }
                }
            }
        }
        cout<<"昨晚";
        if(dead.size()){
            cout<<",";
            sort(dead.begin(),dead.end());
            for(int a:dead) cout<<a<<"号 ";
            cout<<"死亡,";
            for(int a:dead){
                if(a==jinghui){
                    cout<<"请"<<a<<"号玩家选择移交或撕掉警徽:\n";
                    if(a==my){
                        MessageBox(NULL,"请在主界面输入警徽的移交,0撕掉","发言引导",MB_OK|MB_ICONINFORMATION);
                        cin>>jinghui;
                    }
                    else if(player[a].up_yu){
                        if(player[a].job=="预言家"){
    //                      cout<<player[a].ckwho<<"\n";
                            for(int i=ck_res.size()-1;i>=0;i--){
                                if(ck_res[i].second&&player[ck_res[i].first].alive){
                                    jinghui=ck_res[i].first;
                                    break;
                                }
                            }
                        }
                        else{
                            if(cnt_wol==1) jinghui=0;
                            else{
                                int t1=rand()%12+1;
                                TLE=0;
                                while(!player[t1].alive||player[t1].job!="狼人"){
                                    t1=rand()%12+1;
                                    TLE++;
                                    if(TLE>100000) tuichu("狼预晚上倒牌移交警徽");
                                }
                                jinghui=t1;
                            }
                        }
                        if(player[a].ckwho!=jinghui) killby[player[a].ckwho].push_back(a);
                        else goldby[player[a].ckwho].push_back(a);
                    }
                    else if(player[a].job=="女巫"){
                        for(int aa:silver)
                            if(player[aa].alive){
                                jinghui=aa;
                                break;
                            }
                        if(jinghui==a){
                            int t1=rand()%12+1;
                            TLE=0;
                            while(!player[t1].alive){
                                t1=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("女巫晚上倒牌无银水移交警徽");
                            }
                            jinghui=t1;
                        }
                    }
                    else{
                        int t1=rand()%12+1;
                        TLE=0;
                        while(!player[t1].alive){
                            t1=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("其他人移交警徽");
                        }
                        jinghui=t1;
                    }
                    if(jinghui==a||!jinghui){
                        cout<<a<<"号玩家选择撕掉警徽\n",jinghui=0;
                        date[++id_dat].who=a;
                        date[id_dat].what="("+player[a].job+")   撕掉警徽->   x";
                        date[id_dat].been=-1;
                        date[id_dat].what1="\n";
                    }
                    else{
                        cout<<"警徽移交"<<jinghui<<"号玩家\n"; 
                        date[++id_dat].who=a;
                        date[id_dat].what="("+player[a].job+")   移交警徽->   ";
                        date[id_dat].been=jinghui;
                        date[id_dat].what1="("+player[jinghui].job+")\n";
                    }
                    if(player[a].up_yu&&jinghui!=player[a].ckwho&&player[a].star1==player[a].ckwho){
                        gp[a]=player[a].ckwho;
                    }
                    if(player[a].up_yu&&jinghui==player[a].ckwho&&player[a].star1==player[a].ckwho){
                        goldby[player[a].ckwho].push_back(a);
                    }
                    break;
                }
            }
            if(cnt_night==1){
                cout<<"请发表遗言:\n\n";
                for(int a:dead){
                    cout<<a<<"号玩家发言:\n";
                    if(a==my){
                        int chose=MessageBox(NULL,"你即将出局,是否拍身份?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                        if(chose==6){
                            chose=MessageBox(NULL,"是否填充真实身份?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                            cout<<"跳"; 
                            if(chose==6){
                                cout<<player[a].job<<"\n";
                            }
                            else{
                                MessageBox(NULL,"请在主界面输入身份","发言引导",MB_OK|MB_ICONINFORMATION);
                                string tt;
                                cin>>tt;
                                if(tt=="猎人"){
                                    hate_lr=a;
                                    for(int aa:killby[a]) goldby[job_pos[3]].push_back(aa);
                                    for(int aa:goldby[a]) killby[job_pos[3]].push_back(aa);
                                }
                                else if(tt=="女巫"){
                                    cout<<",刀口 ";
                                    MessageBox(NULL,"请在主界面输入刀口","发言引导",MB_OK|MB_ICONINFORMATION);
                                    string tt1;
                                    cin>>tt1;
                                    cout<<"号\n";
                                    hate_nv=a;
                                    for(int aa:killby[a]) goldby[job_pos[2]].push_back(aa);
                                    for(int aa:goldby[a]) killby[job_pos[2]].push_back(aa);
                                }
                            }
                        }
                    }
                    else say_water(a);
                    devide(10);
                }
            }
            else cout<<"没有遗言\n\n";
        }
        else{
            cout<<"是平安夜\n\n";
        }
        langdao=duwho=0;
        sort(side.begin(),side.end(),crdd);
        TLE=0;
        while(!side.empty()&&is_in(dead,side[side.size()-1])){
            side.pop_back();
            TLE++;
            if(TLE>100000) tuichu("夜晚起跳预死亡,去除此边");
        }
    //  cout<<"over\n";
        cnt_life=cnt_wol=0;
        for(int i=1;i<=12;i++){
            if(player[i].alive) cnt_life++;
            if(player[i].alive&&player[i].job=="狼人") cnt_wol++;
        }
        system("pause");
    }
    void day(){
        system("cls");
        system("color F0");
        cnt_day++;
        if(cnt_day!=cnt_night) cnt_day=cnt_night;
        date[++id_dat].who=-1;
        date[id_dat].what="第 ";
        date[id_dat].been=cnt_day;
        date[id_dat].what1=" 天\n";
        print(1,0);
        int pos,dit;
        if(jinghui){
            cout<<"请警长确定发言顺序:\n从";
            if(jinghui==my){
                int chose;
                chose=MessageBox(NULL,"是否顺序发言?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                if(chose==6) dit=1;
                else dit=0;
                if(my==job_pos[1]){
                    int cnt1=0,cnt2=0;
                    for(int i=jinghui;;i++){
                        if(i>12) i=1;
                        while(!player[i].alive){
                            i++;
                            if(i>12) i=1;
                        }
                        if(i==player[jinghui].ckwho) break;
                        cnt1++;
                    }
                    for(int i=jinghui;;i--){
                        if(i<1) i=12;
                        while(!player[i].alive){
                            i--;
                            if(i<1) i=12;
                        }
                        if(i==player[jinghui].ckwho) break;
                        cnt2++;
                    }
    //              cout<<cnt1<<" "<<cnt2<<"\n";
                    if(cnt_day>1){
                        int ditt;
                        if(cnt1>=cnt2) ditt=player[jinghui].ckres;
                        else ditt=1-player[jinghui].ckres;
                        if((player[jinghui].ckres&&ditt==dit)||(!player[jinghui].ckres&&ditt!=dit)) goldby[player[jinghui].ckwho].push_back(jinghui);
                        else killby[player[jinghui].ckwho].push_back(jinghui),gp[jinghui]=player[jinghui].ckwho;
                    }
                }
            }
            else if(player[jinghui].up_yu&&player[player[jinghui].ckwho].alive){
                int cnt1=0,cnt2=0;
    //          cout<<player[jinghui].ckwho<<" "<<player[jinghui].ckres<<"\n";
                for(int i=jinghui;;i++){
                    if(i>12) i=1;
                    while(!player[i].alive){
                        i++;
                        if(i>12) i=1;
                    }
                    if(i==player[jinghui].ckwho) break;
                    cnt1++;
                }
                for(int i=jinghui;;i--){
                    if(i<1) i=12;
                    while(!player[i].alive){
                        i--;
                        if(i<1) i=12;
                    }
                    if(i==player[jinghui].ckwho) break;
                    cnt2++;
                }
    //          cout<<cnt1<<" "<<cnt2<<"\n";
                if(cnt1>=cnt2) dit=player[jinghui].ckres;
                else dit=1-player[jinghui].ckres;
                if(cnt_day>1){
                    if(player[jinghui].ckres) goldby[player[jinghui].ckwho].push_back(jinghui);
                    else killby[player[jinghui].ckwho].push_back(jinghui),gp[jinghui]=player[jinghui].ckwho;
                }
            }
            else{
                dit=rand()%2;
            }
            if(!dit) dit=-1;
            pos=jinghui+dit;
            if(pos>12) pos=1;
            if(pos<1) pos=12;
            while(!player[pos].alive){
                pos+=dit;
                if(pos>12) pos=1;
                if(pos<1) pos=12;
            }
        }
        else{
            cout<<"随机从";
            pos=rand()%12+1;
            while(!player[pos].alive) pos=rand()%12+1;
            dit=rand()%2;
            if(!dit) dit=-1;
        }//隐性发金水 ,站边不打金水 
        cout<<pos<<"号开始";
        if(dit==1) cout<<"顺序发言\n";
        else cout<<"逆序发言\n";
        devide(10);
        int ccnt=0;
        for(int i=pos;;i+=dit){
            if(i>12) i=1;
            if(i<1) i=12;
            while(!player[i].alive){
                i+=dit;
                if(i>12) i=1;
                if(i<1) i=12;
            }
            if(i==pos&&ccnt) break;
            ccnt++;
            cout<<i<<"号玩家发言:\n";
            int t=rand()%100+1;
            if(!player[i].up_yu&&(player[i].chsize<side.size()||(t<=gailv[2]&&player[i].job!="狼人"))){
                zb(i);
            }
            speak(i);
        }
        system("pause");
        system("cls");
        print(1,0);
        int my_tou;
        if(player[my].alive){
            MessageBox(NULL,"请在主界面输入投票对象(0弃票)","发言引导",MB_OK|MB_ICONINFORMATION);
            cin>>my_tou;
            system("cls");
            print(1,0);
        }
        dead.clear();
        memset(tou,0,sizeof tou);
        for(int i=1;i<=12;i++){
            tou[i].id=i;
            if(player[i].alive){
                if(i==my){
                    if(!my_tou) cout<<i<<"号弃票\n";
                    else{
                        cout<<i<<"号 投票-> "<<my_tou<<"号\n";
                        tou[my_tou].tot+=2;
                        if(jinghui==my) tou[my_tou].tot++;
                    }
                }
                else{
                    int t=rand()%100+1;
                    if(!player[i].up_yu&&(player[i].chsize<side.size()||(t<=gailv[2]&&player[i].job!="狼人"))) zb(i);
                    int thou;
                    if(i==job_pos[2]&&duyao&&!jieyao&&hate_nv&&player[hate_nv].alive) thou=hate_nv;
                    else if(gp[player[i].team]&&gp[player[i].team]!=i) thou=gp[player[i].team];
                    else thou=gp[i];
                    if(cp&&player[i].job!="狼人"){
                        for(int i=1;i<=12;i++){
                            if(player[i].alive&&player[i].job=="狼人"){
                                thou=i;
                            }
                        }
                    }
                    if(!thou) cout<<i<<"号弃票\n";
                    else{
                        cout<<i<<"号 投票-> "<<thou<<"号\n";
                        tou[thou].tot+=2;
                        if(jinghui==i) tou[thou].tot++;
                    }
                }
                Sleep(50);
            }
        }
        devide(2);
        sort(tou+1,tou+1+12,cmp);
        int chose; 
        if(tou[1].tot>tou[2].tot){
            cout<<tou[1].id<<"号被投票放逐\n\n";
            dead.push_back(tou[1].id);
            player[tou[1].id].alive=0;
            date[++id_dat].who=tou[1].tot/2;
            if(tou[1].tot&1) date[id_dat].what=".5票   放逐->   ";
            else date[id_dat].what="票   放逐->   ";
            date[id_dat].been=tou[1].id;
            date[id_dat].what1="("+player[tou[1].id].job+")\n";
            if(tou[1].id==job_pos[3]){
                int t1;
                if(my==tou[1].id){
                    chose=MessageBox(NULL,"你即将出局,是否带走一名玩家?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                    if(chose==6){
                        MessageBox(NULL,"请在主界面输入带走对象","发言引导",MB_OK|MB_ICONINFORMATION);
                        cin>>t1;
                        dead.push_back(t1);
                        player[t1].alive=0;
                        cout<<t1<<"号被带走\n\n"; 
                        date[++id_dat].who=tou[1].id;
                        date[id_dat].what="("+player[tou[1].id].job+")   带走->   ";
                        date[id_dat].been=t1;
                        date[id_dat].what1="("+player[t1].job+")\n";
                    }
                }
                else{
                    if(hate_lr&&player[hate_lr].alive){
                        player[hate_lr].alive=0;
                        cout<<hate_lr<<"号被带走\n\n"; 
                        dead.push_back(hate_lr);
                        date[++id_dat].who=tou[1].id;
                        date[id_dat].what="("+player[tou[1].id].job+")   带走->   ";
                        date[id_dat].been=hate_lr;
                        date[id_dat].what1="("+player[hate_lr].job+")\n";
                    }
                    else{
                        t1=rand()%100+1;
                        if(t1<=gailv[4]){
                            int t2=rand()%12+1;
                            TLE=0;
                            while(!player[t2].alive||player[t2].job!="狼人"){
                                t2=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("猎人被投带狼"); 
                            }
                            dead.push_back(t2);
                            player[t2].alive=0;
                            cout<<t2<<"号被带走\n\n"; 
                            date[++id_dat].who=tou[1].id;
                            date[id_dat].what="("+player[tou[1].id].job+")   带走->   ";
                            date[id_dat].been=t2;
                            date[id_dat].what1="("+player[t2].job+")\n";
                        }
                        else{
                            int t2=rand()%12+1;
                            TLE=0;
                            while(!player[t2].alive||player[t2].job=="狼人"||(t2==job_pos[4]&&bcf)){
                                t2=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("猎人被投带好人");
                            }
                            dead.push_back(t2);
                            player[t2].alive=0;
                            cout<<t2<<"号被带走\n\n"; 
                            date[++id_dat].who=tou[1].id;
                            date[id_dat].what="("+player[tou[1].id].job+")   带走->   ";
                            date[id_dat].been=t2;
                            date[id_dat].what1="("+player[t2].job+")\n";
                        }
                    }
                }
            }
            if(tou[1].id==job_pos[4]&&!bcf){
                player[tou[1].id].alive=1;
                bcf=1;
                cout<<job_pos[4]<<"号白痴翻牌发动技能\n";
                dead.pop_back();
                date[++id_dat].who=tou[1].id;
                date[id_dat].what="   翻牌->   ";
                date[id_dat].been=tou[1].id;
                date[id_dat].what1="(白痴)\n";
            }
        }
        else{
            cout<<"平票,请在 ";
            vector<int>hst;
            for(int i=1;i<=12;i++){
                if(tou[i].tot==tou[1].tot) hst.push_back(tou[i].id);
            }
            sort(hst.begin(),hst.end());
            for(int a:hst) cout<<a<<"号 ";
            cout<<"中再次投票\n";
            devide(10);
            int f=1;
            for(int a:hst)
                if(a==my){
                    f=0;
                    break;
                }
            if(f&&player[my].alive){
                MessageBox(NULL,"请在主界面输入投票对象(0弃票)","发言引导",MB_OK|MB_ICONINFORMATION);
                cin>>my_tou;
            }
            memset(tou,0,sizeof tou);
            for(int i=1;i<=12;i++){
                tou[i].id=i;
                int f=1;
                for(int a:hst)
                    if(a==i){
                        f=0;
                        break;
                    }
                if(f&&player[i].alive){
                    int t=rand()%100+1;
                    if(i==my){
                        if(!my_tou) cout<<i<<"号弃票\n";
                        else{
                            if(is_in(hst,my_tou)){
                                cout<<i<<"号 投票-> "<<my_tou<<"号\n";
                                tou[my_tou].tot+=2;
                                if(jinghui==my) tou[my_tou].tot++;
                            }
                            else cout<<i<<"号弃票\n";
                        }
                    }
                    else{
                        if(!player[i].up_yu&&(player[i].chsize<side.size()||(t<=gailv[2]&&player[i].job!="狼人"))) zb(i);
                        int thou;
                        if(i==job_pos[2]&&duyao&&!jieyao&&hate_nv&&player[hate_nv].alive) thou=hate_nv;
                        else if(gp[player[i].team]&&gp[player[i].team]!=i) thou=gp[player[i].team];
                        else thou=gp[i];
                        if(cp&&player[i].job!="狼人"){
                            for(int i=1;i<=12;i++){
                                if(player[i].alive&&player[i].job=="狼人"){
                                    thou=i;
                                }
                            }
                        }
                        int ff=1,inw=0,ino=0;
                        for(int a:hst){
                            if(thou==a) ff=0;
                        }
                        if(ff){
                            int tt1=rand()%(int)hst.size();
                            thou=hst[tt1];
                        }
                        if(!thou||!is_in(hst,thou)) cout<<i<<"号弃票\n";
                        else{
                            cout<<i<<"号 投票-> "<<thou<<"号\n";
                            tou[thou].tot+=2;
                            if(jinghui==i) tou[thou].tot++;
                        }
                    }
                    Sleep(50);
                }
            }
            devide(2);
            sort(tou+1,tou+1+12,cmp);
            if(tou[1].tot>tou[2].tot){
                cout<<tou[1].id<<"号被投票放逐\n\n";
                player[tou[1].id].alive=0;
                dead.push_back(tou[1].id);
                date[++id_dat].who=tou[1].tot/2;
                if(tou[1].tot&1) date[id_dat].what=".5票   放逐->   ";
                else date[id_dat].what="票   放逐->   ";
                date[id_dat].been=tou[1].id;
                date[id_dat].what1="("+player[tou[1].id].job+")\n";
                if(tou[1].id==job_pos[3]){
                    int t1;
                    if(my==tou[1].id){
                        chose=MessageBox(NULL,"你即将出局,是否带走一名玩家?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                        if(chose==6){
                            MessageBox(NULL,"请在主界面输入带走对象","发言引导",MB_OK|MB_ICONINFORMATION);
                            cin>>t1;
                            dead.push_back(t1);
                            player[t1].alive=0;
                            cout<<t1<<"号被带走\n\n"; 
                            date[++id_dat].who=tou[1].id;
                            date[id_dat].what="("+player[tou[1].id].job+")   带走->   ";
                            date[id_dat].been=t1;
                            date[id_dat].what1="("+player[t1].job+")\n";
                        }
                    }
                    else{
                        if(hate_lr&&player[hate_lr].alive){
                            player[hate_lr].alive=0;
                            cout<<hate_lr<<"号被带走\n\n"; 
                            dead.push_back(hate_lr);
                            date[++id_dat].who=tou[1].id;
                            date[id_dat].what="("+player[tou[1].id].job+")   带走->   ";
                            date[id_dat].been=hate_lr;
                            date[id_dat].what1="("+player[hate_lr].job+")\n";
                        }
                        else{
                            t1=rand()%100+1;
                            if(t1<=gailv[4]){
                                int t2=rand()%12+1;
                                TLE=0;
                                while(!player[t2].alive||player[t2].job!="狼人"){
                                    t2=rand()%12+1;
                                    TLE++;
                                    if(TLE>100000) tuichu("猎人被投带狼-2");
                                }
                                dead.push_back(t2);
                                player[t2].alive=0;
                                cout<<t2<<"号被带走\n\n"; 
                                date[++id_dat].who=tou[1].id;
                                date[id_dat].what="("+player[tou[1].id].job+")   带走->   ";
                                date[id_dat].been=t2;
                                date[id_dat].what1="("+player[t2].job+")\n";
                            }
                            else{
                                int t2=rand()%12+1;
                                TLE=0;
                                while(!player[t2].alive||player[t2].job=="狼人"||(t2==job_pos[4]&&bcf)){
                                    t2=rand()%12+1;
                                    TLE++;
                                    if(TLE>100000) tuichu("猎人被投带好人-2");
                                }
                                dead.push_back(t2);
                                player[t2].alive=0;
                                cout<<t2<<"号被带走\n\n"; 
                                date[++id_dat].who=tou[1].id;
                                date[id_dat].what="("+player[tou[1].id].job+")   带走->   ";
                                date[id_dat].been=t2;
                                date[id_dat].what1="("+player[t2].job+")\n";
                            }
                        }
                    }
                }
                if(tou[1].id==job_pos[4]&&!bcf){
                    player[tou[1].id].alive=1;
                    bcf=1;
                    cout<<job_pos[4]<<"号白痴翻牌发动技能\n";
                    dead.pop_back();
                    date[++id_dat].who=tou[1].id;
                    date[id_dat].what="   翻牌->   ";
                    date[id_dat].been=tou[1].id;
                    date[id_dat].what1="(白痴)\n";
                }
            }
            else{
                cout<<"平票,无人出局\n";
                date[++id_dat].who=-1;
                date[id_dat].what="平安日\n";
                date[id_dat].been=-1;
                date[id_dat].what1="";
            }
        }
        sort(dead.begin(),dead.end());
        if(dead.size()){
            for(int a:dead){
                if(a==jinghui){
                    cout<<"请"<<a<<"号玩家选择移交或撕掉警徽:\n";
                    if(a==my){
                        MessageBox(NULL,"请在主界面输入警徽的移交,0撕掉","发言引导",MB_OK|MB_ICONINFORMATION);
                        cin>>jinghui;
                    }
                    else if(player[a].up_yu){
                        if(player[a].job=="预言家"){
    //                      cout<<player[a].ckwho<<"\n";
                            for(int i=ck_res.size()-1;i>=0;i--){
                                if(ck_res[i].second&&player[ck_res[i].first].alive){
                                    jinghui=ck_res[i].first;
                                    break;
                                }
                            }
                        }
                        else{
                            if(cnt_wol==1) jinghui=0;
                            else{
                                int t1=rand()%12+1;
                                TLE=0;
                                while(!player[t1].alive||player[t1].job!="狼人"){
                                    t1=rand()%12+1;
                                    TLE++;
                                    if(TLE>100000) tuichu("狼预被投移交警徽");
                                }
                                jinghui=t1;
                            }
                        }
                        if(player[a].ckwho!=jinghui) killby[player[a].ckwho].push_back(a);
                        else goldby[player[a].ckwho].push_back(a);
                    }
                    else if(player[a].job=="女巫"){
                        for(int aa:silver)
                            if(player[aa].alive){
                                jinghui=aa;
                                break;
                            }
                        if(jinghui==a){
                            int t1=rand()%12+1;
                            TLE=0;
                            while(!player[t1].alive){
                                t1=rand()%12+1;
                                TLE++;
                                if(TLE>100000) tuichu("女巫被投无银水移交警徽");
                            }
                            jinghui=t1;
                        }
                    }
                    else{
                        int t1=rand()%12+1;
                        TLE=0;
                        while(!player[t1].alive){
                            t1=rand()%12+1;
                            TLE++;
                            if(TLE>100000) tuichu("其他被投移交警徽");
                        }
                        jinghui=t1;
                    }
                    if(jinghui==a||!jinghui){
                        cout<<a<<"号玩家选择撕掉警徽\n",jinghui=0;
                        date[++id_dat].who=a;
                        date[id_dat].what="("+player[a].job+")   撕掉警徽->   x";
                        date[id_dat].been=-1;
                        date[id_dat].what1="\n";
                    }
                    else{
                        cout<<"警徽移交"<<jinghui<<"号玩家\n";
                        date[++id_dat].who=a;
                        date[id_dat].what="("+player[a].job+")   移交警徽->   ";
                        date[id_dat].been=jinghui;
                        date[id_dat].what1="("+player[jinghui].job+")\n";
                    }
                    break;
                }
            }
            cout<<"请发表遗言:\n\n";
            for(int a:dead){
                cout<<a<<"号玩家发言:\n";
                if(a==my){
                    int chose=MessageBox(NULL,"你即将出局,是否拍身份?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                    if(chose==6){
                        chose=MessageBox(NULL,"是否填充真实身份?","发言引导",MB_YESNO|MB_ICONINFORMATION);
                        cout<<"跳"; 
                        if(chose==6){
                            cout<<player[a].job<<"\n";
                        }
                        else{
                            MessageBox(NULL,"请在主界面输入身份","发言引导",MB_OK|MB_ICONINFORMATION);
                            string tt;
                            cin>>tt;
                            if(tt=="猎人"){
                                hate_lr=a;
                                for(int aa:killby[a]) goldby[job_pos[3]].push_back(aa);
                                for(int aa:goldby[a]) killby[job_pos[3]].push_back(aa);
                            }
                            else if(tt=="女巫"){
                                cout<<",刀口 ";
                                MessageBox(NULL,"请在主界面输入刀口","发言引导",MB_OK|MB_ICONINFORMATION);
                                string tt1;
                                cin>>tt1;
                                cout<<"号\n";
                                hate_nv=a;
                                for(int aa:killby[a]) goldby[job_pos[2]].push_back(aa);
                                for(int aa:goldby[a]) killby[job_pos[2]].push_back(aa);
                            }
                        }
                    }
                }
                else say_water(a);
                devide(10);
            }
        }
        else{
            cout<<"今天是平安日\n\n";
        }
        sort(side.begin(),side.end(),crdd);
        TLE=0;
        while(!side.empty()&&is_in(dead,side[side.size()-1])){
            side.pop_back();
            TLE++;
            if(TLE>100000) tuichu("起跳预被投死,去除边");
        }
        cnt_life=cnt_wol=0;
        for(int i=1;i<=12;i++){
            if(player[i].alive) cnt_life++;
            if(player[i].alive&&player[i].job=="狼人") cnt_wol++;
        }
        memset(gp,0,sizeof gp);
        cp=0;
        system("pause");
    }
    inline void gaming(){
        id_dat=0,cnt_night=0,cnt_day=0;
        jieyao=1,duyao=1,jinghui=0;
        hate_lr=hate_nv=0;
        up_truewu=0;
        cp=0;
        upwu_cnt=0;
        bcf=0,cnt_life=12;
        cnt_wol=4;
        ck_res.clear();
        side.clear();
        silver.clear();
        wolf.clear();
        memset(killby,0,sizeof killby);
        memset(goldby,0,sizeof goldby);
        memset(starby,0,sizeof starby);
        memset(gp,0,sizeof gp);
        character();
        while(1){
            zbpd:night();
            if(is_over()){
                fupan();
                break;
            }
            int gcnt=0,wcnt=0,rcnt=0;
            if(player[job_pos[1]].alive) gcnt++;
            if(player[job_pos[2]].alive){
                gcnt++;
                if(jieyao) gcnt++;
                if(duyao) gcnt++;
            }
            if(player[job_pos[3]].alive) gcnt+=2;
            if(player[job_pos[4]].alive) gcnt++;
            for(int i=1;i<=12;i++) if(player[i].job!="狼人"&&player[i].job!="平民") rcnt++;
            if(cnt_wol-gcnt>=2||(rcnt==1&&cnt_wol>=2)){
                system("cls");
                system("color F0");
                cnt_day++;
                if(cnt_day!=cnt_night) cnt_day=cnt_night;
                date[++id_dat].who=-1;
                date[id_dat].what="第 ";
                date[id_dat].been=cnt_day;
                date[id_dat].what1=" 天\n";
                print(1,0);
                int t=rand()%12+1;
                TLE=0;
                while(!player[t].alive||player[t].job!="狼人"){
                    t=rand()%12+1;
                    TLE++;
                    if(TLE>100000) tuichu("选择自爆刀人");
                }
                cout<<t<<"号玩家自爆,即将进入黑夜\n";
                date[++id_dat].who=t;
                date[id_dat].what="(狼人)   ";
                date[id_dat].been=-1;
                date[id_dat].what1=" 自爆\n";
                devide(1);
                player[t].alive=0;
                dead.clear();
                dead.push_back(t);
                sort(side.begin(),side.end(),crdd);
                while(!side.empty()&&is_in(dead,side[side.size()-1])){
                    side.pop_back();
                }
                cnt_life=cnt_wol=0;
                for(int i=1;i<=12;i++){
                    if(player[i].alive) cnt_life++;
                    if(player[i].alive&&player[i].job=="狼人") cnt_wol++;
                }
                if(jinghui==t){
                    TLE=0;
                    int t1=rand()%12+1;
                    while(!player[t1].alive||player[t1].job!="狼人"){
                        t1=rand()%12+1;
                        TLE++;
                        if(TLE>100000) tuichu("狼警自爆移交警徽");
                    }
                    jinghui=t1;
                    cout<<"警徽移交"<<jinghui<<"号玩家\n";
                    date[++id_dat].who=t;
                    date[id_dat].what="("+player[t].job+")   移交警徽->   ";
                    date[id_dat].been=jinghui;
                    date[id_dat].what1="("+player[jinghui].job+")\n";
                }
                system("pause");
                goto zbpd;
            }
            day();
            if(is_over()){
                fupan();
                break;
            }
        }
    }
}
bool init(){
    bg:system("cls");
    system("color fc");
    ifstream cf("狼人杀Data.txt");
    if(!cf.good()){
        cf.close();
        ofstream fs;
        fs.open("狼人杀Data.txt",ios::out);
        init_chushigl();
        for(int i=1;i<=cnt_gailv;i++) fs<<chushigl[i]<<" ";//概率初始值 
        fs<<"\n";
        for(int i=1;i<=cnt_daoju;i++) fs<<0<<" ";
        fs<<"\n"<<0<<"\n";//是否意外退出 
        fs.close();
    }
    else cf.close();
    fstream fs;
    int is_clear=0;
    fs.open("狼人杀Data.txt",ios::in);
    for(int i=1;i<=cnt_gailv;i++){
        fs>>gailv[i];
        if(gailv[i]) is_clear=1;
    }
    for(int i=1;i<=cnt_daoju;i++) fs>>daoju[i];
    int is_lstover;
    fs>>is_lstover;
    fs.close();
    if(!is_clear){
        puts("概率文件错误,将赋为初始值");
        ofstream ffs;
        ffs.open("狼人杀Data.txt",ios::out);
        init_chushigl();
        for(int i=1;i<=cnt_gailv;i++) ffs<<chushigl[i]<<" ";//概率初始值 
        ffs<<"\n";
        for(int i=1;i<=cnt_daoju;i++) ffs<<daoju[i]<<" ";
        ffs<<"\n"<<is_lstover<<"\n";//是否意外退出 
        ffs.close();
        system("pause");
        goto bg;
    }
    if(is_lstover){
        cout<<"检测到上一对局非正常结束,将补偿【道具卡-再抽一次】x 1\n";
        system("pause");
        daoju[1]++;
        fstream fs;
        fs.open("狼人杀Data.txt",ios::out);
        for(int i=1;i<=cnt_gailv;i++) fs<<gailv[i]<<" ";
        fs<<"\n";
        for(int i=1;i<=cnt_daoju;i++) fs<<daoju[i]<<" ";
        fs<<"\n"<<0<<"\n";
        fs.close();
        system("cls");
    }
    devide(0);
    cout<<'\n'<<"狼人杀                  v.1.8.3              By:mRXxy0o0\n";
    devide(0);
    cout<<"1.开始游戏\n2.设置\n3.Tips(首次游玩请阅读)\n4.背包\n5.更新日志\n6.退出游戏\n";
    devide(0);
    int t;
    cin>>t;
    if(t==2){
        int t1,t2;
        while(1){
            system("cls");
            print_gailv();
            devide(0);
            cout<<"输入希望更改的的序号(0保存并退出):\n" ;
            cin>>t1;
            if(!t1) break;
            devide(0);
            cout<<"输入希望更改的数值(0~100):\n";
            cin>>t2;
            gailv[t1]=t2;
            if(t1==12) gailv[13]=100-t2;
            else if(t1==13) gailv[12]=100-t2;
            else if(t1==14) gailv[15]=100-t2;
            else if(t1==15) gailv[14]=100-t2;
        }
        fstream fs;
        fs.open("狼人杀Data.txt",ios::out);
        for(int i=1;i<=cnt_gailv;i++) fs<<gailv[i]<<" ";
        fs<<"\n";
        for(int i=1;i<=cnt_daoju;i++) fs<<daoju[i]<<" ";
        fs<<"\n"<<0<<"\n";
        fs.close();
        goto bg;
    }
    if(t==3){
        system("cls");
        cout<<"·本游戏数据文件保存位置为 exe程序同根目录 狼人杀Data.txt ,不慎删除将恢复初始默认值\n\n";
        cout<<"·如果你感觉玩起来重复出现了很多灵异bug,可以检查一下概率值是否正常\n\n";
        cout<<"·如概率数值出现异常(如全部变成0),可以退出重进或手动删除数据文件\n\n";
        cout<<"·警长选择的发言顺序和警徽的去向似乎都与什么有关\n\n";
        cout<<"·谁说不是预言家就不能跳预言家的?!(虽然你退不了水)\n\n";
        cout<<"·尽你所能地去记住发言吧,不然预言家撕了警徽你却不知道警徽流是什么\n\n";
        cout<<"·如果对局非正常结束,将以【道具卡-再抽一次】补偿(虽然你可以在文件里要多少写多少)\n\n";
        cout<<"·感谢开源的【狼人杀online】提供的号码及存活显示(虽然他也不知道)\n\n";
        cout<<"·仁慈的作者增加了开天眼模式,主界面输入6666,再输入999即可打开,输入6666加其他数字即可关闭\n\n";
        cout<<"·为了游戏体验,还是不开比较好玩\n\n";
        cout<<"·csdn博客链接:https://blog.csdn.net/mRXxy0o0/article/details/128546555\n\n";
        cout<<"·洛谷博客链接:\nhttps://www.luogu.com.cn/blog/mRXxy0o0/c-lang-ren-sha-12-ren-biao-zhun-chang-you-fa-yan-you-xuan-jing-fu-exe-post\n\n";
        cout<<"·不定期更新,想鸽就鸽。有空会写一个石像鬼守墓\n\n";
        devide(0);
        system("pause");
        goto bg;
    }
    if(t==4){
        system("cls");
        print_daoju();
        devide(0);
        system("pause");
        goto bg;
    }
    if(t==5){
        system("cls");
        devide(0);
        cout<<"v.1.0:初步完成游戏主体\n";
        cout<<"v.1.1:修复场上单边狼预时出现的发言死循环\n";
        cout<<"v.1.2:加入背包系统并修复女巫泼毒规则\n";
        cout<<"v.1.3:新增死循环自动退出,肝疼\n";
        cout<<"v.1.4:修复小bug\n";
        cout<<"v.1.5:更改部分输入模式,新增超时退出原因\n";
        cout<<"v.1.6:改进号码与身份对齐规则(实际上没啥大用)\n";
        cout<<"v.1.7:新增上警与警徽玩家号码牌高亮模块,新增启动时自动检查概率文件\n";
        cout<<"v.1.8:针对某些电脑没有D盘符,更改了Data存放的位置,更为方便\n";
        cout<<"v.1.8.1:改进女巫文本描述,新增随时拍身份\n";
        cout<<"v.1.8.2:修bug\n";
        cout<<"v.1.8.3:修bug,优化代码结构,留出其他板子接口\n";
        devide(0);
        system("pause");
        goto bg; 
    }
    if(t==6666){
        system("cls");
        devide(5);
        int t1;
        cin>>t1;
        if(t1==999) admit=1;
        else admit=0;
        goto bg; 
    }
    if(t==6) return 0;
    system("cls");
    for(int i=0;i<cnt_templat;i++) cout<<i+1<<". "<<templat[i];
    devide(0);
    cout<<"请选择板子序号:\n";
    devide(0);
    cin>>mode;
    mode--;
    return 1;
}
int main(){
    srand(time(0));
    system("mode con cols=120");
    while(1){
        if(!init()) return 0;
        if(mode==0) yunvliebai::gaming();
        fstream fs;
        fs.open("狼人杀Data.txt",ios::out);
        for(int i=1;i<=cnt_gailv;i++) fs<<gailv[i]<<" ";
        fs<<"\n";
        for(int i=1;i<=cnt_daoju;i++) fs<<daoju[i]<<" ";
        fs<<"\n"<<0<<"\n";
        fs.close();
    }
    return 0;
}