#include <cstdlib>
#include <iostream>
#include <ctime>
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
int main() {
system("color f0");
cout<<"绝版狼人杀\n现在\n开始\n";
system("pause");
system("cls");
cout<<"几人:";
int n;
cin>>n;
for(int i=1; i<=n; i++) {
cout<<i<<' ';
}
cout<<"\n";
srand(time(0));
int s=rand()%5+1;
int b=rand()%n+1;
cout<<"你在"<<b<<"位\n";
if(s==1) {
cout<<"你是狼人\n";
} else if(s==2) {
cout<<"你是巫师\n";
} else if(s==3) {
cout<<"你是猎人\n";
} else if(s==4) {
cout<<"你是预言家\n";
} else cout<<"你是贫民\n";
system("pause");
system("cls");
cout<<"你在"<<b<<"位\n";
for(int i=1; i<=8; i++) {
cout<<i<<" ";
}
cout<<"\n";
for(int i=1; i<=8; i++) {
cout<<"存活 ";
}
cout<<"\n";
for(int i=8+1; i<=n; i++) {
cout<<i<<" ";
}
cout<<"\n";
for(int i=8+1; i<=n; i++) {
cout<<"存活 ";
}
Sleep(3000);
int shi=1;
int ooo[n+1];
char kk[n+1]= {'h'};
while(true) {
ooo[shi]=rand()%n+1;
cout<<"即将进入夜晚\n";
system("color 0f");
system("cls");
Sleep(1000);
int k;
for(int i=1; i<=8; i++) {
cout<<i<<" ";
}
cout<<"\n";
for(int i=1; i<=8; i++) {
if(i==ooo[i]||i==k) {
cout<<"死亡 ";
}
else cout<<"存活 ";
}
cout<<"\n";
for(int i=8+1; i<=n; i++) {
cout<<i<<" ";
}
cout<<"\n";
for(int i=8+1; i<=n; i++) {
if(i==ooo[i]||i==k) {
cout<<"死亡 ";
}
else cout<<"存活 ";
}
cout<<"\n";
cout<<"你在"<<b<<"位\n";
if(s==1) {
cout<<"你是狼人\n";
} else if(s==2) {
cout<<"你是巫师\n";
} else if(s==3) {
cout<<"你是猎人\n";
} else if(s==4) {
cout<<"你是预言家\n";
} else cout<<"你是贫民\n";
if(s==1) {
cout<<"你要杀谁\n";
cin>>k;
} else if(s==2) {
cout<<"你要救人吗\n";
cin>>k;
if(k==1) {
k=0;
cout<<"你要救谁\n";
cin>>k;
}
} else if(s==4) {
cout<<"你想查验谁\n";
cin>>k;
cout<<"他是";
int who=rand()%5+1;
switch(who) {
case 1:
cout<<"狼人\n";
break;
case 2:
cout<<"巫师\n";
break;
case 3:
cout<<"猎人\n";
break;
case 4:
cout<<"贫民\n";
break;
case 5:
cout<<"贫民\n";
break;
}
}
cout<<"天亮了,\n";
system("color f0");
cout<<"昨晚";
if(s==1) {
cout<<k;
} else cout<<ooo[shi];
cout<<"已死亡\n";
if(k) {
kk[k]='s';
}
if(ooo[shi]) {
kk[ooo[shi]]='s';
}
cout<<"开始投票\n";
int kill1[n],kill2[n],ko;
for(int i=1; i<b; i++) {
if(kk[i]!='s') {
kill1[i]=rand()%n+1;
cout<<i<<"号投给了"<<kill1[i]<<"号\n";
Sleep(rand()%5000+1000);
kill2[kill1[i]]++;
}
}
cout<<"投给谁????????????\n";
cin>>ko;
cout<<b<<"号投给了"<<ko<<"号\n";
kill2[ko]++;
for(int i=b+1; i<=n; i++) {
if(kk[i]!='s') {
kill1[i]=rand()%n+1;
cout<<i<<"号投给了"<<kill1[i]<<"号\n";
Sleep(rand()%5000+1000);
kill2[kill1[i]]++;
}
}
int max1=0,max=0;
for(int i=1; i<=n; i++) {
if(kill2[i]>max) {
max=kill2[i];
max1=i;
}
}
cout<<max1<<"投票出局\n";
Sleep(2000);
if(ooo[shi]==b||max1==b) {
cout<<"你已死亡,游戏结束\n";
if(s==3) {
cout<<"你是猎人,你想带走谁?";
int kill3;
cin>>kill3;
cout<<kill3<<"已死亡\n";
Sleep(1000);
return 0;
}
}
if(k) {
ooo[shi]=k;
}
if(ooo[shi]){
kk[ooo[shi]]='s';
}
shi++;
}
return 0;
}