• Bio
  • Recent Activities

《勇者斗恶龙2:神战》已发布。 《酋长追寻》 博客

!!!~~新游戏《素数奥秘》已发布:代码

本游戏由xsf创作,所有权归xsf所有,若改编需标明出处。

《勇者斗恶龙2:神战》:

//欢迎来到《龙战2》,著/(主)xtmg·肖胜烽、(副)happybob•杨惠然,特别感谢DerriLock卢逸轩
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;

int health1 = 10, health2 = 15;
int power1 = 2, power2 = 2;
int cnt = 0,mmm=1;
int mom1=0,mom2=0;
int u=0,y=0,ooo=0,qqqq,kk=0;
int qwertyuiop=0;
void kkk(int x,int d1,int d2,int qw,int qe)
{
	if(x==0)
	{
		d1=8;
		qw+=2;
	}
	if(x==1)
	{
		d2=8;
		qe+=2;
	}
	return;
}


//片段1 游戏介绍
void intro()
{
    srand(time(NULL));   
    cout << endl << endl; 
    cout << "欢迎来到《龙战2》,著/肖胜烽。特别感谢,杨惠然。"<<endl<<endl;
    cout << "两人回合制游戏,每回合双方同时在“攻击、防御、集气、必杀···”九种行动中选一种。" << endl << endl;
    cout << "1. “生命”:每人 15 点生命,生命归 0 立即死亡;" << endl << endl;
    cout << "2. “伤害”:攻击造成 1 伤害,防御免除攻击伤害,互相攻击双方都不受伤害,必杀造成 3 伤害;" << endl << endl;
    cout << "3. “必杀”:必杀需消耗 2 “气”,双方同时必杀则相安无事,否则放必杀者给对手造成伤害,对手的行动无任何效果;" << endl << endl;
    cout << "4. “气”:防御对方攻击增加 1 气,集气且不受到伤害增加 1 气。" << endl << endl;
    cout << "5. “终结”:若对方生命小于3时可使用,每局只能用一次"<< endl << endl;
    cout << "6. “世界末日”:需消耗 4 “气”,可直接令对方死亡"<< endl << endl;
    cout << "7. “劫气”:抢走对方的“气”"<<endl<<endl;
    cout << "8. “大补血”:消耗1气,无攻击时可增2血,被动时另当别论"<<endl<<endl;
    cout << "9. “神的佑护”:可防御世界末日,必杀;反弹劫气,攻击,终结;需祭祀2气"<<endl<<endl;
    cout << "----------单挑开始,你是武将1,卢轩轩是武将2----------" << endl << endl;
}
// 片段3 确定人类策略
namespace human
{
    int strategy()
    {
        // 输出出卡提示
        cout << "用数字代表本回合武将1的行动:0必杀,1攻击,2防御,3集气,4劫气,5大补血,6终结,7世界末日,8神的保佑" << endl; 

        // 读入
        int x = 0;
        if (!(cin >> x))
        {
            x = 0;
            getchar();   
        }
        return x;
    }
}

// 片段4 确定电脑策略
double rd(double l, double r)
{
	return rand() * 1.0 / RAND_MAX * (r - l) + l; 
}

int rdz(int l, int r)
{
	return (int)(1.0 * rand() / RAND_MAX * (r - l) + l);
}

namespace ai
{
    int strategy()
    {    
    	// 1对手,2我 
    	if(health1<=1)
    	{
    		return 6;
		}
    	if (power2>=4)
    	{
    		if(health1<=8&&power1<2) return 7;
    		else
    		{
    			double pct=1.0/(health1-8);
    			if(rd(0,1)<=pct)
    			{
    				return 7;
				}
				else goto E;
			}
		}
		E:
		if(power2>=2)
		{
			if(health1<=4)
			{
				return 0;
			}
			else
			{
				double r1=rd(0,1),r2=rd(0,1);
				if(r1>=r2) return 0;
				goto EE;
			}
		}
		EE:
		if(power1>=4)
		{
			if(health2<=8)
			{
				if(power2>=2)
				{
					double pct=rd(0,0.3);
					if(rd(0,1)>=pct) return 8;
					else
					{
						goto GG;
					}
				}
			}
			else
			{
				double pct=rd(0,0.5);
				if(power2>=2&&rd(0,1)>=pct) return 8;
				else
				{
					goto GG;
				}
			}
		}
		GG:
    	int xl = health2;
    	double g = rd(0, 1);
    	double pct = ((1.0 - xl / 15.0) * 0.7);
    	if(g<=pct&&power2>=1) return 5;
    	else
    	{
    		return rdz(1, 4);
		}
    }
}

//片段5 根据双方行动, 执行一回合的对战
bool fight(int d1, int d2)
{ 
    if (d1 < 0 || d1 > 8)
    {
        cout << "【【【武将1没有这种策略啦~重新开始回合" << cnt << "!】】】" << endl;
        return true;  
    }          
    if ((d1 == 0 && power1 < 2))
    {
        cout << "【【【武将1不够气来放必杀!重新开始回合" << cnt << "!】】】" << endl;
        return true;     
    }
    if(d1==7 && power1<4)
	{
		cout << "【【【武将1不够气来放末日!重新开始回合" << cnt << "!】】】" << endl;
        return true;
	
    }
     if (d1==5&&power1<1)
    {
        cout << "【【【武将1没气回血啦~重新开始回合" << cnt << "!】】】" << endl;
        return true;  
    }    
     if (d1==8&&power1<2)
    {
        cout << "【【【武将1没气保佑啦~重新开始回合" << cnt << "!】】】" << endl;
        return true;  
    }  
    if(d2==6)
    {
    	cout<<"【【【武将1死了!】】】"<<"\n";
    	health1=0;
    	return 0;
	}
	u=0;
	y=0;
	srand((int)time(NULL));
	int rrr=rand()%8;
	int yyy=rand()%2 ;
	u=rrr;
	y=yyy;
	if(rrr==5)kkk(yyy,d1,d2,power1,power2);
	
    cout << "【【【" ;
    cout<<"["<<d2<<"]  ";
    if(mom1>0)
    {
    	mom1--;
    	health2--;
    }
    if(mom2>0)
    {
    	mom2--;
    	health1--;
    }
    
    if(d1==5&&d2==5)
    {
    	power1--;
    	power2--;
    	cout<<"大加血!";
    	health1+=2;
    	health2+=2;
    }
    if((d1==5&&d2==2)||(d1==5&&d2==3))
    {
    	power1-=1;
    	health1+=2;
    	if(d2==3)power2++;
    	cout<<"补血成功!";
    }
    if((d1==2&&d2==5)||(d1==3&&d2==5))
    {
    	power2--;
    	health2+=2;
    	if(d1==3)power1++;
    	cout<<"补血成功!";
    }
    if(d1==5&&d2==1)
    {
    	power1--;
    	cout<<"打断补血";
    }
    if(d1==5&&d2==4)
    {
    	
    	power1--;
    	cout<<"打断补血";
    }
    if(d2==5&&d1==1)
    {
    	power2--;
    	cout<<"打断补血";
    }
    if(d1==4&&d2==5)
    {
    	
    	power2--;
    	cout<<"打断补血";
    }
    if (d1 == 1 && d2 == 1)
    {
        cout << "两人同时攻击,相安无事";
    }
    if (d1 == 1 && d2 == 2)
    {
        power2++;
        health1--; 
        cout << "武将2反弹了武将1的攻击,得1气";
    }
    if (d1 == 2 && d2 == 1)
    {
        power1++;
        health2--;
        cout << "武将1反弹了武将2的攻击,得1气";
    }
    if (d1 == 2 && d2 == 2)
    {
        cout << "两人同时防御,相安无事";
    }
    if (d1 == 1 && d2 == 3)
    {
        health2--;
        cout << "武将2集气时受到武将1的攻击,损失1生命";
    }
    if (d1 == 3 && d2 == 1)
    {
        health1--;
        cout << "武将1集气时受到武将2的攻击,损失1生命";
    }
    if (d1 == 2 && d2 == 3)
    {
        power2++;
        cout << "武将2趁武将1防御时集气,得1气";
    }
    if (d1 == 3 && d2 == 2)
    {
        power1++;
        cout << "武将1趁武将2防御时集气,得1气";
    }
    if (d1 == 3 && d2 == 3)
    {
        power1++;
        power2++;
        cout << "双方同时集气,各得1气";
    }
    if (d1 == 0 && d2 != 0&&d2 != 8)
    {
        power1 -= 2;
        health2 -= 3;
        cout << "武将1使出必杀,对对手造成3伤害";
    }
    if (d1 != 0 && d2 == 0 && d1!=8)
    {
        power2 -= 2;
        health1 -= 3;
        cout << "武将2使出必杀,对对手造成3伤害";
    }
    if (d1 == 0 && d2 == 0)
    {
        power1 -= 2;
        power2 -= 2;
        cout << "双方同时必杀,相安无事";
    }
    if(d1==7&&d2!=8)
    {
    	health2-=7;
    	power1-=4;
    }
    if(d2==7&&d1!=8)
    {
    	health1-=7;
    	power2-=4;
    }
    if(d1==7&&d2==7)
    {
    	cout<<"晴天";
    }
    if(d1 == 6 && health2<=2 && mmm >0 && d2!=8)
    {
    	health2-=1;
    	mmm-=1;
    	cout<<"最后终结!";
    }
    if(d1==6 && health2>2)
    {
    	cout << "【【【武将1不能来终结!重新开始回合" << cnt << "!】】】" << endl;
        return true;
    }
    if( d1==4 && d2==4)
    {
    	cout<<"同时劫气";
    }
    if(d1 ==4&&d2==2)
    {
    	cout<<"劫气失败,反弹";
    	health1--; 
    	power2++;
    }
    if(d2 ==4&&d1==2)
    {
    	cout<<"劫气失败,反弹";
    	power1++;
    	health2--;
    }
    if(d1 ==4&&d2==1)
    {
    	cout<<"劫气失败";
    	
    	health1--;
    	
    }
    if(d1 ==4&&d2==3)
    {
    	cout<<"劫气大成";
    	power1++;
    	power2--;
    }
    if(d2 ==4&&d1==1)
    {
    	cout<<"劫气失败";
    	
    	health2--;
    	
    }
    if(d2 ==4&&d1==3)
    {
    	cout<<"劫气大成";
    	power2++;
    	power1--;
    }
    if(d1==8)
    {
    	power1-=2;
    	if(d2==2)cout<<"防御无效";
    	if(d2==3)
    	{
    		cout<<"防御无效";
    		power2++;
    	}
    	if(d2==8)
    	{
    		cout<<"大浪费";
    		power2-=2;
    	}
    	if(d2==1)
    	{
    		cout<<"反弹";
    		health2-=1;
    		power1++;
    	}
    	if(d2==4)
    	{
    		power1++;
    		cout<<"反弹";
    		health2--;
    	}
    	if(d2==5)
    	{
                power2--;
    		health2+=2;
    	}
    	if(d2==0||d2==7)
    	{
    		cout<<"防御!";
    		if(d2==0){
    			cout<<"反弹";
				health2-=3; 
				power2-=2;
			} 
    		if(d2==7)power2-=4;
    	}
    	
    }
    if(d2==8)
    {
    	power2-=2;
    	if(d1==2)cout<<"防御无效";
    	if(d1==3)
    	{
    		cout<<"防御无效";
    		power1++;
    	}
    	if(d1==8)
    	{
    		cout<<"大浪费";
    		power1-=2;
    	}
    	if(d1==1)
    	{
    		cout<<"反弹";
    		health1-=1;
    		power2++;
    	}
    	if(d1==4)
    	{
    		power2++;
    		cout<<"反弹";
    		health1--;
    	}
    	if(d1==5)
    	{
                power1--;
    		health1+=2;
    	}
    	if(d1==0||d1==7)
    	{
    		cout<<"防御!";
    		if(d1==0){
    			cout<<"反弹";
				health1-=3; 
				power1-=2;
			} 
    		if(d1==7)power1-=4;
    	}
    	
    }
    
    cout << "】】】" << endl;
    ++kk;
    if(power1<0)power1=0;
    if(power2<0)power2=0;
    if(health1>15)health1=15;
    if(health2>15)health2=15;
    return false;
}

//片段6 本回合战后统计
void result()
{   
    cout << "【双方状态】" << endl;
    cout << "*武将1:  生命" << health1 << "   气" << power1 << endl;
    cout << "*武将2:  生命" << health2 << "   气" << power2 << endl << endl;        
}

//片段7 公布对战结果, winner == 1 代表武将1胜, winner == 2 代表武将2胜
void showWinner(int winner)
{ 
    cout << endl << "【单挑结束!!!!!】" << endl;
    if (winner == 1) cout << "武将1战胜卢轩轩获胜!!!!" << endl;
    else cout << "武将2击败对手获胜!!!!" << endl;
    cout << endl << endl;
}
int ppp(int x,int y,int z,int w)
{
	
	if(z==1)
	{
		int Q=x*3+y+1;
		while(Q>60)
		Q-=10;
		return Q;
	}
	if(z==0)
	{
		int P=100-x-y+2*w;
		if(P>100)P=100;
		return P;
	}
}
//片段2 进行游戏
int pk()
{
    int cnt = 0;
    while (true)
    {
        // 一方倒下游戏结束
        if (health1 <= 0) return 2;
        if (health2 <= 0) return 1;

        cout << "【开始回合" << ++cnt << "】" << endl;
		if(u==5)
		{
			cout<<"神的佑护已发下"<<endl;
			ooo++;
		}       // 片段3 确定人类策略, 
        int human = human::strategy();
        // 片段4 确定电脑策略
        int ai = ai::strategy();
        if(u==5&&y==0)human=8;
        if(u==5&&y==1)ai=8;
        if(u==5&&y==0)
		{
			power1+=2;
			cout<<"保佑你"<<endl; 
		}
		if(u==5&&y==1)
		{
			cout<<"保佑对方"<<endl; 
			power2+=2;
		} 
        //片段5 对战
        bool err = fight(human, ai);
		
        //片段6 本回合战后统计
        if (!err) result();         
        else cnt--;
    }
}

int main()
{   
    //片段1 游戏介绍
    intro();

    //片段2 进行游戏
    int winner = pk();

    //片段7 公布对战结果
    showWinner(winner);
    if(health1<1)qqqq=1;
    if(health2<1)qqqq=0;
    int QQ=ppp(kk,ooo,qqqq,health1);
    cout<<QQ<<"分"<<endl;
    if(QQ>=86&&QQ<90)
    {
    	cout<<"A"<<endl;
    	cout<<"晋级"<<endl;
    //	cout<<"无赠送技能";
    }
    if(QQ>=90&&QQ<95)
    {
    	cout<<"S"<<endl;
    	cout<<"晋级"<<endl;
    	srand(time(0));
    	int yt=rand()%2 + 1;
    //	if(yt==0)cout<<"赠送血量卡‘7’";
    //	else cout<<"赠送战斗卡‘-6’";
    }
    if(QQ>=95&&QQ<98)
    {
    	cout<<"SS"<<endl;
    	cout<<"晋级"<<endl;
    	srand(time(0));
    	int yt=rand()%2 + 1;
    //	if(yt==0)cout<<"赠送血量卡‘8’";
    //	else cout<<"赠送战斗卡‘-8’";
    }
    if(QQ>=98&&QQ<100)
    {
    	cout<<"SSS"<<endl;
    	cout<<"晋级"<<endl;
    	srand(time(0));
    	int yt=rand()%2 + 1;
    //	if(yt==0)cout<<"赠送血量卡‘9’";
    //	else cout<<"赠送战斗卡‘-9’";
    }
    if(QQ==100)
    {
    	cout<<"SSS+"<<endl;
    	cout<<"晋级"<<endl;
    	srand(time(0));
    	int yt=rand()%2 + 1;
    //	if(yt==0)cout<<"赠送血量卡‘100’"<<endl;
    //	else cout<<"赠送战斗卡‘-100’"<<endl;
    }
    if(QQ<86) 
    {
    	cout<<"已结束";
    	return 0;
    }
    // 游戏介绍
    

    // 游戏环节

    // 结果
   
    return 0;
}

《酋长追寻》

//游戏名:《酋长追寻》,作者:xtmg·xsf ,特别感谢cjb,核弹djb,zdw 
//游戏简介:让‘杜’绕过‘坤’的阻碍成功到达‘章’,‘套’可以增加 破冰次数、左上次数并且还有隐藏功能。 
//操作:1上,2左上,3左,0重启(另外加一行列),4核弹(破冰) 
//新增: 人机模式,颜色字体,胜率计算,自定义棋盘 
//于2023.6.19日更新完毕 
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;

int a[1005][1005];
int cnt1,cnt2,cnt3;// 使用次数 
int boom=1; 
bool zhufu=0;
int cnt=60;//初始行列数
bool renji=0;
bool replay=0;
int shengju=0; 
float shenglv;

void pobing()//破冰!!! 
{
	Sleep(500);
	char k='B';
	for(int i=1;i<=150;i++)
	{
		for(int j=1;j<=i;j++)cout<<k;
		cout<<endl;	
	}	
	cout<<"必";
	Sleep(500);
	cout<<"杀";
	Sleep(500);
	cout<<"技:"<<endl;
	Sleep(500);
	cout<<"破冰!";
	Sleep(1000);
	cout<<endl;
	cout<<endl;	
} 

void print()//打印棋盘(表格) 
{
	for(int i=cnt;i>0;i--)
	{
		for(int j=cnt;j>0;j--)
		{			
			if(a[i][j]==0)printf("%*s",2,"");
			else if(a[i][j]==1)
			{
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 2);
				printf("%s","杜");
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
				
			}
			else if(a[i][j]==2)
			{
				printf("%s","坤");

			}
			else if(a[i][j]==3)
			{
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 6);
				printf("%s","蔚");
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
			}
			else if(a[i][j]==4)
			{
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
				printf("%s","套");
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
			}						
		}
		cout<<endl; 
	}
	printf("%s%i%*s","上:",cnt1,2,"");
	printf("%s%i%*s","左上:",cnt2,2,"");
	printf("%s%i%*s","左:",cnt3,2,"");
	printf("%s%i%*s","破冰:",boom,2,"");
	printf("%s%i%*s","行列数:",cnt,2,"");
	printf("%s%i%*s","胜局:",shengju,2,"");
	printf("%s%.1f%s%*s\n","胜率:",shenglv,"%",2,"");
	
}

void add(int xnow,int ynow)//增加障碍物 
{
	if(a[xnow+1][ynow]==2&&a[xnow][ynow+1]==2&&a[xnow+1][ynow+1]==2)return;
	
	
	if(zhufu==1)
	{	
		int kk=rand()%4+1;
		if(kk==1)return;
	}
	
	int k=rand()%3+1;
	if(k==1&&a[xnow+1][ynow]!=3&&a[xnow+1][ynow]!=4)
	{
		if(a[xnow+1][ynow]==2)
		{
			add(xnow,ynow);
			return;
		}
		a[xnow+1][ynow]=2;
	}
	else if(k==2&&a[xnow+1][ynow+1]!=3&&a[xnow+1][ynow+1]!=4)
	{
		if(a[xnow+1][ynow+1]==2)
		{
			add(xnow,ynow);
			return;
		}
		a[xnow+1][ynow+1]=2;
	}
	else if(k==3&&a[xnow][ynow+1]!=3&&a[xnow][ynow+1]!=4)
	{
		if(a[xnow][ynow+1]==2)
		{
			add(xnow,ynow);
			return;
		}
		a[xnow][ynow+1]=2;
	}
	return;
} 
void play()//开始游戏 
{	
	zhufu=0;
	boom=true;
	
	cnt1=cnt;
	cnt2=sqrt(3*cnt)+int(cnt/30)-1;
	cnt3=cnt;
	replay=0;
	
	for(int i=1;i<=cnt;i++)
	{
		for(int j=1;j<=cnt;j++)
		{
			a[i][j]=0;
		}
	}
	a[cnt/4][3*cnt/5]=4;
	a[3*cnt/5][cnt/4]=4;
	a[cnt/2][cnt/2]=4;
	a[3*cnt/4][3*cnt/4]=4;
	a[cnt/4][cnt/4]=4;
	
	a[1][1]=1;
	a[cnt][cnt]=3;
	int xnow=1,ynow=1;
	
	print();
	print();
	print();
	for(int i=1;i<=cnt+1;i++)
	{
		a[i][cnt+1]=2;
		a[cnt+1][i]=2;
	}
	
	
	while(a[cnt][cnt]==3)
	{
		int i=getchar()-48;				
		if(i>=0&&i<=4)
		{			
			if(i==4&&boom>=1)
			{
				boom--;
				for(int k=1;k<=cnt;k++)for(int l=1;l<=cnt;l++)if(a[k][l]==2)a[k][l]=0;
				pobing();					
			} 
			if(i==0)
			{
				replay=1;
				cnt++;
				return;
			}
			
			if(i==1&&a[xnow+1][ynow]!=2&&cnt1>0)
			{
				a[xnow][ynow]=0;
				xnow++;
				a[xnow][ynow]=1;
				cnt1--;
				add(xnow,ynow);
			}
			if(i==2&&a[xnow+1][ynow+1]!=2&&cnt2>0)
			{
				a[xnow][ynow]=0;
				ynow++;
				xnow++;
				a[xnow][ynow]=1;
				cnt2--;
				add(xnow,ynow);
			}
			if(i==3&&a[xnow][ynow+1]!=2&&cnt3>0)
			{
				a[xnow][ynow]=0;
				ynow++;
				a[xnow][ynow]=1;
				cnt3--;
				add(xnow,ynow);
			}
			if(xnow==cnt/4&&ynow==3*cnt/5)
			{
				cout<<"获得祝福:有1/4概率不生成'坤'"<<endl;
				zhufu=1;				
			}
			if(xnow==3*cnt/5&&ynow==cnt/4)
			{
				cout<<"酒店大套餐(3次左上,1个破冰)"<<endl;
				boom+=1;
				cnt2+=3;			
			}			
			if((xnow==cnt/2)&&(ynow==cnt/2)||(xnow==cnt/4&&ynow==cnt/4)||(xnow==3*cnt/4&&ynow==3*cnt/4))
			{
				int p=rand()%12+1;			
				if(p==1||p==2)
				{
					cout<<"这是‘三无劣质’(随机生成一个‘坤’)"<<endl;
					add(xnow,ynow);
					 
				}
				else if(p==3||p==4||p==5||p==6)
				{
					cout<<"这是2和3的(加2次左上)"<<endl;
					cnt2+=2;
				}
				else if(p==7||p==8)
				{
					cout<<"春意套(灵魂出窍套)(隐藏功能)"<<endl;
					xnow+=3;
					ynow+=3;
					a[xnow][ynow]=1;
				}
				else{
					cout<<"这是安全的(加一次破冰)"<<endl;
					boom++;
				}	
			}
			//胜率计算 
			int aaa=min(cnt-xnow,cnt-ynow)+1;
			shenglv=((cnt2+boom)*150.0/aaa);
			int bbb=abs(xnow-ynow);
			int bianliang1=aaa-cnt2-boom;
			if(bianliang1<=0)bianliang1=1;
			shenglv-=(bbb-boom)*150.0/bianliang1;
			if(shenglv<=0)shenglv=0.99;
			if(shenglv>=100)shenglv=100;
			
			print();
		}
	
	}

	cnt++;
	shengju++;
	return;
}

void renzhiyin()
{
	zhufu=0;
	boom=true;
	
	cnt1=cnt-2;
	cnt2=sqrt(3*cnt)+int(cnt/30)-1;
	cnt3=cnt-2;
	replay=0;
	
	for(int i=1;i<=cnt+1;i++)
	{
		for(int j=1;j<=cnt+1;j++)
		{
			a[i][j]=0;
		}
	}
	a[cnt/4][3*cnt/5]=4;
	a[3*cnt/5][cnt/4]=4;
	a[cnt/2][cnt/2]=4;
	a[3*cnt/4][3*cnt/4]=4;
	a[cnt/4][cnt/4]=4;
	
	a[1][1]=1;
	a[cnt][cnt]=3;
	int xnow=1,ynow=1;
	
	print();
	print();
	print();
	for(int i=1;i<=cnt+1;i++)
	{
		a[i][cnt+1]=2;
		a[cnt+1][i]=2;
	}
	
	while(a[cnt][cnt]==3)
	{
		int i=99;
		if(a[xnow+1][ynow]==2&&a[xnow][ynow+1]==2&&a[xnow+1][ynow+1]==2)
		{
			if(boom>0)
			{
				
				i=4;
			}
			if(boom==0)i=0;
			
		} 
		else if(a[xnow+1][ynow]==2&&a[xnow][ynow+1]==2)
		{
			if(cnt2>0)i=2;
			if(cnt2==0)
			{
				if(boom>0)
				{
					
					i=4;
				}
				if(boom==0)i=0;
			}
		}
		else if(a[xnow+1][ynow]==2)i=3;			
		else if(a[xnow][ynow+1]==2)i=1;
		
		if(i==99)
		{
			if(xnow>=ynow)i=3;
			if(xnow<ynow)i=1;
		}
		
		if(i>=0&&i<=4)
		{			
			if(i==4&&boom>=1)
			{
				boom--;
				for(int k=1;k<=cnt;k++)for(int l=1;l<=cnt;l++)if(a[k][l]==2)a[k][l]=0;
				pobing();					
			} 
			if(i==0)
			{
				replay=1;
				cnt++;
				return;
			}
			
			if(i==1&&a[xnow+1][ynow]!=2&&cnt1>0)
			{
				a[xnow][ynow]=0;
				xnow++;
				a[xnow][ynow]=1;
				cnt1--;
				add(xnow,ynow);
			}
			if(i==2&&a[xnow+1][ynow+1]!=2&&cnt2>0)
			{
				a[xnow][ynow]=0;
				ynow++;
				xnow++;
				a[xnow][ynow]=1;
				cnt2--;
				add(xnow,ynow);
			}
			if(i==3&&a[xnow][ynow+1]!=2&&cnt3>0)
			{
				a[xnow][ynow]=0;
				ynow++;
				a[xnow][ynow]=1;
				cnt3--;
				add(xnow,ynow);
			}
			if(xnow==cnt/4&&ynow==3*cnt/5)
			{
				cout<<"获得祝福:有1/4概率不生成'坤'"<<endl;
				zhufu=1;				
			}
			if(xnow==3*cnt/5&&ynow==cnt/4)
			{
				cout<<"酒店大套餐(3次左上,2个破冰)"<<endl;
				boom+=2;
				cnt2+=3;			
			}			
			if((xnow==cnt/2)&&(ynow==cnt/2)||(xnow==cnt/4&&ynow==cnt/4)||(xnow==3*cnt/4&&ynow==3*cnt/4))
			{
				int p=rand()%12+1;			
				if(p==1||p==2)
				{
					cout<<"这是‘三无劣质’(随机生成一个‘坤’)"<<endl;
					add(xnow,ynow);
					 
				}
				else if(p==3||p==4||p==5||p==6)
				{
					cout<<"这是2和3的(加2次左上)"<<endl;
					cnt2+=2;
				}
				else if(p==7||p==8)
				{
					cout<<"春意套(灵魂出窍套)(隐藏功能)"<<endl;
					xnow+=2;
					ynow+=2;
					a[xnow][ynow]=1;
				}
				else{
					cout<<"这是安全的(加一次破冰)"<<endl;
					boom++;
				}				
			}
			//胜率计算 
			int aaa=min(cnt-xnow,cnt-ynow)+1;
			if(zhufu==1)shenglv=((cnt2*2+boom)*150.0/aaa);
			else shenglv=((cnt2+boom)*150.0/aaa);
			int bbb=abs(xnow-ynow);
			int bianliang1=aaa-cnt2-boom;
			if(bianliang1<=0)bianliang1=1;
			shenglv-=(bbb-boom)*150.0/bianliang1;
			if(shenglv<=0)shenglv=0.99;
			if(shenglv>=100)shenglv=99.9;
			
			print();
		}
		Sleep(450);
	
	}

	shengju++;
	cnt++;

	return;
}

int main()//主程序 
{
	std::ios::sync_with_stdio(false);
	srand(time(NULL));
	cout<<"欢迎来到《酋长追寻》,作者xsf,特别感谢cjb,djb,zdw"<<endl;
	Sleep(1000);
	cout<<"模式选择:1——自己操作     2——人机模式  (输入1或2)"<<endl;
	int ans;
	cin>>ans;
	cout<<"请输入行列数(建议20~60)";
	int cntc;
	cin>>cntc;
	cnt=cntc;
	//人机模式 
	if(ans==2){
			renji=1;
		if(renji=1)
		{
			renzhiyin();
			while(replay=1)renzhiyin();
		}
	}
	//正常模式 
	else{
		play();
		while(replay=1)play();
	}

	return 0;
}