#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
const int N = 1e6 + 10 ;
int k1[5],k2[5];
int ioio ;
int ll=1;
void one();
void two();
int a[N] ;
bool st[N] ;
void jz();
int n = 6 ;
int main(){
srand(time(0));
jz();
while(1){
cout << endl ;
cout<<"A.单人 B.双人 C.退出";
char a;
cin>>a;
if(a=='A'||a=='a'){
one();
Sleep(2000);
system("cls");
}else if(a=='B'||a=='b'){
two();
Sleep(2000);
system("cls");
}else{
break;
}
}
return 0;
}
void dfs(int u){
if(u == n + 1){
for(int i = 1 ; i <= n ; i++){
cout << 1 << " " << 0 << " " ;
}
//cout << endl ;
return ;
}
for(int i = 1 ; i <= n ; i++){
if(st[i] == 1) continue ;
a[u] = i ;
st[i] = 1 ;
dfs(u + 1) ;
st[i] = 0 ;
}
}
void one(){
system("cls");
int xue1=5,xue2=5;//1是人机,2是玩家
k1[1]=0;
k1[2]=0;
k1[3]=0;
k1[4]=0;
k2[1]=0;
k2[2]=0;
k2[3]=0;
k2[4]=0;
for(int i=1;i<=4;i++){
int n1=rand()%5;
if(n1==0){
k1[1]++;
}else if(n1==1){
k1[2]++;
}else if(n1==2){
k1[3]++;
}else if(n1==3||n1==4){
k1[4]++;
}
}
cout<<"\n\n";
for(int i=1;i<=4;i++){
int n1=rand()%5;
if(n1==0){
k2[1]++;
}else if(n1==1){
k2[2]++;
}else if(n1==2){
k2[3]++;
}else if(n1==3||n1==4){
k2[4]++;
}
}
bool flag12=1;
while(xue1>-1&&xue2>-1){
bool flag=0;
system("cls");
if(xue1==0){
system("cls");
cout<<"恭喜玩家获胜,获得100万美刀";
return;
}
if(xue2<=0){
system("cls");
cout<<"玩家失败,输掉100万美刀和";
Sleep(3000);
system("color 0c");
cout<<"一条命";
Sleep(2000);
system("color 0f");
for(int i = 1 ; i <= n ; i++){
system("color 5c");
Sleep(2000);
system("color 0f");
}
return;
}
for(int i=1;i<=4;i++){
for(int j=k1[i];j>=1;j--){
if(i==1)cout<<"镜子 ";
if(i==2)cout<<"酒 ";
if(i==3)cout<<"华子 ";
if(i==4)cout<<"小刀 ";
}
}
cout<<xue1<<"\n\n";
for(int i=1;i<=4;i++){
for(int j=k2[i];j>=1;j--){
if(i==1)cout<<"镜子 ";
if(i==2)cout<<"酒 ";
if(i==3)cout<<"华子 ";
if(i==4)cout<<"小刀 ";
}
}
//玩家
cout<<xue2<<"\n\nA.镜子 B.酒 C.华子 D.小刀 E.不用";
bool dan;
if(flag12){
dan=rand()%2;
}
//int gon1=1,gon2=1;
char a;
cin>>a;
if((a=='A'||a=='a')&&k2[1]>0){
if(dan)cout<<"实";
else cout<<"空";
k2[1]--;
flag12=0;
Sleep(2000);
continue;
}else if((a=='B'||a=='b')&&k2[2]>0){
if(dan)cout<<"实";
else cout<<"空";
dan=rand()%2;
k2[2]--;
Sleep(2000);
continue;
}else if((a=='C'||a=='c')&&k2[3]>0&&xue2<5){
xue2++;
k2[3]--;
Sleep(2000);
continue;
}else if((a=='D'||a=='d')&&k2[4]>0){
flag=1;
k2[4]--;
}else{
}
cout<<"\nA.打自己 B.打对面";
cin>>a;
if(a=='A'||a=='a'){
if(dan&&flag)xue2-=2;
if(dan)xue2-=1;
}else{
if(dan&&flag)xue2-=2;
else if(!dan&&flag)xue1-=2;
else if(dan)xue2-=1;
else xue1-=1;
}
if(xue1==0){
system("cls");
cout<<"恭喜玩家获胜,获得100万美刀";
return;
}
dan=rand()%2;
//人机
if(k1[3]>0&&xue1<=3){
k1[3]--;
xue1+=1;
}
if(k1[1]>0){
if(dan){
if(k1[4]>0){
xue2-=2;
cout<<"\n砰";
k1[1]--;
k1[4]--;
Sleep(2000);
continue;
}else{
xue2-=1;
cout<<"\n砰";
Sleep(2000);
continue;
}
}else{
cout<<"\n呼~";
k1[1]--;
Sleep(2000);
continue;
}
}
if(k1[2]>0){
int m=rand()%2;
if(m==1){
if(dan)cout<<"实";
else cout<<"空";
k1[2]--;
}
}
int m=rand()%2;
if(m==1){
int nm=rand()%3;
if(nm==3){
if(dan){
xue2-=2;
cout<<"\n砰";
k1[4]--;
continue;
}else{
xue1-=2;
cout<<"\n啊";
k1[4]--;
continue;
}
}else{
if(dan){
xue2-=1;
cout<<"\n砰";
continue;
}else{
xue1-=1;
cout<<"\n啊";
continue;
}
}
}else{
if(dan){
xue1-=1;
cout<<"\n啊";
continue;
}else{
cout<<"\n呼~";
continue;
}
}
system("cls");
flag12=1;
}
}
void two(){
system("cls");
int xue1=5,xue2=5;//1是玩家一,2是玩家二
k1[1]=0;
k1[2]=0;
k1[3]=0;
k1[4]=0;
k2[1]=0;
k2[2]=0;
k2[3]=0;
k2[4]=0;
for(int i=1;i<=4;i++){
int n1=rand()%5;
if(n1==0){
k1[1]++;
}else if(n1==1){
k1[2]++;
}else if(n1==2){
k1[3]++;
}else if(n1==3||n1==4){
k1[4]++;
}
}
cout<<"\n\n";
for(int i=1;i<=4;i++){
int n12=rand()%5;
if(n12==0){
k2[1]++;
}else if(n12==1){
k2[2]++;
}else if(n12==2){
k2[3]++;
}else if(n12==3||n12==4){
k2[4]++;
}
}
bool flag12=1;
while(xue1>-1&&xue2>-1){
srand(time(0));
bool flag=0;
system("cls");
if(xue1<=0){
Sleep(1000);
system("cls");
cout<<"恭喜玩家2获胜,获得100万美刀\n";
cout<<"玩家1失败,输掉100万美刀和";
Sleep(3000);
system("color 0c");
cout<<"一条命";
Sleep(2000);
system("color 0f");
return;
}
if(xue2<=0){
Sleep(1000);
system("cls");
cout<<"恭喜玩家1获胜,获得100万美刀\n";
cout<<"玩家2失败,输掉100万美刀和";
Sleep(3000);
system("color 0c");
cout<<"一条命";
Sleep(2000);
system("color 0f");
return;
}
if(ll%2==1){
cout<<"玩家2:";
for(int i=1;i<=4;i++){
for(int j=k1[i];j>=1;j--){
if(i==1)cout<<"镜子 ";
if(i==2)cout<<"酒 ";
if(i==3)cout<<"华子 ";
if(i==4)cout<<"小刀 ";
}
}
cout<<"血量:";
cout<<xue1<<"\n\n";
cout<<"玩家1:";
for(int i=1;i<=4;i++){
for(int j=k2[i];j>=1;j--){
if(i==1)cout<<"镜子 ";
if(i==2)cout<<"酒 ";
if(i==3)cout<<"华子 ";
if(i==4)cout<<"小刀 ";
}
}
//玩家1
cout<<"血量:"<<xue2;
cout<<"\n\n"<<"玩家一:A.镜子 B.酒 C.华子 D.小刀 E.不用";
bool dan;
if(flag12){
dan=rand()%2;
}
//int gon1=1,gon2=1;
char a;
cin>>a;
if((a=='A'||a=='a')&&k2[1]>0){
if(dan)cout<<"实";
else cout<<"空";
k2[1]--;
flag12=0;
Sleep(2000);
continue;
}else if((a=='B'||a=='b')&&k2[2]>0){
if(dan)cout<<"实";
else cout<<"空";
dan=rand()%2;
k2[2]--;
Sleep(2000);
continue;
}else if((a=='C'||a=='c')&&k2[3]>0&&xue2<5){
xue2++;
k2[3]--;
Sleep(2000);
continue;
}else if((a=='D'||a=='d')&&k2[4]>0){
flag=1;
k2[4]--;
}else{
}
cout<<"\nA.打自己 B.打对面";
cin>>a;
ll++;
if(a=='A'||a=='a'){
if(dan&&flag)xue2-=2;
if(dan)xue2-=1;
}else{
if(dan&&flag)xue2-=2;
else if(!dan&&flag)xue1-=2;
else if(dan)xue2-=1;
else xue1-=1;
}
}
if(xue1<=0){
Sleep(1000);
system("cls");
cout<<"恭喜玩家2获胜,获得100万美刀\n";
cout<<"玩家1失败,输掉100万美刀和";
Sleep(3000);
system("color 0c");
cout<<"一条命";
Sleep(2000);
system("color 0f");
for(int op = 1 ; op <= 10 ; op++){
system("color 0c");
Sleep(50);
system("color 5c");
}
return;
}
if(xue2<=0){
Sleep(1000);
system("cls");
cout<<"恭喜玩家1获胜,获得100万美刀\n";
cout<<"玩家2失败,输掉100万美刀和";
Sleep(3000);
system("color 0c");
cout<<"一条命";
Sleep(2000);
system("color 0f");
return;
}
system("cls");
if(ll%2==0){
cout<<"玩家2:";
for(int i=1;i<=4;i++){
for(int j=k1[i];j>=1;j--){
if(i==1)cout<<"镜子 ";
if(i==2)cout<<"酒 ";
if(i==3)cout<<"华子 ";
if(i==4)cout<<"小刀 ";
}
}
cout<<"血量:";
cout<<xue1<<"\n\n";
cout<<"玩家1:";
for(int i=1;i<=4;i++){
for(int j=k2[i];j>=1;j--){
if(i==1)cout<<"镜子 ";
if(i==2)cout<<"酒 ";
if(i==3)cout<<"华子 ";
if(i==4)cout<<"小刀 ";
}
}
//玩家2
cout<<"血量:"<<xue2;
cout<<"\n\n"<<"玩家二:A.镜子 B.酒 C.华子 D.小刀 E.不用";
bool dan;
if(flag12){
dan=rand()%2;
}
//int gon1=1,gon2=1;
char a;
cin>>a;
if((a=='A'||a=='a')&&k1[1]>0){
if(dan)cout<<"实";
else cout<<"空";
k1[1]--;
flag12=0;
Sleep(2000);
continue;
}else if((a=='B'||a=='b')&&k1[2]>0){
if(dan)cout<<"实";
else cout<<"空";
dan=rand()%2;
k1[2]--;
Sleep(2000);
continue;
}else if((a=='C'||a=='c')&&k1[3]>0&&xue2<5){
xue2++;
k1[3]--;
Sleep(2000);
continue;
}else if((a=='D'||a=='d')&&k1[4]>0){
flag=1;
k1[4]--;
}else{
}
cout<<"\nA.打自己 B.打对面";
cin>>a;
ll++;
if(a=='A'||a=='a'){
if(dan&&flag)xue1-=2;
if(dan)xue1-=1;
}else{
if(dan&&flag)xue2-=2;
else if(!dan&&flag)xue1-=2;
else if(dan)xue2-=1;
else xue1-=1;
}
}
}
}
bool op = 0 ;
void f(){
if(ioio == 101){
system("cls");
return ;
}
system("cls");
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n ";
cout << ioio << "% " << "加载中";
if(op == 0){
cout << " ..." ;
op = 1 ;
}else{
cout << "........" ;
op = 0 ;
}
system("cls");
ioio++ ;
f() ;
}
void jz(){
cout << "请全屏游玩!!!\n\n" ;
Sleep(1000);
system("cls");
int x;
for(int i=1;i <= 99;i++){
x=rand()%3;
if(x==1){
x=rand()%500;
Sleep(x);
}
system("cls");
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n ";
cout<<i<<'%';
Sleep(10);
}
system("cls");
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n ";
cout<<"99%";
Sleep(1000);
system("cls");
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n ";
cout<<"100%";
Sleep(500);
system("cls");
dfs(1) ;
f() ;
for(int i = 1 ; i <= 120 ; i++){
system("color 0A");
cout << "▇" ;
Sleep(10);
}
system("color 0f");
cout << endl ;
cout << "\n\n" ;
cout << "█───█─███─█───████─████─█───█─███────███─████────████─█───████─██─██\n" ;
cout << "█───█─█───█───█──█─█──█─██─██─█───────█──█──█────█──█─█───█──█──███─\n" ;
cout << "█─█─█─███─█───█────█──█─█─█─█─███─────█──█──█────████─█───████───█──\n" ;
cout << "█████─█───█───█──█─█──█─█───█─█───────█──█──█────█────█───█──█───█──\n" ;
cout << "─█─█──███─███─████─████─█───█─███─────█──████────█────███─█──█───█──\n" ;
Sleep(3000);
cout << "\n\n" ;
cout << "████──███─█─█─███─█───███────████─████─█─█─█───███─███─███─███\n" ;
Sleep(500);
cout << "█──██─█───█─█──█──█───█──────█──█─█──█─█─█─█───█────█───█──█──\n" ;
Sleep(500);
cout << "█──██─███─█─█──█──█───███────████─█──█─█─█─█───███──█───█──███\n" ;
Sleep(500);
cout << "█──██─█───███──█──█─────█────█─█──█──█─█─█─█───█────█───█──█──\n" ;
Sleep(500);
cout << "████──███──█──███─███─███────█─█──████─███─███─███──█───█──███\n" ;
Sleep(1000);
for(int i = 1 ; i <= 5 ; i++){
system("color 47 ");
Sleep(100);
system("color 7 ");
Sleep(100);
}
Sleep(2000);
cout << "\n\n\n" ;
cout << "████─████─████────███─███─█─█─████──███─████\n" ;
cout << "█──█─█──█─█──█────█────█──█─█─█──██──█──█──█\n" ;
cout << "████─████─████────███──█──█─█─█──██──█──█──█\n" ;
cout << "█────█──█─█─█───────█──█──█─█─█──██──█──█──█\n" ;
cout << "█────█──█─█─█─────███──█──███─████──███─████\n" ;
cout << "\n\n" ;
cout << "_______________________________________________________________________________________________________PAR工作室--刘汶博\n\n" ;
cout << "\n\n\n\n" ;
system("color 0f");
}
你点一下试试?
https://mblock.makeblock.com/project/1840263
https://kedaoi.cn/blog/4238