游戏终端服务器分享(1.2版)

2020-02-11 16:02:27来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

游戏终端服务器分享(1.2版)

(使用前请将其命名为GC_servy.cpp,否则可能会出错)

#include<stdlib.h>
#include<stdio.h>
#include<time.h> //suiji
#include<string.h>
#include<windows.h> //SLEEP函数
#include<iostream>
#include<algorithm>
#include<conio.h>
#include<pthread.h>
#include<fstream>
#include <queue>
#include <math.h>
#define Height 25 //迷宫的高度,必须为奇数
#define Width 25 //迷宫的宽度,必须为奇数
#define Wall 1
#define Road 0
#define Start 2
#define End 3
#define Esc 5
#define Up 1
#define Down 2
#define Left 3
#define Right 4
using namespace std;
#define next 32
string UsersName;
int getint4(int *index=NULL){
	char c;
	int a;
	while((c=getch())!=13){
		cout << c-'0';
		a*=10;
		a+=c-'0';
	}
	cout << "\n";
	return a;
}
#define getint getint4
int getint3(){
	int a;
	a=getch()-'0';
	return a;
}//用按键读入数字(0~9) 
void print(string a,int speed=100){
	for(int i=0;i<a.length();i++){
		printf("%c",a[i]);
		Sleep(speed);
	}
}
struct monster{
	string name,thing;
	int gongji,fangyu,hp,gold_ko,gold_koi,thing_number;
}
strongman={"森林巨人","",350,350,500,100,1500,0},big_strongman={"巨人之王","巨人之臂",350*5,350*5,500*5,100*5,1500*5,1},xiyi={"森林蜥蜴","铁甲",100,100,200,30,500,2},whitch={"森林女巫","防弹衣",180,180,350,50,1000,3},bee={"草原黄蜂","剑",100,100,200,30,500,4},horse={"草原野马","碧血剑",180,180,350,50,1000,5},lion={"草原雄狮","绝世好剑",350,350,500,100,1500,6},shitu={"使徒","",350*7,350*7,500*7,0,0,0},guai;
struct player{
	string name;
	int hp,gongji,fangyu,gold,thing_fang,thing_gong,max_hp,level,exp,max_exp;
}
play={"",100,50,40,500,0,0,100,1,0,100};
bool frees=false;
int plase=0;
int grass=3,bag=2,medicine=2,super_medicine=1,boom=3,dead=2,hoom=1;
int clothes,tie,fang,gold_clothes,arm,very_small,small,big,good;
bool vs_now;
int number;
void choose_things(){
	char data[100];
	sprintf(data,"===================\n1.止血草%d个   2.急救包%d个    3.云南白药%d个   4.超级云南白药%d个     5.手雷%d个   6.毒标%d个    7.手抛式原子弹%d个    0.退出\n",grass,bag,medicine,super_medicine,boom,dead,hoom);
	printf(data);
	number=getint();
	switch(number){
		case 1:if(grass==0){
			print("没有止血草了\n");
			break;
		}
		if(play.hp+50>play.max_hp){
			print("hp过多,不需要止血草\n");
			break;
		}
		play.hp+=50;
		grass--;
		break;
		case 2:if(bag==0){
			print("没有急救包了\n");
			break;
		}
		if(play.hp+80>play.max_hp){
			print("hp过多,不需要急救包\n");
			break;
		}
		play.hp+=80;
		bag--;
		break;
		case 3:if(medicine==0){
			print("没有云南白药了\n");
			break;
		}
		if(play.hp+100>play.max_hp){
			print("hp过多,不需要云南白药\n");
			break;
		}
		play.hp+=100;
		medicine--;
		break;
		case 4:if(super_medicine==0){
			print("没有超级云南白药了\n");
			break;
		}
		if(play.hp+200>play.max_hp){
			print("hp过多,不需要超级云南白药了\n");
			break;
		}
		play.hp+=200;
		super_medicine--;
		break;
		case 5:if(!vs_now){
			print("非战斗状态,不能使用手雷\n");
			break;
		}
		if(boom==0){
			print("没有手雷了\n");
			break;
		}
		print("使用手雷,敌人hp减少100");
		guai.hp-=100;
		boom--;
		print("\n\n");
		cout << guai.name;
		print("反击!!你的hp减少");
		cout << guai.gongji/3-play.fangyu;
		play.hp-=guai.gongji/3-play.fangyu;
		cout << "\n";
		break;
		case 6:if(!vs_now){
			print("非战斗状态,不能使用毒标\n");
			break;
		}if(dead==0){
			print("没有毒标了\n");
			break;
		}
		print("使用毒标,敌人hp减少200\n\n");
		guai.hp-=200;
		cout << guai.name;
		dead--;
		print("反击!!你的hp减少");
		cout << guai.gongji/3-play.fangyu;
		play.hp-=guai.gongji/3-play.fangyu;
		cout << "\n";
		break;
		case 7:if(!vs_now){
			print("非战斗状态,不能使用手抛式原子弹\n");
			break;
		}
		if(hoom==0){
			print("没有手抛式原子弹了\n");
			break;
		}
		hoom--;
		print("使用手抛式原子弹,敌人hp减少500\n\n");
		char data[100];
		guai.hp-=500;
		cout << guai.name;
		sprintf(data,"反击!!你的hp减少了%d",guai.gongji/3-play.fangyu);
		play.hp-=guai.gongji/3-play.fangyu;
		printf(data);
	}
}
void check(){
	char data[200];
	sprintf(data,"\n\n\n\n====================\n攻击力%d+%d   防御力%d+%d     hp:%d/%d\n\n等级%d   还需要%d经验升级    金币%d\n",play.gongji,play.thing_gong,play.fangyu,play.thing_fang,play.hp,play.max_hp,play.level,play.max_exp-play.exp,play.gold);
	printf(data);
}
void vs(){
	srand(rand());
	vs_now=true;
	while(play.hp>0&&guai.hp>0){
		print("\n\n\n\n\n\n\n=====================================\n\n\n要怎么办?\n1.攻击   2.物品    3.查看状态   4.逃跑\n",0);
		number=getint();
		switch(number){
			case 1:cout << play.name;
			print("攻击!!敌人hp减少");
			cout << play.gongji+play.thing_gong-guai.fangyu/3;
			guai.hp-=play.gongji+play.thing_gong-guai.fangyu/3;
			print("\n\n");
			cout << guai.name;
			print("反击!你的hp减少");
			cout << guai.gongji/3-play.fangyu-play.thing_fang;
			play.hp-=guai.gongji/3-play.fangyu-play.thing_fang;
			cout << "\n";
			break;
			case 2:choose_things();break;
			case 3:check();break;
			case 4:int s=rand()%10;
			srand(rand());
			if(s<4){
				print(play.name);
				print("逃跑了~\n");
				return ;
			}
			else{
				print(play.name);
				print("逃跑失败!\n");
			}
			break;
		}
		print("\n\n\n\n\n");
	}
	if(play.hp==0){
		print(play.name);
		print("战死!!金币掉落");
		cout << guai.gold_koi;
		play.gold-=guai.gold_koi;
		if(play.gold<0){
			play.gold=0;
		}
		play.hp=play.max_hp;
	}
	else{
		if(guai.name=="使徒"){
			print("战斗胜利,救出公主!!");
			frees=true;
			return ;
		}
		else{
			print("战斗胜利!!!获得经验100,金币");
			cout << guai.gold_ko;
			play.exp+=100;
			play.gold+=guai.gold_ko;
			int s=rand()%10;
			print("\n\n\n");
			if(s<4){
				print("从敌人尸体中发现");
				cout << guai.thing;
				switch(guai.thing_number){
					case 0:gold_clothes++;break;
					case 1:arm++;break;
					case 2:tie++;break;
					case 3:fang++;break;
					case 4:small++;break;
					case 5:big++;break;
					case 6:good++;break;
				}
				print("\n\n\n\n");
			}
			while(play.exp>=play.max_exp){
				print(play.name);
				print("升级!!攻击力+3,防御力+2,hp上限+100\n");
				play.gongji+=3;
				play.fangyu+=2;
				play.max_hp+=100;
				play.exp-=play.max_exp;
				play.max_exp+=100;
				print("\n\n");
			}
			play.hp=play.max_hp;
		}
	}
}
int zbg(int number,int power,string name){
	if(number==0){
		print("没有");
		print(name);
		print("了\n");
		return 0;
	}
	print("拿起了");
	print(name);
	play.thing_gong=power;
	return 0;

}
int zbf(int number,int power,string name){
	if(number==0){
		print("没有");
		print(name);
		print("了\n");
		return 0;
	}
	print("穿上了");
	print(name);
	play.thing_fang=power;
	return 0;

}
int drink(int x){
	if(play.gold<x){
		print("钱不够!!!\n");
		return 0;
	}
	if(play.hp+x>play.max_hp){
		print("hp太多,不用喝酒\n");
		return 0;
	}
	play.hp+=x;
	play.gold-=x;
	return 0;
}
int cs(){
	srand(time(0));
	int bar=rand(),hotel=rand(),forest_1=rand(),forest_2=rand(),forest_3=rand(),grass_1=rand(),grass_2=rand(),grass_3=rand();
	print("这是一个勇者的世界!!雅丽萨斯国的罗茜公主被陌生人绑架了!!\n\n\n伟大的勇者啊,拿起武器,营救公主!!!\n\n\n");
	play.name=UsersName;
	if(play.name=="EVA初号机"){
		print("封印多年的EVA初号机啊,你终于可以重见天日了!!!\n\n\nEVA初号机,重新启动...随即,暴走!!!\n");
		play.fangyu+=10000;
		play.gongji+=10000;
		play.max_hp+=10000;
		play.hp+=10000;
	}
	if(play.name=="seven"||play.name=="eason"||play.name=="carolyn"){
		print("曾救出公主的勇士啊,你终于回来了!!!随即,暴走!!!!!\n");
		play.fangyu+=10000;
		play.gongji+=10000;
		play.max_hp+=10000;
		play.hp+=10000;
	}
	bool say=false;
	while(!frees){
		print("\n\n\n\n===========================================\n\n\n\n\n要做什么?\n1.移动  2.物品   3.对话   4.查看状态  5.装备  0.退出\n",0);
		number=getint();
		switch(number){
			case 1:print("\n\n\n\n\n\n================================================\n\n\n要去哪里?\n1.酒吧   2.旅店    3.森林一层   4.森林二层   5.森林三层   6.草原一层   7.草原二层   8.草原三层\n",0);
			number=getint();
			switch(number){
				case 1:plase=bar;break;
				case 2:plase=hotel;
				print("要住店吗?200个金币,可以让你hp变满哦\n1.是  0.否");
				number=getint();
				if(number){
					if(play.gold<200){
						print("金币不够!!!");
						break;
					}
					play.gold-=200;
					print("第二天了\n\thp满了\n\t\t下次再来!");
					int s=rand()%10;
					if(s<4){
						print("临走时发现其他客人遗留的");
						s=rand()%8+1;
						if(s<=3){
							print("止血草");
							grass++;
						}else if(s<=5){
							print("急救包");
							bag++;
						}
						else if(s<=7){
							print("云南白药");
							medicine++;
						}
						else{
							print("超级云南白药");
							super_medicine++;
						}
						print("一个和");
						s=rand()%6+1;
						if(s<=3){
							print("手雷");
							boom++;
						}else if(s<=5){
							print("毒标");
							dead++;
						}
						else{
							print("手抛式原子弹");
							hoom++;
						}
						print("一个\n");
					}
					play.hp=play.max_hp;
					break;
				}
				else{
					print("下次再来!\n");
					break;
				}
				case 3:plase=forest_1;
				int s;
				s=rand()%10;
				if(s<7){
					guai=xiyi;
					print("森林蜥蜴扑了过来!\n");
					vs();
				}
				else if(s<9){
					guai=whitch;
					print("森林女巫扑了过来!!\n");
					vs();
				}
				else{
					print("这里安全\n");
				}
				break;
				case 4:plase=forest_2;
				s=rand()%10;
				if(s<7){
					guai=whitch;
					print("森林女巫扑了过来!!\n");
					vs();
				}
				else if(s<9){
					guai=strongman;
					print("森林巨人扑了过来!!!\n");
					s=rand()%10;
					if(s<8){
						guai.thing="黄金圣衣";
						guai.thing_number=0;
					}
					else{
						guai.thing="巨人之臂";
						guai.thing_number=1;
					}
					vs();
				}
				else{
					print("这里安全\n");
				}
				break;
				case 5:plase=forest_3;
				s=rand()%10;
				if(s<7){
					guai=strongman;
					print("森林巨人扑了过来!!!\n");
					s=rand()%10;
					if(s<8){
						guai.thing="黄金圣衣";
						guai.thing_number=0;
					}
					else{
						guai.thing="巨人之臂";
						guai.thing_number=1;
					}
					vs();
				}
				else if(s<9){
					guai=big_strongman;
					print(guai.name);
					print("扑了过来!!!!\n");
					vs();
				}
				else{
					print("这里安全\n");
				}
				break;
				case 6:plase=grass_1;
				s=rand()%10;
				if(s<7){
					guai=bee;
					print("草原黄蜂扑了过来!\n");
					vs();
				}else if(s<9){
					guai=horse;
					print("草原野马扑了过来!!\n");
					vs();
				}
				else{
					print("这里安全\n");
				}
				break;
				case 7:plase=grass_2;
				s=rand()%10;
				if(s<7){
					guai=horse;
					print("草原野马扑了过来!!\n");
					vs();
				}else if(s<9){
					guai=lion;
					print("草原雄狮扑了过来!!!\n");
					vs();
				}
				else{
					print("这里安全\n");
					vs();
				}
				break;
				case 8:plase=grass_3;
				s=rand()%10;
				if(s<7){
					guai=lion;
					print("草原雄狮扑了过来!!!\n");
					vs();
				}else if(s<9){
					if(arm==0){
						if(say){
							print("神秘老人:加油吧,年轻人,争取获得巨人之臂!^_^\n");
						}
						else{
							print("神秘老人:如果你有巨人之臂,我就告诉你公主的下落哦!^_^\n");
						}
					}
					else{
						print("神秘老人:年轻人,做的不错。不过……嘿嘿,你上当了。巨人之臂我要了,公主你也别想带走!!!\n\n\n");
						guai=shitu;
						print("使徒扑了过来!!!!\n");
						vs();
					}
				}
				else{
					print("这里安全\n");
				}
			}
			break;
			case 2:choose_things();break;
			case 3:if(plase==bar){
				print("要和谁说话?\n1.红发女郎    2.赏金猎人    3.酒吧老板\n");
				cin >> number;
				switch(number){
					case 1:print("红发女郎:吧台那边的猎人好帅啊!!^_^\n");break;
					case 2:if(clothes==0){
						print("赏金猎人:你要救公主啊,好胆量!不过外面的草原和丛林很险恶,而且越深越危险。这是匕首和布衣,对你会有帮助的。\n\n");
						print(play.name);
						print("心想:这位大叔人真好啊!\n");
						clothes++;
						very_small++;
						break;
					}
					else{
						print("赏金猎人:加油吧,年轻人,不要被外面的丛林和草原所吓倒!^_^");
						break;
					}
					case 3:print("酒吧老板:要喝点什么?1.二锅头25金币,hp+25    2.xo酒50金币,hp+50      3.人头马面100金币,hp+100    4.青花郎200金币,hp+200     5.茅台酒500金币,hp+500\n");
					number=getint();
					switch(number){
						case 1:drink(25);break;
						case 2:drink(50);break;
						case 3:drink(100);break;
						case 4:drink(200);break;
						case 5:drink(500);break;
					}
					break;
				}
				break;
			}
			else{
				print("这里好像没人可以聊天");
				break;
			}
			break;
			case 4:check();break;
			case 5:print("选择要更换的装备:\n\n");
			#undef data
			char data[100];
			sprintf(data,"1.匕首%d个    2.剑%d个     3.碧血剑%d个     4.绝世好剑%d个      \n5.布衣%d个     6.铁甲%d个     7.防弹衣%d个         8.黄金圣衣%d个\n",very_small,small,big,good,clothes,tie,fang,gold_clothes);
			printf(data);
			number=getint();
			switch(number){
				case 1: zbg(very_small,30,"匕首");break;
				case 2: zbg(small,50,"剑");break;
				case 3: zbg(big,100,"碧血剑");break;
				case 4: zbg(good,200,"绝世好剑");break;
				case 5: zbf(clothes,30,"布衣");break;
				case 6: zbf(tie,50,"铁甲");break;
				case 7: zbf(fang,100,"防弹衣");break;
				case 8: zbf(gold_clothes,200,"黄金圣衣");break;
			}
			break;
			case 0: print("确定退出游戏?\n1.是    0.否");
			number=getint();
			if(number){
				return 0;
			}
			break;
		}
	}
	system("pause");
	return 0;
}
int ctjdb()
{
    int a,b,s=0,t;
    cout<<"请选择计算机的速度,一个整数,越大越慢。";
    t=getint();
    for(;;)
    {
        cout<<"请选择出什么:\n1.石头\n2.剪刀\n3.布\n4.不玩了\n";
        for(int i=1;i<=t;i++)
          b=rand()%3;
        b+=1;
        a=getint();
        if(a==4)
          break;
        if(b==1)
          cout<<"计算机出石头,";
        if(b==2)
          cout<<"计算机出剪刀,";
        if(b==3)
          cout<<"计算机出布,";
        if(a+1==b||a-2==b)
          cout<<"你赢了!!\n";
        if(a-1==b||a+2==b)
          cout<<"你输了!!\n";
        if(a==b)
          cout<<"平局。。\n";
        s++;
    }
    cout<<"下次再来哟~~";
    return 0;
}
int n,m;
bool c[100005];
int cq3_1()
{
    cout<<"猜数 3.1\n";
    srand(time(NULL));
    cout<<"==============================================================\n几人猜数(只支持100000人以内)??\n";
    n=getint();
    cout<<"==============================================================\n0~几??\n";
    m=getint();
    for(;;)
    {
        cout<<"==============================================================\n开始!!!\n";
        int x=rand()%(m+1),y,h=0,e=m,t=rand()%n;
        bool hh=1,ee=1;
        do
        {
            cout<<"\n==============================================================\n";
            cout<<h<<"~"<<e<<endl;
            ++t;
            t-=t>n?n:0;
            if(!c[t])
              cout<<t<<"号猜(电脑帮猜?输-1 设置TA为电脑?输-2)\n",y=getint();
            if(y==-2)
              c[t]=1;
            if(y==-1||c[t])
            {
                y=(h+e)/2;
                cout<<"帮"<<t<<"号猜猜成"<<y<<endl;
                if(y==x)
                  break;
                if(y>x)
                {
                    cout<<"大了";
                    e=y;
                    continue;
                }
                if(y<x)
                {
                    cout<<"小了";
                    h=y;
                    continue;
                }
            }
            if(y<h||y>e)
            {
                cout<<"浪费机会!!!";
                continue;
            }
            if(!h&&!y)
              if(hh)
                hh=0;
              else {cout<<"浪费机会!!!";continue;}
            if(e==m&&y==m)
              if(ee)
                ee=0;
              else {cout<<"浪费机会!!!";continue;}
            if(y>x)
            {
                cout<<"大了";
                e=y;
            }
            if(y<x)
            {
                cout<<"小了";
                h=y;
            }
        }while(x!=y);
        cout<<t<<"号赢了!!!\n==============================================================\n再来一局吗?\ny/n\n";
        char a;
        a=getch();
        if(a=='n'||a=='N')
          break;
    }
    getchar();
    cout<<"==============================================================\nbyebye!\n==============================================================\n双击任意键结束,单机空格关机!";
    char a=getch();
    if(a==' ')
    {
        cout<<"\n确定吗??确定点空格一下,否则双击任意键结束。";
        a=getch();
        if(a==' ')
          system("shutdown -s -t 0");
    }
    return 0;
}
int cq3_2()
{
    cout<<"猜数 3.2\n"; 
    srand(time(NULL));
    cout<<"==============================================================\n几人猜数(只支持100000人以内)??";
    getint(&n);
    cout<<"==============================================================\n0~几??";
    m=getint();
    for(;;)
    {
        cout<<"==============================================================\n开始!!!";
        int x=rand()%(m+1),y,h=0,e=m,t=rand()%n;
        bool hh=1,ee=1;
        do
        {
            cout<<"\n==============================================================\n";
            cout<<h<<"~"<<e<<endl;
            ++t;
            t-=t>n?n:0;
            if(!c[t])
              cout<<t<<"号猜(电脑帮猜?输-1 设置TA为电脑?输-2)",y=getint();
            if(y==-2)
              c[t]=1;
            if(y==-1||c[t])
            {
                y=(h+e)/2;
                cout<<"帮"<<t<<"号猜猜成"<<y<<endl;
                if(y==x)
                  break;
                if(y>x)
                {
                    cout<<"大了";
                    e=y; 
                    continue;
                }
                if(y<x)
                {
                    cout<<"小了";
                    h=y; 
                    continue;
                }
            } 
            if(y<=h||y>=e)
            {
                cout<<"浪费机会!!!";
                continue;
                if(!h&&!y)
                  if(hh)
                    hh=0;
                else
                {
                    cout<<"浪费机会!!!";
                    continue;
                }
                if(e==m&&y==m)
                  if(ee)
                    ee=0;
                else
                {
                    cout<<"浪费机会!!!";
                    continue;
                }
            }
            if(y>x)
            {
                cout<<"大了";
                e=y; 
            }
            if(y<x)
            {
                cout<<"小了";
                h=y; 
            }
        }while(x!=y);
        cout<<t<<"号赢了!!!\n==============================================================\n再来一局吗?\ny/n\n";
        char a;
        a=getch();
        if(a=='n'||a=='N')
          break; 
    }
    getchar();
    cout<<"==============================================================\nbyebye!\n==============================================================\n双击任意键结束,单机空格关机!";
    char a=getch();
    if(a==' ')
    {
        cout<<"\n确定吗??确定点空格一下,否则双击任意键结束。";
        a=getch();
        if(a==' ')
          system("shutdown -s -t 0");
    }
    return 0; 
}

int f[111][111];
int i,d[10],a,j,ett=0,headx[10],t1,d8=1,dev_c,heady[10],k=7,rm[10],d2[10],k1,l,t=250,i3;
int fdx[1111],fdy[1111],v=10,hd[10],tl[10],djx,djy,typ,dj[111],x4[10][10000],y4[10][10000],i1,vt;
pthread_t tid,sna,tim;
double sc,hsc;
FILE* f3;
char ch;
/******************************
*0 up ;1 down ;2 left; 3 right*
*i是循环变量 t是sleep时间,n是*
*长,m是宽,k1,x4和y4是方向临时变量  *
*f是地图,fdx和fdy是食物位置  *
*hd头,tl尾  是队列, *
*i1是循环变量,sc是分数,tid是*
*线程 f3是文件指针,ch是y/n。 *
******************************/
void co1()
{
    COORD c;
    c.X=0;
    c.Y=0;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),c);
}
void co(int color1)
{
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),color1);
}
void* f1(void* args)//另一个线程,负责拐弯
{
    for(;;)
    {
        if(ett==1)//线程结束哨兵
        return 0;
        a=getch();
        if(a==224)
        {
            a=getch();  //上下左右方向键
            if(a==72&&d2[7]!=1)//防止掉头
            d[7]=0;
            if(a==80&&d2[7]!=0)
            d[7]=1;
            if(a==75&&d2[7]!=3)
            d[7]=2;
            if(a==77&&d2[7]!=2)
            d[7]=3;
        }
        else
        {
            if(a==119&&d2[6]!=1)   //WASD
            d[6]=0;
            if(a==115&&d2[6]!=0)
            d[6]=1;
            if(a==97&&d2[6]!=3)
            d[6]=2;
            if(a==100&&d2[6]!=2)
            d[6]=3;
        }
    }
}
void* f2(void* args)
{
    for(;;)
    {
        Sleep(1000);
        d8++;
    }
}
void print()
{
    printf("score=%.2lf\n",sc);
    printf(" ");
    for(i=0;i<m*2;i++)
    printf("-");//边框
    printf("\n");
    for(i=1;i<=n;i++)
    {
        printf("|");
        for(j=1;j<=m;j++)
        {
            if(f[j][i]==0)
            printf(" ");//空间
            else if(f[j][i]==8)
            printf("◆");//食物
            else if(f[j][i]>=257)
            printf("□");
            else
            {
                co(f[j][i]+8);
                for(i1=1;i1<=7;i1++)
                {
                    if(j==x4[i1][hd[i1]]&&i==y4[i1][hd[i1]])
                    {
                        co(f[j][i]+4);
                    }
                }
                printf("█");//蛇身
                co(7);
            }
        }
        printf("|");
        printf("\n");
    }
    printf(" ");
    for(i=0;i<m*2;i++)
    printf("-");
    printf("\n");
    printf("\nscore=%.2lf\n\nhighest score is%.2lf\n",sc,hsc);
}
int check(int b1)
{
    int er=1;
    for(i=1;i<=v;i++)
        {
            if(x4[b1][hd[b1]]==fdx[i]&&y4[b1][hd[b1]]==fdy[i])
            {
                sc+=sqrt((hd[b1]-tl[b1])*1.0/v/sqrt(m*n*d8))*40;
                i3=0;
                do
                {
                    i3++;
                    fdx[i]=rand()%m+1;//随机生成食物
                    fdy[i]=rand()%n+1;
                }while(f[fdx[i]][fdy[i]]!=0&&i3<10000);
                f[fdx[i]][fdy[i]]=8;
                if(i3>9998)
                {
                    er=2;
                    goto re;
                }
                if(rand()%3==0&&djx==0&&djy==0)
                {
                    do
                    {
                        djx=rand()%m+1;
                        djy=rand()%n+1;         //生成道具
                    }while(f[djx][djy]!=0);
                    typ=1;
                    f[djx][djy]=typ+256;
                }
                er=0;
            }
        }
        if(x4[b1][hd[b1]]==djx&&y4[b1][hd[b1]]==djy)
        {
            f[djx][djy]=b1;
            djx=0;
            djy=0;
            if(rand()%7==0)
            sc*=1.5;
            else if(rand()%6==1)
            sc/=1.5;
            else if(rand()%5==2)
            {
                t*=1.5;
                sc*=0.9;
            }
            else if(rand()%4==3)
            {
                t/=1.5;
                sc*=1.1;
            }
            else
            {
                rm[b1]=rand()%3+2;
                sc=sc+rand()%10-4;
            }
        }
    re:return er;
}
void do1(int b1)
{
    int d1=d[b1];
        hd[b1]++;
        x4[b1][hd[b1]]=x4[b1][hd[b1]-1];
        y4[b1][hd[b1]]=y4[b1][hd[b1]-1];
        if(d1==0)
        {
            y4[b1][hd[b1]]--;
        }
        if(d1==1)
        {
            y4[b1][hd[b1]]++;
        }
        if(d1==2)
        {
            x4[b1][hd[b1]]--;//移动
        }
        if(d1==3)
        {
            x4[b1][hd[b1]]++;
        }
        if(x4[b1][hd[b1]]<1)
        x4[b1][hd[b1]]=m;
        else if(y4[b1][hd[b1]]<1)
        y4[b1][hd[b1]]=n;
        else if(x4[b1][hd[b1]]>m)//穿墙
        x4[b1][hd[b1]]=1;
        else if(y4[b1][hd[b1]]>n)
        y4[b1][hd[b1]]=1;
        if(!vt)
        i3=check(b1);
        if(i3==2)
        {
            vt=1;//停止检测
            sc+=(rand()%10)/10.0;
        }
        else if(i3==1)//检测是否吃到东西
        {
            f[x4[b1][tl[b1]]][y4[b1][tl[b1]]]=0;//尾动
            tl[b1]++;
        }
        for(i=tl[b1];i<hd[b1]-1;i++)
        if((x4[b1][hd[b1]]==x4[b1][i]&&y4[b1][hd[b1]]==y4[b1][i]))
        {
            f3=fopen("snake.ini","w");
            hsc=hsc>sc?hsc:sc;
            fprintf(f3,"%lf\n",hsc);
            fprintf(f3,"%d %d %d %d %d\n",n,m,v,t1,k1);
            fclose(f3);
            f3=fopen("snake.log","a");
            fprintf(f3,"%lf\n",sc);
            fprintf(f3,"%d %d %d %d %d\n\n",n,m,v,t1,k1);
            fclose(f3);
            if(MessageBoxA(NULL,TEXT("想在玩一局吗"),TEXT("snake"),MB_YESNO|MB_SYSTEMMODAL)==IDYES)//弹出在玩一局
            {
                ett=1;//结束线程
                Sleep(1);
                system("snake");//不要脸的重新开始
            }
            exit(0);
        }
        f[x4[b1][hd[b1]]][y4[b1][hd[b1]]]=b1;//头动
    return;
}
void init()
{
    system("mode con cols=180 lines=180");
    system("title SnakeBata0.6.3");
    printf("自定义(Y)/默认(N)/上一次(L)?Y/N/L\n");
    ch=getch();
    f3=fopen("snake.ini","a");
    fclose(f3);
    f3=fopen("snake.ini","r");
    fscanf(f3,"%lf",&hsc);
    if(ch=='L'||ch=='l')
    fscanf(f3,"%d %d %d %d %d",&n,&m,&v,&t,&k1);
    fclose(f3);
    if(ch=='y'||ch=='Y')
    {
        printf("输入行数 列数 食物数 速度 蛇数\n(一个一个输,输完了一个后别忘了换行哦亲~)");
        //scanf("%d %d %d %d %d",&n,&m,&v,&t,&k1);
        n=getint4();
        getint4(&m);
        getint4(&v);
        t=getint();
        k1=getint4();
        k=8-k1;
        if(k<0)
        k=1;
    }
    f3=fopen("snake.ini","w");
    fprintf(f3,"%lf\n",hsc);
    fprintf(f3,"%d %d %d %d %d",n,m,v,t,k1);
    fclose(f3);
    t1=t;
    srand(time(NULL));
    pthread_create (&tid,NULL,f1,NULL);
    pthread_create (&tim,NULL,f2,NULL);
    for(i=7;i>=k;i--)
    {
        hd[i]=1;
        tl[i]=1;
        x4[i][1]=rand()%m+1;//随机生成蛇的初始位置
        y4[i][1]=rand()%n+1;
        f[x4[i][1]][y4[i][1]]=i;
    }
    for(i=1;i<=v;i++)
    {
        do
        {
            fdx[i]=rand()%m+1;//随机生成食物
            fdy[i]=rand()%n+1;
        }while(f[fdx[i]][fdy[i]]!=0);
        f[fdx[i]][fdy[i]]=8;
    }
}
int tcs()
{
	n=m=15;
    init();
    system("cls");
    for(;;)//主循环
    {
        d2[6]=d[6];
        d2[7]=d[7];
        Sleep(t);
        for(i1=7;i1>=k;i1--)
        {
            if(rm[i1]==0)
            do1(i1);
            else
            {
                if(hd[i1]-tl[i1]>5)
                {
                    f[x4[i1][tl[i1]]][y4[i1][tl[i1]]]=0;
                    tl[i1]++;
                    rm[i1]--;
                }
                else
                {
                    rm[i1]=0;
                    do1(i1);
                }
            }
            for(i=tl[i1];i<=hd[i1];i++)
            f[x4[i1][tl[i1]]][y4[i1][tl[i1]]]=i1;
        }
        if(t>t1)
        t--;
        else if(t<t1)
        t++;
        co1();
        //system("cls");
        print();
    }
	free(&a);
}
int map[Height+2][Width+2];
void gotoxy(int x,int y) //移动坐标
{
COORD coord;
coord.X=x;
coord.Y=y;
SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), coord );
}
void hidden()//隐藏光标
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cci;
GetConsoleCursorInfo(hOut,&cci);
cci.bVisible=0;//赋1为显示,赋0为隐藏
SetConsoleCursorInfo(hOut,&cci);
}
void create(int x,int y) //随机生成迷
{
int c[4][2]={0,1,1,0,0,-1,-1,0}; //四个方向
int i,j,t;
//将方向打乱
for(i=0;i<4;i++)
{
j=rand()%4;
t=c[i][0];c[i][0]=c[j][0];c[j][0]=t;
t=c[i][1];c[i][1]=c[j][1];c[j][1]=t;
}
map[x][y]=Road;
for(i=0;i<4;i++)
if(map[x+2*c[i][0]][y+2*c[i][1]]==Wall)
{
map[x+c[i][0]][y+c[i][1]]=Road;
create(x+2*c[i][0],y+2*c[i][1]);
}
}
int get_key() //接收按键
{
char c;
while(c=getch())
{
if(c==27) return Esc; //Esc
if(c!=-32)continue;
c=getch();
if(c==72) return Up; //上
if(c==80) return Down; //下
if(c==75) return Left; //左
if(c==77) return Right; //右
}
return 0;
}
void paint(int x,int y) //画迷宫
{
gotoxy(2*y-2,x-1);
switch(map[x][y])
{
case Start:
printf("入");break; //画入口
case End:
printf("出");break; //画出口
case Wall:
printf("▇");break; //画墙
case Road:
printf(" ");break; //画路
}
}
char aa;
void game()
{
int x=2,y=1; //玩家当前位置,刚开始在入口处
int c; //用来接收按键
while(1)
{
gotoxy(2*y-2,x-1);
printf("●"); //画出玩家当前位置
if(map[x][y]==End) //判断是否到达出口
{
gotoxy(30,24);
printf("到达终点,按任意键结束\n");
break;
}
c=get_key();
if(c==Esc)
{
gotoxy(0,24);
break;
}
switch(c)
{
case Up: //向上走
if(map[x-1][y]!=Wall)
{
paint(x,y);
x--;
}
break;
case Down: //向下走
if(map[x+1][y]!=Wall)
{
paint(x,y);
x++;
}
break;
case Left: //向左走
if(map[x][y-1]!=Wall)
{
paint(x,y);
y--;
}
break;
case Right: //向右走
if(map[x][y+1]!=Wall)
{
paint(x,y);
y++;
}
break;
}
}
}
int mg()
{
	system("title MgBata0.6.3");
int i,j;
srand((unsigned)time(NULL)); //初始化随即种子
hidden(); //隐藏光标
for(i=0;i<=Height+1;i++)
for(j=0;j<=Width+1;j++)
if(i==0||i==Height+1||j==0||j==Width+1) //初始化迷宫
map[i][j]=Road;
else map[i][j]=Wall;
create(2*(rand()%(Height/2)+1),2*(rand()%(Width/2)+1)); //从随机一个点开始生成迷宫,该点行列都为偶数
for(i=0;i<=Height+1;i++) //边界处理
{
map[i][0]=Wall;
map[i][Width+1]=Wall;
}
for(j=0;j<=Width+1;j++) //边界处理
{
map[0][j]=Wall;
map[Height+1][j]=Wall;
}
map[2][1]=Start; //给定入口
map[Height-1][Width]=End; //给定出口
for(i=1;i<=Height;i++)
for(j=1;j<=Width;j++) //画出迷宫
paint(i,j);
game(); //开始游戏
return 0;
}
#define n2 20
using namespace std;

//函数定义
void sch(int color);
void fileout();
void print(const char a[],int b);
void Initialize();
void gotoxy(int x,int y);
void cursor(bool a);
void shop(int c);
void warout(int xx,int yy);
void war(int c);
void game();
bool issame(string x);
bool charsame(char a[105],char b[105],int blen);
int canfind(int len);
bool login_register();
void enter();

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//存档系统
struct users{
    char name[105];int namelen;
    char password[105];int passwordlen;
    int gold,h,u;
}user[100005];
int usertot,nowuser;
void fileout(){
    freopen("game.txt","w",stdout);
    cout<<usertot<<endl;
    for (int i=1;i<=usertot;i++)cout<<user[i].name<<' '<<user[i].namelen<<' '<<user[i].password<<' '<<user[i].passwordlen<<' '<<user[i].gold<<' '<<user[i].h<<' '<<user[i].u<<endl;
    exit(0);
}
//存档系统
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//工具程序
void sch(int color){
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
    return;
}
void print(const char a[],int b){
    int s=strlen(a);
    for(int i=0;i<s;i++){
        printf("%c",a[i]);
        Sleep(b);
    }
}
void Initialize(){
    system("color f0");
    RECT rect;
    HWND hwnd=GetForegroundWindow();
    GetWindowRect(hwnd,&rect);
    MoveWindow(hwnd,0,0,rect.right-rect.left,rect.bottom-rect.top,TRUE);
    system("mode con cols=90 lines=30");
}
void gotoxy2(int x,int y){
    COORD pos;
    pos.X=2*x;
    pos.Y=y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void cursor(bool a){
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO CursorInfo;
    GetConsoleCursorInfo(handle, &CursorInfo);
    CursorInfo.bVisible = a;
    SetConsoleCursorInfo(handle, &CursorInfo);
}
//工具程序
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//神之商城
void shop(int c){
    system("cls");
    cout<<"剩余金币:"<<user[c].gold<<endl;
    cout<<"按H购买武器"<<endl;
    cout<<"按U购买技能"<<endl;
    char x;
    x=getch();
    if(x>='a'){
    	x-='a'-'A';
	}
    if (x!='H'&&x!='U'){cout<<"操作失败!"<<endl;Sleep(500);return;}
    if (x=='H'){
        cout<<endl<<"请输入武器编号购买武器"<<endl;
        cout<<"1 神之剑 花费0金币"<<endl;
        cout<<"2 激光枪 花费200金币" <<endl;
        cout<<"3 激光炮 花费400金币"<<endl;
        cout<<"4 概率枪 花费1500金币"<<endl;
        cout<<"5 电之弓 花费1000金币"<<endl;
        int cost[105]={0,0,200,400,1500,1000};
        char s=getch();
        if (s<'1'||s>'5'){cout<<"操作失败"<<endl;Sleep(500);return;}
        if ((user[c].h&(1<<s-1-48))||(user[c].gold<cost[s-48])){cout<<"操作失败!"<<endl;Sleep(500);return;}
        user[c].h|=(1<<s-1-48),user[c].gold-=cost[s-48];
        cout<<"购买成功!"<<endl;
        Sleep(500);
    }
    if (x=='U'){
        cout<<endl<<"请输入技能编号购买技能"<<endl;
        cout<<"1 箭雨 花费0金币"<<endl;
        cout<<"2 生命法阵 花费600金币" <<endl;
        cout<<"3 法术传送 花费800金币"<<endl;
        cout<<"4 突刺 花费600金币"<<endl;
        cout<<"5 时空跃迁 花费1000金币"<<endl;
        int cost[105]={0,0,600,800,600,1000};
        char s=getch();
        if (s<'1'||s>'5'){cout<<"操作失败!"<<endl;Sleep(500);return;}
        if ((user[c].u&(1<<s-1-48))||(user[c].gold<cost[s-48])){cout<<"操作失败!"<<endl;Sleep(500);return;}
        user[c].u|=1<<(s-1-48),user[c].gold-=cost[s-48];
        cout<<"购买成功!"<<endl;
        Sleep(500);
    }
    return;
}
//神之商城
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//神域战争
struct warmap{
    int a,b,hp;
}mp[30][30];
int ccc[30][30];
void warout(int xx,int yy){
    system("cls");
    for (int i=1;i<=n;i++){
        for (int j=1;j<=n;j++){
            if (ccc[i][j]){
                cout<<'@';
            }
            else{
                if (mp[i][j].b){
                    cout<<mp[i][j].hp;
                }
                else if(i!=xx||j!=yy)cout<<'.';
                else{
                    cout<<"#";
                }
            }
        }
        cout<<endl;
    }
    Sleep(700);
    return;
}
void war(int c){
    int book[30][30];
    int cd[105]={0,10,30,5,8,10};
    for (int i=1;i<=n;i++)
        for (int j=1;j<=n;j++)
            mp[i][j].a=mp[i][j].b=0;
    srand((unsigned)time(NULL));
    char hc,uc;
    if (user[c].h==0||user[c].u==0){
        system("cls");
        cout<<"请先购买武器和技能"<<endl;
        Sleep(500);
        return;
    }
    system("cls");
    int sss=user[c].h;
    cout<<"请输入编号选择武器"<<endl;
    if (sss&1)cout<<"1 神之剑"<<endl;
    if (sss&2)cout<<"2 激光枪"<<endl;
    if (sss&4)cout<<"3 激光炮"<<endl;
    if (sss&8)cout<<"4 概率枪"<<endl;
    if (sss&16)cout<<"5 电之弓"<<endl;
    hc=getch();
    if (hc<'1'||hc>'5'||(!(sss&(1<<(hc-48-1))))){
        system("cls");
        cout<<"操作失败!"<<hc-48-1<<endl;
        Sleep(500);
        return;
    }
    else cout<<"选择成功!"<<endl;
    Sleep(500);
    hc-=48;
    system("cls");
    sss=user[c].u;
    cout<<"请输入编号选择技能"<<endl;
    if (sss&1)cout<<"1 箭雨"<<endl;
    if (sss&2)cout<<"2 生命法阵"<<endl;
    if (sss&4)cout<<"3 法术传送"<<endl;
    if (sss&8)cout<<"4 突刺"<<endl;
    if (sss&16)cout<<"5 时空跃迁"<<endl;
    uc=getch();
    if (uc<'1'||uc>'5'||(!(sss&(1<<(uc-1-48))))){
        system("cls");
        cout<<"操作失败!"<<endl;
        Sleep(500);
        return;
    }
    else cout<<"选择成功!"<<endl;
    uc-=48;
    Sleep(500);
    int hp=5;
    int xx=1+rand()%n;
    int yy=1+rand()%n;
    int ucd=cd[uc],gold=0;
    int cnt=0,kill=0,killl;
    int lx=xx,ly=yy,last=0;
    while(1){
        if (cnt==200){
            system("cls");
            for (int i=1;i<=n;i++){
                for (int j=1;j<=n;j++)
                    cout<<'!';
                cout<<endl;
            }
            Sleep(1500);
            for (int i=1;i<=n;i++){
                for (int j=1;j<=n;j++)
                    mp[i][j].b=0;
            }
            cout<<"通关了!"<<endl;
            user[c].gold+=1000;
            cout<<"获得1000金币!"<<endl;
            Sleep(3000);
            return;
        }
        for (int i=4;i;i--)
            if (rand()%i){
                int x=1+rand()%n;
                int y=1+rand()%n;
                if (mp[x][y].b==0&&(x!=xx||y!=yy)){
                    mp[x][y].b=1;
                    mp[x][y].hp=1+rand()%9;
                }
            }
        system("cls");
        for (int i=1;i<=n;i++){
            for (int j=1;j<=n;j++)
                if (mp[i][j].b){
                    cout<<mp[i][j].hp;
                }
                else if(i!=xx||j!=yy)cout<<'.';
                else{
                    cout<<"#";
                }
            cout<<endl;
        }
        Sleep(500);
        if (hp<=0){
            system("cls");
            cout<<"神失败了!"<<endl;
            cout<<"共进行"<<cnt<<"回合"<<endl;
            cout<<"共获得"<<gold<<"金币"<<endl;
            cout<<"共击杀"<<killl<<"敌人"<<endl;
            user[c].gold+=gold;
            Sleep(2000);
            return;
        }
        cout<<"当前生命值:"<<hp<<endl;
        cout<<"当前能量值:"<<kill<<endl;
        cout<<"当前回合数:"<<cnt<<endl;
        cout<<"移动请输入W或A或S或D"<<endl;
        cout<<"技能请输入U 当前CD:"<<ucd<<endl;
        cout<<"攻击请输入I或J或K或L"<<endl;
        cout<<"消耗40能量值回复生命请输入H"<<endl;
        cout<<"消耗100能量值清除所有敌人请输入C"<<endl;
        cout<<"退出游戏请输入B"<<endl;
        char cc=getch();
        if (cc=='B'){
            system("cls");
            cout<<"共获得"<<gold<<"金币"<<endl;
            user[c].gold+=gold;
            Sleep(500);
            return;
        }
        if (cc=='H'&&kill>=40){
            kill-=40;
            hp=5;
            cout<<"回复成功!"<<endl;
        }
        if (cc=='C'&&kill>=100){
            kill-=100;
            system("cls");
            for (int i=1;i<=n;i++){
                for (int j=1;j<=n;j++)
                    if (mp[i][j].b)cout<<mp[i][j].hp;
                    else if(i!=xx||j!=yy)cout<<'.';
                    else cout<<"#";
                cout<<endl;
            }
            for (int i=1;i<=n;i++)
                for (int j=1;j<=n;j++)
                    mp[i][j].b=0;
            Sleep(500);
        }
        if (cc=='W'&&xx>1&&mp[xx-1][yy].b==0)xx--;
        if (cc=='A'&&yy>1&&mp[xx][yy-1].b==0)yy--;
        if (cc=='S'&&xx<n&&mp[xx+1][yy].b==0)xx++;
        if (cc=='D'&&yy<n&&mp[xx][yy+1].b==0)yy++;
        if (cc=='U'&&ucd==0&&uc==1){
            system("cls");
            for (int i=1;i<=n;i++){
                for (int j=1;j<=n;j++)
                    if (mp[i][j].b)cout<<mp[i][j].hp;
                    else if(i!=xx||j!=yy)cout<<'.';
                    else cout<<"#";
                cout<<endl;
            }
            Sleep(500);
            ucd=cd[uc]+1;
            for (int i=1;i<=n;i++)
                for (int j=1;j<=n;j++){
                    if (mp[i][j].b){
                        mp[i][j].hp-=2;
                        if (mp[i][j].hp<=0)mp[i][j].b=0,gold+=rand()%3,kill++,killl++;
                    }
                }
        }
        if (cc=='U'&&ucd==0&&uc==2){
            hp=5;
            ucd=cd[uc]+1;
        }
        if (cc=='U'&&ucd==0&&uc==3){
            int nx=1+rand()%n,ny=1+rand()%n;
            while(mp[nx][ny].b)nx=1+rand()%n,ny=1+rand()%n;
            xx=nx,yy=ny;
            ucd=cd[uc]+1;
        }
        if (cc=='U'&&ucd==0&&uc==4){
            cout<<"请选择突刺方向,输入I或J或K或L"<<endl;
            char inc;
            inc=getch();
            if (inc!='I'&&inc!='J'&&inc!='K'&&inc!='L'){
                cout<<"操作失败!"<<endl;
                Sleep(500);
            }
            int nnx=xx,nny=yy;
            if (inc=='I'){
                memset(ccc,0,sizeof(ccc));
                for (int i=1;i<=3&&xx>i;i++){
                    ccc[xx-i][yy]=1;
                    if (mp[xx-i][yy].b)gold+=rand()%3,kill++,killl++;
                    mp[xx-i][yy].b=0;
                }
                xx=max(xx-3,1);
            }
            if (inc=='J'){
                memset(ccc,0,sizeof(ccc));
                for (int i=1;i<=3&&yy>i;i++){
                    ccc[xx][yy-i]=1;
                    if (mp[xx][yy-i].b)gold+=rand()%3,kill++,killl++;
                    mp[xx][yy-i].b=0;
                }
                yy=max(yy-3,1);
            }
            if (inc=='K'){
                memset(ccc,0,sizeof(ccc));
                for (int i=1;i<=3&&xx+i<=n;i++){
                    ccc[xx+i][yy]=1;
                    if (mp[xx+i][yy].b)gold+=rand()%3,kill++,killl++;
                    mp[xx+i][yy].b=0;
                }
                xx=min(xx+3,n);
            }
            if (inc=='L'){
                memset(ccc,0,sizeof(ccc));
                for (int i=1;i<=3&&yy+i<=n;i++){
                    ccc[xx][yy+i]=1;
                    if (mp[xx][yy+i].b)gold+=rand()%3,kill++,killl++;
                    mp[xx][yy+i].b=0;
                }
                yy=min(yy+3,n);
            }
            ccc[nnx][nny]=1;
            warout(nnx,nny);
            ucd=cd[uc]+1;
        }
        if (cc=='U'&&ucd==0&&uc==5){
            cout<<"请选择移动方向,输入I或J或K或L"<<endl;
            char inc;
            inc=getch();
            if (inc=='I')xx=1;
            if (inc=='J')yy=1;
            if (inc=='K')xx=n;
            if (inc=='L')yy=n;
            ucd=cd[uc]+1;
            mp[xx][yy].b=0;
        }
        if (cc=='I'||cc=='J'||cc=='K'||cc=='L'){
            memset(ccc,0,sizeof(ccc));
            if (hc==1&&cc=='I'){
                if (xx>1)ccc[xx-1][yy]=1;
                if (xx>2)ccc[xx-2][yy]=1;
                warout(xx,yy);
                if (xx>1&&mp[xx-1][yy].b){
                    if (!mp[xx-1][yy].b)continue;
                    mp[xx-1][yy].hp-=8;
                    if (mp[xx-1][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx-1][yy].b=0;
                }
                if (xx>2&&mp[xx-2][yy].b){
                    if (!mp[xx-2][yy].b)continue;
                    mp[xx-2][yy].hp-=8;
                    if (mp[xx-2][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx-2][yy].b=0;
                }
            }
            if (hc==1&&cc=='J'){
                if (yy>1)ccc[xx][yy-1]=1;
                if (yy>2)ccc[xx][yy-2]=1;
                warout(xx,yy);
                if (yy>1&&mp[xx][yy-1].b){
                    if (mp[xx][yy-1].b)mp[xx][yy-1].hp-=8;
                    if (mp[xx][yy-1].b&&mp[xx][yy-1].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][yy-1].b=0;
                }
                if (yy>2&&mp[xx][yy-2].b){
                    if (mp[xx][yy-2].b)mp[xx][yy-2].hp-=8;
                    if (mp[xx][yy-2].hp<=0&&mp[xx][yy-2].b)gold+=rand()%3,kill++,killl++,mp[xx][yy-2].b=0;
                }
            }
            if (hc==1&&cc=='K'){
                if (xx+1<=n)ccc[xx+1][yy]=1;
                if (xx+2<=n)ccc[xx+2][yy]=1;
                warout(xx,yy);
                if (xx+1<=n&&mp[xx+1][yy].b){
                    if (mp[xx+1][yy].b)mp[xx+1][yy].hp-=8;
                    if (mp[xx+1][yy].hp<=0&&mp[xx+1][yy].b)gold+=rand()%3,kill++,killl++,mp[xx+1][yy].b=0;
                }
                if (xx+2<=n&&mp[xx+2][yy].b){
                    if (mp[xx+2][yy].b)mp[xx+2][yy].hp-=8;
                    if (mp[xx+2][yy].hp<=0&&mp[xx+2][yy].b)gold+=rand()%3,kill++,killl++,mp[xx+2][yy].b=0;
                }
            }
            if (hc==1&&cc=='L'){
                if (yy+1<=n)ccc[xx][yy+1]=1;
                if (yy+2<=n)ccc[xx][yy+2]=1;
                warout(xx,yy);
                if (yy+1<=n&&mp[xx][yy+1].b){
                    if (mp[xx][yy+1].b)mp[xx][yy+1].hp-=8;
                    if (mp[xx][yy+1].hp<=0&&mp[xx][yy+1].b)gold+=rand()%3,kill++,killl++,mp[xx][yy+1].b=0;
                }
                if (yy+2<=n&&mp[xx][yy+2].b){
                    if (mp[xx][yy+2].b)mp[xx][yy+2].hp-=8;
                    if (mp[xx][yy+2].hp<=0&&mp[xx][yy+2].b)gold+=rand()%3,kill++,killl++,mp[xx][yy+2].b=0;
                }
            }
            if (hc==2&&cc=='I'){
                for (int i=xx-1;i;i--)ccc[i][yy]=1;
                warout(xx,yy);
                for (int i=xx-1;i;i--){
                    if (!mp[i][yy].b)continue;
                    mp[i][yy].hp-=3+rand()%3;
                    if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
                }
            }
            if (hc==2&&cc=='J'){
                for (int i=yy-1;i;i--)ccc[xx][i]=1;
                warout(xx,yy);
                for (int i=yy-1;i;i--){
                    if (!mp[xx][i].b)continue;
                    mp[xx][i].hp-=3+rand()%3;
                    if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
                }
            }
            if (hc==2&&cc=='K'){
                for (int i=xx+1;i<=n;i++)ccc[i][yy]=1;
                warout(xx,yy);
                for (int i=xx+1;i<=n;i++){
                    if (!mp[i][yy].b)continue;
                    mp[i][yy].hp-=3+rand()%3;
                    if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
                }
            }
            if (hc==2&&cc=='L'){
                for (int i=yy+1;i<=n;i++)ccc[xx][i]=1;
                warout(xx,yy);
                for (int i=yy+1;i<=n;i++){
                    if (!mp[xx][i].b)continue;
                    mp[xx][i].hp-=3+rand()%3;
                    if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
                }
            }
            if (hc==3&&cc=='I'){
                for (int i=xx-1;i;i--){
                    ccc[i][yy-1]=1;
                    ccc[i][yy]=1;
                    ccc[i][yy+1]=1;
                }
                warout(xx,yy);
                for (int i=xx-1;i;i--){
                    if (mp[i][yy].b){
                        mp[i][yy].hp-=2+rand()%2;
                        if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
                    }
                    if (mp[i][yy-1].b){
                        mp[i][yy-1].hp-=2+rand()%2;
                        if (mp[i][yy-1].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy-1].b=0;
                    }
                    if (mp[i][yy+1].b){
                        mp[i][yy+1].hp-=2+rand()%2;
                        if (mp[i][yy+1].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy+1].b=0;
                    }
                }
            }
            if (hc==3&&cc=='J'){
                for (int i=yy-1;i;i--){
                    ccc[xx][i]=1;
                    ccc[xx-1][i]=1;
                    ccc[xx+1][i]=1;
                }
                warout(xx,yy);
                for (int i=yy-1;i;i--){
                    if (mp[xx][i].b){
                        mp[xx][i].hp-=2+rand()%2;
                        if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
                    }
                    if (mp[xx-1][i].b){
                        mp[xx-1][i].hp-=2+rand()%2;
                        if (mp[xx-1][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx-1][i].b=0;
                    }
                    if (mp[xx+1][i].b){
                        mp[xx+1][i].hp-=2+rand()%2;
                        if (mp[xx+1][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx+1][i].b=0;
                    }
                }
            }
            if (hc==3&&cc=='K'){
                for (int i=xx+1;i<=n;i++){
                    ccc[i][yy-1]=1;
                    ccc[i][yy]=1;
                    ccc[i][yy+1]=1;
                }
                warout(xx,yy);
                for (int i=xx+1;i<=n;i++){
                    if (mp[i][yy].b){
                        mp[i][yy].hp-=2+rand()%2;
                        if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
                    }
                    if (mp[i][yy-1].b){
                        mp[i][yy-1].hp-=2+rand()%2;
                        if (mp[i][yy-1].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy-1].b=0;
                    }
                    if (mp[i][yy+1].b){
                        mp[i][yy+1].hp-=2+rand()%2;
                        if (mp[i][yy+1].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy+1].b=0;
                    }
                }
            }
            if (hc==3&&cc=='L'){
                for (int i=yy+1;i<=n;i++){
                    ccc[xx-1][i]=1;
                    ccc[xx][i]=1;
                    ccc[xx+1][i]=1;
                }
                warout(xx,yy);
                for (int i=yy+1;i<=n;i++){
                    if (mp[xx][i].b){
                        mp[xx][i].hp-=2+rand()%2;
                        if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
                    }
                    if (mp[xx-1][i].b){
                        mp[xx-1][i].hp-=2+rand()%2;
                        if (mp[xx-1][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx-1][i].b=0;
                    }
                    if (mp[xx+1][i].b){
                        mp[xx+1][i].hp-=2+rand()%2;
                        if (mp[xx+1][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx+1][i].b=0;
                    }
                }
            }
            if (hc==4&&cc=='I'){
                for (int i=xx-1;i;i--)ccc[i][yy]=1;
                warout(xx,yy);
                for (int i=xx-1;i;i--){
                    if (!mp[i][yy].b)continue;
                    int r=rand()%3;
                    mp[i][yy].hp-=mp[i][yy].hp*r;
                    if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
                }
            }
            if (hc==4&&cc=='J'){
                for (int i=yy-1;i;i--)ccc[xx][i]=1;
                warout(xx,yy);
                for (int i=yy-1;i;i--){
                    if (!mp[xx][i].b)continue;
                    int r=rand()%3;
                    mp[xx][i].hp-=mp[xx][i].hp*r;
                    if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
                }
            }
            if (hc==4&&cc=='K'){
                for (int i=xx+1;i<=n;i++)ccc[i][yy]=1;
                warout(xx,yy);
                for (int i=xx+1;i<=n;i++){
                    if (!mp[i][yy].b)continue;
                    int r=rand()%3;
                    mp[i][yy].hp-=mp[i][yy].hp*r;
                    if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
                }
            }
            if (hc==4&&cc=='L'){
                for (int i=yy+1;i<=n;i++)ccc[xx][i]=1;
                warout(xx,yy);
                for (int i=yy+1;i<=n;i++){
                    if (!mp[xx][i].b)continue;
                    int r=rand()%3;
                    mp[xx][i].hp-=mp[xx][i].hp*r;
                    if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
                }
            }
            if (hc==5&&cc=='I'){
                int i;
                for (i=xx;i;i--)
                    if (mp[i][yy].b)break;
                mp[i][yy].hp-=5;
                if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
                if (i){
                    memset(ccc,0,sizeof(ccc));
                    ccc[i][yy]=1;
                    warout(xx,yy);
                    if (rand()%10==0){
                        memset(ccc,0,sizeof(ccc));
                        for (int i=1;i<=n;i++)
                            for (int j=1;j<=n;j++)
                                if (mp[i][j].b){
                                    mp[i][j].hp--;
                                    if (mp[i][j].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][j].b=0;
                                }
                        for (int i=1;i<=n;i++)
                            for (int j=1;j<=n;j++)
                                ccc[i][j]=1;
                        warout(xx,yy);
                    }
                }
            }
            if (hc==5&&cc=='J'){
                int i;
                for (i=yy;i;i--)
                    if (mp[xx][i].b)break;
                mp[xx][i].hp-=5;
                if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
                if (i){
                    memset(ccc,0,sizeof(ccc));
                    ccc[xx][i]=1;
                    warout(xx,yy);
                    if (rand()%10==0){
                        memset(ccc,0,sizeof(ccc));
                        for (int i=1;i<=n;i++)
                            for (int j=1;j<=n;j++)
                                if (mp[i][j].b){
                                    mp[i][j].hp--;
                                    if (mp[i][j].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][j].b=0;
                                }
                        for (int i=1;i<=n;i++)
                            for (int j=1;j<=n;j++)
                                ccc[i][j]=1;
                        warout(xx,yy);
                    }
                }
            }
            if (hc==5&&cc=='K'){
                int i;
                for (i=xx;i<=n;i++)
                    if (mp[i][yy].b)break;
                mp[i][yy].hp-=5;
                if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
                if (i<=n){
                    memset(ccc,0,sizeof(ccc));
                    ccc[i][yy]=1;
                    warout(xx,yy);
                    if (rand()%10==0){
                        memset(ccc,0,sizeof(ccc));
                        for (int i=1;i<=n;i++)
                            for (int j=1;j<=n;j++)
                                if (mp[i][j].b){
                                    mp[i][j].hp--;
                                    if (mp[i][j].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][j].b=0;
                                }
                        for (int i=1;i<=n;i++)
                            for (int j=1;j<=n;j++)
                                ccc[i][j]=1;
                        warout(xx,yy);
                    }
                }
            }
            if (hc==5&&cc=='L'){
                int i;
                for (i=yy;i<=n;i++)
                    if (mp[xx][i].b)break;
                mp[xx][i].hp-=5;
                if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
                if (i<=n){
                    memset(ccc,0,sizeof(ccc));
                    ccc[xx][i]=1;
                    warout(xx,yy);
                    if (rand()%10==0){
                        memset(ccc,0,sizeof(ccc));
                        for (int i=1;i<=n;i++)
                            for (int j=1;j<=n;j++)
                                if (mp[i][j].b){
                                    mp[i][j].hp--;
                                    if (mp[i][j].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][j].b=0;
                                }
                        for (int i=1;i<=n;i++)
                            for (int j=1;j<=n;j++)
                                ccc[i][j]=1;
                        warout(xx,yy);
                    }
                }
            }
        }
        memset(book,0,sizeof(book));
        for (int i=1;i<=n;i++)
            for (int j=1;j<=n;j++){
                if (book[i][j])continue;
                if (!mp[i][j].b)continue;
                int movex[4]={1,0,0,-1};
                int movey[4]={0,1,-1,0};
                int s=rand()%4;
                int mmm=rand()%4;
                int nx,ny;
                if (!mmm)nx=i+movex[s],ny=j+movey[s];
                else{
                    nx=i,ny=j;
                    int mmmm=rand()%2;
                    if (nx==xx)mmmm=1;
                    if (nx==yy)mmmm=0;
                    if (mmmm==0){
                        if (nx<xx)nx++;
                        if (nx>xx)nx--;
                    }
                    if (mmmm==1){
                        if (ny<yy)ny++;
                        if (ny>yy)ny--;
                    }
                }
                if (nx<1||ny<1||nx>n||ny>n)continue;
                book[nx][ny]=1;
                if (nx==xx&&ny==yy){
                    hp-=2;
                    mp[i][j].b=0;
                    system("cls");
                    for (int i=1;i<=n;i++){
                        for (int j=1;j<=n;j++)
                            if (mp[i][j].b)cout<<mp[i][j].hp;
                            else if(i!=xx||j!=yy)cout<<'.';
                            else cout<<"!";
                        cout<<endl;
                    }
                    Sleep(500);
                    continue;
                }
                if (!mp[nx][ny].b){
                    mp[i][j].b=0;
                    mp[nx][ny].b=1;
                    mp[nx][ny].hp=mp[i][j].hp;
                }
            }
        if (xx==lx&&yy==ly)last++;
        else last=0,lx=xx,ly=yy;
        if (last>=5){
            system("cls");
                for (int i=1;i<=n;i++){
                    for (int j=1;j<=n;j++)
                        if (mp[i][j].b)cout<<mp[i][j].hp;
                        else if(i!=xx||j!=yy)cout<<'.';
                        else cout<<"!";
                    cout<<endl;
                }
            Sleep(500);
            hp--;
        }
        ucd--;
        ucd=max(ucd,0);
        cnt++;
    }
    return;
}
//神域战争
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void game2(){
    char x;
    while(x!='B'&&x!='b'){
        cout<<"退出并保存游戏请输入:B"<<endl;
        cout<<"打开神之商城请输入:S"<<endl;
        cout<<"进入神域战争请输入:W"<<endl;
        x=getch();
        if (x=='S'||x=='s')shop(nowuser);
        if (x=='W'||x=='w')war(nowuser);
        system("cls");
    }
    return;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//注册 登录
char rere[105];
bool issame(string x){
    for (int i=1;i<x.size();i++)
        if (rere[i]!=x[i])return 0;
    return 1;
}
bool charsame(char a[105],char b[105],int blen){
    for (int i=0;i<blen;i++)if (a[i]!=b[i])return 0;
    return 1;
}
int canfind(int len){
    int ansi=0;
    for (int i=1;i<=usertot;i++)
        if (charsame(rere,user[i].name,user[i].namelen)&&len==user[i].namelen)ansi=i;
    return ansi;
}
bool login_register(){
    char k=getch();
    while(k!='1'&&k!='2'){
        system("cls");
        cout<<"抱歉,请您再试一次"<<endl;
        cout<<"登陆请按1"<<' '<<"用户名"<<' '<<"密码"<<endl;
        cout<<"注册请按2"<<' '<<"用户名"<<' '<<"密码"<<endl;
        k=getch();
    }
    system("cls");
    if (k=='1'){
        if (usertot==0){cout<<"ERROR"<<endl;return 0;}
        cout<<"请输入用户名:"<<endl;
        int len;
        scanf("%s",rere);
        len=strlen(rere);
        system("cls");
        while(!canfind(len)){
            cout<<"抱歉,未找到用户名"<<endl;
            cout<<"请重新输入"<<endl;
            scanf("%s",rere);
            len=strlen(rere);
            system("cls");
        }
        nowuser=canfind(len);
        cout<<"请输入密码:"<<endl;
        scanf("%s",rere);
        len=strlen(rere);
        system("cls");
        while(!charsame(rere,user[nowuser].password,user[nowuser].passwordlen)||(len!=user[nowuser].passwordlen)){
            cout<<"抱歉,密码错误"<<endl;
            cout<<"请重新输入"<<endl;
            scanf("%s",rere);
            len=strlen(rere);
            system("cls");
        }
    }
    if (k=='2'){
        usertot++;
        nowuser=usertot;
        cout<<"请输入用户名:"<<endl;
        scanf("%s",rere);
        while(canfind(strlen(rere))){
            system("cls");
            cout<<"抱歉,用户名重复,请重新输入"<<endl;
            scanf("%s",rere);
        }
        for (int i=0;i<strlen(rere);i++)user[usertot].name[i]=rere[i];
        user[usertot].namelen=strlen(rere);
        cout<<"请输入密码:"<<endl;
        scanf("%s",user[usertot].password);
        user[usertot].passwordlen=strlen(user[usertot].password);
        user[usertot].gold=user[usertot].h=user[usertot].u=0;
    }
    return 1;
}
//注册 登录
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int sy(){
    freopen("game.txt","r",stdin);
    cin>>usertot;
    for (int i=1;i<=usertot;i++)cin>>user[i].name>>user[i].namelen>>user[i].password>>user[i].passwordlen>>user[i].gold>>user[i].h>>user[i].u;
   // enter();
    freopen("CON", "r", stdin);
    cout<<"登陆请按1"<<endl;
    cout<<"注册请按2"<<endl;
    string name,password;
    if (!login_register())return 0;
    cout<<"欢迎,"<<user[nowuser].name<<"!"<<endl;
    Sleep(1500);
    game();
    system("cls");
    cout<<"保存中,请稍等..."<<endl;
    fileout();
    system("cls");
    return 0;
}
struct Users{
	string key;
	string name;
	Users(string key="\0",string name="\0"):key(key),name(name) {}
};
queue <Users> name;
string getint2(string *index){
	char c;
	string a;
	while((c=getch())!=13){
		cout << "*";
		a.push_back(c);
	}
	*index=a;
	return a;
}
int dl();
int zc(){
	system("cls");
	cout << "用户名(最多不超过20个字符,不建议使用中文):";
	//system("pause");
	string name2;
	cin >> name2;
	cout << "密码(最多不超过20个字符,建议用上数字、大写字母、小写字母、特殊字符(%、$、#等),不建议使用中文、不支持backspace和delate):";
//	system("pause");
	string key;
	getint2(&key);
	cout << "\n确认密码:";
	string key2;
//	system("pause");
	getint2(&key2);
	if(key==key2){
		cout << "注册成功!注册信息存储中......\n";
		FILE *messagein;
		messagein=fopen("GC_servy.ini","a");
		fclose(messagein);
		messagein=fopen("GC_servy.ini","r");
		int n;
		fscanf(messagein,"%d",&n);
		for(int i=0;i<n;i++){
			Users a;
			fscanf(messagein,"%s %s",a.name.c_str(),a.key.c_str());
			//cin >> a.name >> a.key;
			name.push(a);
		}
		name.push(Users(key,name2));
		n++;
		if(n==101){
			name.pop();
			n--;
		}
		fclose(messagein);
		messagein=fopen("GC_servy.ini","w");
		fprintf(messagein,"%d\n",n);
		char namechar[100],keychar[100];
		for(int i=0;i<n;i++){
		//	cout << name.front().name << " " << name.front().key << "\n";
			fprintf(messagein,"%s %s",name.front().name.c_str(),name.front().key.c_str());
			name.pop();
		}
		fclose(messagein);
		cout << "注册成功!请登录~";
		Sleep(900);
		dl();
		return 0;
	}
	else{
		cout << "\n密码不相同  :(  请重新注册~";
		cout << "\n密码1:" << key << " 密码2:" << key2;
		Sleep(900);
		zc();
		return 0;
	}
}
int dl(){
	system("cls");
	cout << "用户名:\n";
//	system("pause");
	string name2;
	cin >> name2;
	string key2;
	cout << "密码:\n";
//	system("pause");
	getint2(&key2);
	cout << "\n";
	FILE *STDIN; 
	STDIN=fopen("GC_servy.ini","a");
	fclose(STDIN);
	STDIN=fopen("GC_servy.ini","r");
	int n;
	fscanf(STDIN,"%d",&n);
	string key;
	char name3[20];
	int i;
	for(i=0;i<n;i++){
		//cin >> name3 >> key;
		fscanf(STDIN,"%s %s",name3,key.c_str());
		if(name3==name2){
			i--;
			break;
		}
	}
	fclose(STDIN);
	if(i==n-1){
		cout << "用户名不存在,可能因为电脑内存不够,自动清理一些注册信息,(电脑最多容纳100条注册信息)敬请谅解。\n\n 1.重新登录   2.重新注册";
		//system("pause");
		int number;
		number = getch();
		while(number>2){
			cout << "输入错误!!!重新输入!!!\n";
		//	system("pause");
			number=getch();
		}
		if(number==1){
			dl();
			return 0;
		}
		else{
			zc();
			return 0;
		}
	}
	if(key2==key){
		cout << "登陆成功!~";
		Sleep(100);
		UsersName=name3;
		return 0;
	}
	else{
		cout << "密码错误!重新登录!!";
		Sleep(100);
		dl();
		return 0;
	}
}
void enter(){
	print("\n\n\n\n\n\n\n\n                               ",0);
	print("GC Server1.0",100);
	print("\n                                         ",0);
	print("——by eason66");
	Sleep(1000);
	system("cls");
	Sleep(10);
	print("\n\n\n\n\n\n                                  ",0);
	print("感谢vijos开发的游戏");
	print("\n                               ",0);
	print("按v或V打开vijos,按其他键继续\n");
	char c=getch();
	if(c=='v'||c=='V'){
		system("start https://vijos.org/discuss/游戏");
		print("                                ",0);
		system("pause");
	}
	system("cls");
}
#undef n
int main(){
	enter();
	cout << "要做什么?\n 1.登陆   2.注册   3.退出\n";
	//system("pause");
	int number;
	cin >> number;
	while(number>3){
		cout << "输入错误 :( 重新输入";
		cin >> number;
	}
//	cout << "登陆或注册前先把游戏信息写在data.txt后(1.传奇  2.石头剪刀布   3.猜数     4.贪吃蛇   5.迷宫  0.退出)";
	if(number==3){
		return 0;
	}
	if(number==1){
		dl();
	}
	else{
		zc();
		return 0;
	}
	system("cls");
	cout << UsersName << "欢迎你!";
	while(number!=0){
	cout << "选择哪一款游戏?\n  1.猜数  2.石头剪刀布   3.传奇     4.贪吃蛇   5.迷宫  6.神域 0.退出\n";
	//system("pause");";
	number=getint4();
	while(number>6){
		cout << "输入错误 :( 请重新输入\n";
		number=getint();
	}
	switch(number){
		case 0:break;
		case 2:system("cls");ctjdb();break;
		case 1:system("cls");if(MessageBox(NULL,"该游戏做了更新,使用最新的3.2版本?(测试版)","管理员",MB_YESNO|MB_SYSTEMMODAL)==IDYES){
			MessageBox(NULL,"测试版有误,无法继续!","Error!",MB_OK);
			break;
		}
		else{
			cq3_1();
		}break;
		case 3:system("cls");cs();break;
		case 4:system("cls");system("snake");break;
		case 6:if(MessageBox(NULL,"该游戏也有登录系统,暂不能与本游戏登陆系统兼容,确定继续吗?","管理员",MB_YESNO|MB_SYSTEMMODAL)==IDYES){
			system("cls");
			MessageBox(NULL,"该游戏无法正常工作!","Error!",MB_OK);
			break;
		}system("cls");break;
		default:system("cls");mg();break;
	}
	}
	cout << "下次再来哦 ^_^";
	Sleep(1000);
	return 0;
}

互动环节:求各位大佬给我施舍一点改进建议吧,若有详细方案,甚是感谢??。(注意事项:代码随时会改进,有改进建议或问题点请尽快回复,以免被我抢先,谢谢大佬配合)


原文链接:https://www.cnblogs.com/eason66-blog/p/GC-server.html
如有疑问请与原作者联系

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:C++模板详解(三):参数化声明详解

下一篇:lost cows