恶魔轮盘赌(无道具版)
2025-02-06 13:08:19
发布于:广东
此程序非最终版,难度、特效、双人对战等未添加。
如有BUG请提出!
禁盗!
#include<bits/stdc++.h> //此程序非最终结果
#include<windows.h>
using namespace std;
typedef long long ll;
void hall();
void c(string s)
{
for(int i=0;i<s.size();i++)
{
cout<<s[i];
Sleep(50);
}
}
void en() {cout<<"\n";}
void wg()
{
system("cls");
system("color 0C");
cout<<"违规,罚退出游戏!";
exit(0);
}
void game(string mode)
{
system("cls");
cout<<"初始化中……";
int blo,gblo;
bool ld,zl;//ld:到谁(0是恶魔,1是玩家)zl:左轮(到哪个弹口了)
bool gun[11]; //10个轮
int t1,t2,t3,t4,t5;
fill(gun+1,gun+11,0);
t1 = rand()%10 + 1;
t2 = t3 = t4 = t5 = t1;
while(t1 == t2) t2 = rand()%10 + 1;
t3 = t4 = t5 = t2;
while(t2 == t3 || t3 == t1) t3 = rand()%10+1;
t4 = t5 = t3;
while(t4 == t1 || t4 == t2 || t4 == t3) t4 = rand()%10+1;
t5 = t4;
while(t5 == t1 || t5 == t2 || t5 == t3 || t5 == t4) t5 = rand()%10+1;
if(mode == "普通")
{
blo = 5,gblo = 5;
ld = 1;
gun[t1] = gun[t2] = gun[t3] = 1;
}
else if(mode == "简单")
{
blo = 6,gblo = 2;
ld = 1;
gun[t1] = gun[t2] = 1;
}
else if(mode == "困难")
{
gun[t1] = gun[t2] = gun[t3] = gun[t4] = 1;
blo = 3,gblo = 8;
ld = 0;
}
else if(mode == "末日")
{
gun[t1] = gun[t2] = gun[t3] = gun[t4] = gun[t5] = 1;
blo = 1,gblo = 10;
ld = 0;
}
else if(mode == "赌命") blo = gblo = ld = gun[t1] = gun[t2] = gun[t3] = 1;
system("cls");
while(1)
{
if(!blo)
{
c("啪!你死了。恶魔还剩");
c(to_string(gblo));
c("滴血。很遗憾,你没有打败恶魔。。。。。。");
Sleep(1500);
hall();
break;
}
else if(!gblo)
{
c("你赢了!!!");
system("color 6F");
Sleep(500);
system("color 0F");
Sleep(500);
system("color 6F");
Sleep(500);
system("color 0F");
hall();
break;
}
c("到");
if(ld == 1) c("你");
else c("恶魔");
c("了");
en();
c("恶魔还剩");
c(to_string(gblo));
c("滴血");
en();
c("你还剩");
c(to_string(blo));
c("滴血");
en();
en();
if(ld == 1)
{
c("对谁开枪?(输入0为自己,1为恶魔)");
en();
bool f;
cin>>f;
en();
c("左轮转几下?(输入数字,最多3下)");
en();
int tmp;
cin>>tmp;
if(tmp > 3) wg();
zl += tmp;
if(zl > 10) zl %= 10;
c("啪!");
en();
if(gun[zl])
{
cout<<(!f ? "你受伤了!" : "恶魔受伤了!");
if(!f) blo--,ld = 1;
else gblo--,ld = 0;
fill(gun+1,gun+11,0);
t1 = rand()%10 + 1;
t2 = t3 = t4 = t5 = t1;
while(t1 == t2) t2 = rand()%10 + 1;
t3 = t4 = t5 = t2;
while(t2 == t3 || t3 == t1) t3 = rand()%10+1;
t4 = t5 = t3;
while(t4 == t1 || t4 == t2 || t4 == t3) t4 = rand()%10+1;
t5 = t4;
while(t5 == t1 || t5 == t2 || t5 == t3 || t5 == t4) t5 = rand()%10+1;
if(mode == "简单") gun[t1] = gun[t2] = 1;
else if(mode == "普通" || mode == "赌命") gun[t1] = gun[t2] = gun[t3] = 1;
else if(mode == "困难") gun[t1] = gun[t2] = gun[t3] = gun[t4] = 1;
else gun[t1] = gun[t2] = gun[t3] = gun[t4] = gun[t5] = 1;
}
else c("平安无事……");
if(f) ld = 0;
Sleep(1000);
}
else
{
bool togun = 0; //对谁开(0为自己,1为玩家)
if((rand()%100+1) >= 60) togun = ld = 1;
c("恶魔决定对");
cout<<(togun ? "你" : "他自己");
c("开枪");
en();
int tmp = rand()%3+1;
zl += tmp;
if(zl > 10) zl %= 10;
c("左轮转");
c(to_string(tmp));
c("下");
en();
c("啪!");
en();
if(gun[zl])
{
cout<<(togun ? "你受伤了!" : "恶魔受伤了!");
if(togun) blo--,ld = 1;
else gblo--,ld = 0;
fill(gun+1,gun+11,0);
t1 = rand()%10 + 1;
t2 = t3 = t4 = t5 = t1;
while(t1 == t2) t2 = rand()%10 + 1;
t3 = t4 = t5 = t2;
while(t2 == t3 || t3 == t1) t3 = rand()%10+1;
t4 = t5 = t3;
while(t4 == t1 || t4 == t2 || t4 == t3) t4 = rand()%10+1;
t5 = t4;
while(t5 == t1 || t5 == t2 || t5 == t3 || t5 == t4) t5 = rand()%10+1;
if(mode == "简单") gun[t1] = gun[t2] = 1;
else if(mode == "普通" || mode == "赌命") gun[t1] = gun[t2] = gun[t3] = 1;
else if(mode == "困难") gun[t1] = gun[t2] = gun[t3] = gun[t4] = 1;
else gun[t1] = gun[t2] = gun[t3] = gun[t4] = gun[t5] = 1;
}
else c("平安无事……");
if(togun) ld = 1;
Sleep(1000);
}
system("cls");
}
}
int main()
{
system("color 0F");
srand(unsigned (time(0)));
hall();
return 0;
}
void hall()
{
system("cls");
cout<<"输入1开始游戏"<<endl;
int czs;
cin>>czs;
if(czs == 1)
{
system("cls");
c("难度?(输入1~5,推荐2)");
en();
cout<<"1->简单\n";
cout<<"2->普通\n";
cout<<"3->困难\n";
cout<<"4->末日(乱输自动进入)\n";
cout<<"5->赌命(双方只有一滴血,你先)\n";
int mode;
cin>>mode;
if(mode == 1) game("简单");
else if(mode == 2) game("普通");
else if(mode == 3) game("困难");
else if(mode == 5) game("赌命");
else game("末日");
}
}
全部评论 1
d
2025-02-06 来自 广东
0
有帮助,赞一个