Dev-C++小游戏大全(第二期)

1.抽卡

#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include <bits/stdc++.h>
using namespace std;
void cc(const string a)
{
	size_t len = a.size();
	for(int i = 0; i < a.size(); i++)
	{
		cout << a[i];
		usleep(32000);
 
	}
	cout<<"\n";
}
 
//抄袭可耻,创意最珍!
const int chao_xi_zhe = 250;
const int AAA = 37,BBB = 29;
int ja = 15,jb=2,jc=27;
int lck[99] = {-1,2,4,-1,5,-2,6,2,8,-3,6,2,7,-3,8,2,4,5,7,9,3,5,-2};
int main()
{
	cc("抄袭可耻,创意最珍!");
	cc("抄袭可耻,创意最珍!");
	cc("抄袭可耻,创意最珍!");
	cc("抄袭可耻,创意最珍!");
	cc("抄袭可耻,创意最珍!");
	cc("抄袭可耻,创意最珍!");
	cc("抄袭可耻,创意最珍!");
	cc("抄袭可耻,创意最珍!");
	cc("抄袭可耻,创意最珍!");
	cc("抄袭可耻,创意最珍!");
	cc("抄袭可耻,创意最珍!");
	system("cls");
	usleep(10000);
	int z;
	cout<<"是否查看规则&剧情?"<<endl;
	cout<<"是选1,不是选2"<<endl;
	cin >>z;
	if(z == 1)
	{
		system("cls");
		cout<<"欢迎来到 抽卡人生"<<endl;
		sleep(1);
		cout<<"2109年,迷##执掌大权"<<endl;
		sleep(1);
		cout<<"同时制定了一系列不公的政策"<<endl;
		sleep(1);
		cout<<"你干什么都要抽卡,吃饭,喝水。。。"<<endl;
		sleep(1);
		cout<<"你是一位打击迷##的正(造)义(反)人(分)士(子)"<<endl;
		sleep(1);
		cout<<"被抓进了监狱"<<endl;
		sleep(1);
		cout<<"必须逃出去!"<<endl;
		sleep(1);
		cout<<"下面为规则"<<endl;
		sleep(1);
		cout<<"你一天能干五件事"<<endl;
		sleep(1);
		cout<<"吃饭和喝水都需要卡"<<endl;
		sleep(1);
		cout<<"卡包里装你拥有的卡"<<endl;
		sleep(1);
		cout<<"在商店里,你可以买卖卡片(除了RRPG卡)"<<endl;
		sleep(1);
		cout<<"你每抽一次卡都要花金币"<<endl;
		sleep(1);
		cout<<"睡觉可以让你更快乐,同时进入下一天"<<endl;
		sleep(1);
		cout<<"当你的饥饿(干渴值)为零时"<<endl;
		sleep(1);
		cout<<"或是快乐值小于30时"<<endl;
		sleep(1);
		cout<<"你的生命值就会下降"<<endl;
		sleep(1);
		cout<<"降到0就死了"<<endl;
		sleep(1);
		cout<<"哦对了,你需要抽到10张RPG卡才能出狱"<<endl;
		sleep(1);
		cout<<"生存下去吧!"<<endl;
		sleep(1);
		system("cls");
	}
	system("cls");
	cout<<"是否有存档?"<<endl<<"1、有    2、没有";
	int table;
	cin >> table;
	int tme = 1;
	srand(time(0));
	int life,gold,hungry,sirsty,happy,time;
	int cardA,cardB,cardC,cardRPG,cardfood,cardwater;
	int A,B,C,food,water,RPG;
	int a,b,c,d,e,f;
	if(z != 3)
	{
		life = 100;
		gold = 100;
		hungry = 100;
		sirsty = 100;
		happy = 100;
		cardA = 0;
		cardB = 0;
		cardC = 0;
		cardfood = 0;
		cardwater = 0;
		cardRPG = 0;
	}
	else
	{
		cout<<"你好,帅气的作者"<<endl;
		cout<<"欢迎测试游戏"<<endl;
		life = 100;
		gold = 999999999;
		hungry = 100;
		sirsty = 100;
		happy = 100;
		cardA = 99999;
		cardB = 99999;
		cardC = 99999;
		cardfood = 99999;
		cardwater = 99999;
		cardRPG = 0;
	}
	if(table == 1)
	{
		cout<<"请输入存档号(不要瞎输哦,后果很严重):";
		int jym,myj;
		cin>>jym>>life>>gold>>hungry>>sirsty>>happy>>tme>>cardA>>cardB>>cardC>>cardRPG>>cardfood>>cardwater>>myj;
		life/= lck[2];
		gold/= lck[3];
		hungry/= lck[4];
		sirsty/= lck[5];
		happy/= lck[6];
		tme/= lck[7];
		cardA/= lck[8];
		cardB/= lck[9];
		cardC/= lck[10];
		cardRPG/= lck[11];
		cardfood/= lck[12];
		cardwater/= lck[13];
 
		if(! ( (jym * AAA + BBB == myj) && (jym - (tme - ja) - (jb*gold) == jc)))
		{
			cout<<"你输错了,拜拜";
			return 0;
		}
		cout<<"正";
		usleep(40000);
		cout<<"在";
		usleep(40000);
		cout<<"打";
		usleep(40000);
		cout<<"开";
		usleep(40000);
		cout<<"存";
		usleep(40000);
		cout<<"档";
		usleep(40000);
		cout<<"。";
		usleep(40000);
		cout<<"。";
		usleep(40000);
		cout<<"。";
		usleep(40000);
		cout<<endl;
		sleep(2);
	}
	while(1)
	{
		//
		A = (rand()%11)+10;
		B = (rand()%6)+5;
		C = (rand()%9)+2;
		food = (rand()%16)+15;
		water = (rand()%16)+15;
		cout<<"第"<<tme<<"天"<<endl;
		sleep(3);
		for(int i=1; i<= 5; i++)
		{
			if(gold < 10&&cardA == 0&&cardB == 0&&cardC == 0&&cardfood == 0&&cardwater == 0)
			{
				cout<<"你现在陷入了困境"<<endl;
				cout<<"你既没有钱,有没有卡"<<endl;
				cout<<"于是仁慈的作者决定帮你一把"<<endl;
				gold+=100;
			}
			if(cardRPG == 10)
			{
				cout<<"你集齐了10张RPG卡!"<<endl;
				cout<<"你赢了!"<<endl;
				return 0;
			}
			if(hungry < 10)
			{
				life-=5;
			}
			if(sirsty < 10)
			{
				life-=5;
			}
			if(sirsty < 30)
			{
				life-=10;
			}
			if(life <= 0)
			{
				cout<<"你死了。。。。。。。。。"<<endl;
				return 0;
			}
 
			if(happy > 100)
			{
				happy = 100;
			}
			if(hungry > 100)
			{
				hungry = 100;
			}
			if(hungry < 0)
			{
				hungry = 0;
			}
			if(sirsty > 100)
			{
				sirsty = 100;
			}
			if(sirsty < 0)
			{
				sirsty = 0;
			}
			system("cls");
			cout<<"生命:"<<life<<endl;
			cout<<"金钱:"<<gold<<endl;
			cout<<"饥饿:"<<hungry<<endl;
			cout<<"干渴:"<<sirsty<<endl;
			cout<<"快乐:"<<happy<<endl;
			cout<<"1、吃饭 2、喝水 3、抽卡(10金币) 4、卡包 5、商店 6、睡觉 7、存档"<<endl;
			if(z != 3)
			{
				cin>>a;
			}
			if(z == 3)
			{
				life = 100;
				gold = 999999999;
				cardA = 99999;
				cardB = 99999;
				cardC = 99999;
				cardfood = 99999;
				cardwater = 99999;
				cardRPG = 0;
				a = 3;
			}
			if(a == 1)
			{
				if(cardfood > 0&&hungry < 100)
				{
					cardfood -= 1;
					hungry += 10;
					cout<<"嗝。。。"<<endl;
					sleep(1);
				}
				else if(hungry == 100||hungry > 90)
				{
					cout<<"你都饱了还吃个啥?"<<endl;
					sleep(1);
				}
				else
				{
					cout<<"你没有食物卡"<<endl;
					sleep(1);
				}
			}
			if(a == 2)
			{
				if(cardwater > 0&&sirsty <= 100)
				{
					cardwater -= 1;
					sirsty += 10;
					cout<<"咕咚,咕咚。。。"<<endl;
					sleep(1);
				}
				else if(sirsty == 100)
				{
					cout<<"你都不渴还喝个啥?"<<endl;
					sleep(1);
				}
				else
				{
					cout<<"你没有水卡"<<endl;
					sleep(1);
				}
			}
			if(a == 3)
			{
				if(gold >= 10)
				{
					gold -= 10;
					b = rand()%100;
					if(b <= 30)
					{
						cout<<"你获得一张A卡"<<endl;
						cardA++;
					}
					if(b <= 55&&b > 30)
					{
						cout<<"你获得一张B卡"<<endl;
						cardB++;
						happy -= 2;
					}
					if(b <= 70&&b > 55)
					{
						cout<<"你获得一张C卡"<<endl;
						cardC++;
						happy -= 5;
					}
					if(b <= 71&&b > 70)
					{
						cout<<"你获得一张RPG卡!!!!!"<<endl;
						cardRPG++;
						happy += 5;
					}
					if(b <= 76&&b > 71)
					{
						cout<<"你啥都没获得"<<endl;
						happy -= 10;
					}
					if(b <= 88&&b > 76)
					{
						cout<<"你获得一张!食物!卡"<<endl;
						cardfood++;
						happy += 2;
					}
					if(b <= 99&&b > 88)
					{
						cout<<"你获得一张!水!卡"<<endl;
						cardwater++;
						happy += 2;
					}
					sleep(2);
				}
				else
				{
					cout<<"你没钱了。。。"<<endl;
					sleep(1);
				}
			}
			if(a == 4)
			{
				cout<<"A卡"<<cardA<<endl;
				cout<<"B卡"<<cardB<<endl;
				cout<<"C卡"<<cardC<<endl;
				cout<<"水卡"<<cardwater<<endl;
				cout<<"食物卡"<<cardfood<<endl;
				cout<<"RPG卡"<<cardRPG<<endl;
				sleep(3);
			}
			if(a == 5)
			{
				system("cls");
				while(1)
				{
					system("cls");
					cout<<"1、买卡 2、卖卡 3、退出"<<endl;
					cin>> c;
					if(c == 3)
					{
						break;
					}
					if(c == 1)
					{
						system("cls");
						cout<<"你有"<<gold<<"金币"<<endl;
						cout<<"1、A卡:"<<A<<"金币"<<endl;
						cout<<"2、B卡:"<<B<<"金币"<<endl;
						cout<<"3、C卡:"<<C<<"金币"<<endl;
						cout<<"4、食物卡:"<<food<<"金币"<<endl;
						cout<<"5、水卡:"<<water<<"金币"<<endl;
						cin >> d;
						cout<<"数量:";
						int many;
						cin >> many;
						switch(d)
						{
							case 1:
								if(gold >= A*many)
								{
									cout<<"购买成功!"<<endl;
									cardA += many;
									gold -= A*many;
								}
								else
								{
									cout<<"你钱不够"<<endl;
								}
								break;
							case 2:
								if(gold >= B*many)
								{
									cout<<"购买成功!"<<endl;
									cardB += many;
									gold -= B*many;
								}
								else
								{
									cout<<"你钱不够"<<endl;
								}
								break;
							case 3:
								if(gold >= C*many)
								{
									cout<<"购买成功!"<<endl;
									cardC += many;
									gold -= C*many;
								}
								else
								{
									cout<<"你钱不够"<<endl;
								}
								break;
							case 4:
								if(gold >= food*many)
								{
									cout<<"购买成功!"<<endl;
									cardfood += many;
									gold -= food*many;
								}
								else
								{
									cout<<"你钱不够"<<endl;
								}
								break;
							case 5:
								if(gold >= water*many)
								{
									cout<<"购买成功!"<<endl;
									cardwater += many;
									gold -= water*many;
								}
								else
								{
									cout<<"你钱不够"<<endl;
								}
								break;
						}
					}
					if(c == 2)
					{
						cout<<"你有:"<<endl;
						cout<<"A卡*"<<cardA<<endl;
						cout<<"B卡*"<<cardB<<endl;
						cout<<"C卡*"<<cardC<<endl;
						cout<<"水卡*"<<cardwater<<endl;
						cout<<"食物卡*"<<cardfood<<endl;
						cout<<endl<<endl<<endl;
						cout<<"1、A卡:"<<A<<"金币"<<endl;
						cout<<"2、B卡:"<<B<<"金币"<<endl;
						cout<<"3、C卡:"<<C<<"金币"<<endl;
						cout<<"4、食物卡:"<<food<<"金币"<<endl;
						cout<<"5、水卡:"<<water<<"金币"<<endl;
						cin>> d;
						int much;
						cout<<"出售数量:";
						cin >> much;
						switch(d)
						{
							case 1:
								if(cardA*much >= 1)
								{
									cout<<"出售成功!"<<endl;
									sleep(1);
									cardA-=much;
									gold+=A*much;
								}
								else
								{
									cout<<"你没那个卡"<<endl;
									sleep(1);
								}
								break;
							case 2:
								if(cardB*much >= 1)
								{
									cout<<"出售成功!"<<endl;
									sleep(1);
									cardB-=much;
									gold+=B*much;
								}
								else
								{
									cout<<"你没那个卡"<<endl;
									sleep(1);
								}
								break;
							case 3:
								if(cardC*much >= 1)
								{
									cout<<"出售成功!"<<endl;
									sleep(1);
									cardC-=much;
									gold+=C*much;
								}
								else
								{
									cout<<"你没那个卡"<<endl;
									sleep(1);
								}
								break;
							case 4:
								if(cardfood*much >= 1)
								{
									cout<<"出售成功!"<<endl;
									sleep(1);
									cardfood-=much;
									gold+=food*much;
								}
								else
								{
									cout<<"你没那个卡"<<endl;
									sleep(1);
								}
								break;
							case 5:
								if(cardwater*much >= 1)
								{
									cout<<"出售成功!"<<endl;
									sleep(1);
									cardwater-=much;
									gold+=water*much;
								}
								else
								{
									cout<<"你没那个卡"<<endl;
									sleep(1);
								}
								break;
						}
					}
				}
			}
			if(a == 6)
			{
				cout<<"呼噜,呼噜......"<<endl;
				sleep(1);
				happy += 5;
				if(happy > 100)
				{
					happy = 100;
				}
				hungry-=10;
				sirsty-= 10;
				system("cls");
				break;
			}
			if(a == 7)
			{
				int yuo = 27;
				yuo += 2*gold;
				yuo += tme - 15;
				int ouy = yuo * AAA + BBB;
				cout<<"友情提示,请将终端拉至最大,否则会出BUG"<<endl;
				sleep(3);
				cout<<"存档号:"
				    <<yuo<<" "
				    <<lck[2] * life<<" "
				    <<lck[3] * gold<<" "
				    <<lck[4] * hungry<<" "
				    <<lck[5] * sirsty<<" "
				    <<lck[6] * happy<<" "
				    <<lck[7] * tme<<" "
				    <<lck[8] * cardA<<" "
				    <<lck[9] * cardB<<" "
				    <<lck[10] * cardC<<" "
				    <<lck[11] * cardRPG<<" "
				    <<lck[12] * cardfood<<" "
				    <<lck[13] * cardwater<<" "
				    <<ouy;
				return 0;
			}
			if(i == 3)
			{
				hungry-=10;
			}
			if(i % 2==0)
			{
				sirsty-=10;
			}
		}
		tme++;
 
 
	}
}

2.躺平发育

#include<bits/stdc++.h>
#include<windows.h>
#include<unistd.h>
using namespace std;
void rules();
int main(void) {
	int c=1;
	int m=1;
	long long m_x=1000;
	long long m_xl=1000;
	int g_a=250;
	int g_d=200;
	int coins=50;
	int p_n=1;
	int n=0;
	int win=100;
	int buy;
	int d_n=0;
	int p_a=75;
	int p_na, jj_a, jj_d;
	system("cls");
	cout<<"请选择难度:"<<endl;
	cout<<endl;
	cout<<endl;
	cout<<"A.初级难度"<<endl;
	cout<<endl;
	cout<<"B.中级难度"<<endl;
	cout<<endl;
	cout<<"C.地狱难度"<<endl;
	cout<<"请输入:";
	char x;
	cin>>x;
	if(x=='A'){
		jj_a=100;
		jj_d=60;
		p_na=50;
	} 
	else if(x=='B'){
		jj_a=125;
		jj_d=75;
		p_na=55;
	}
	else if(x=='C'){
		jj_a=175;
		jj_d=125;
		p_na=45;
	}
	while(win>=0) {
 
		
		if(n<0){
			n=0;
		}
		if(win<=0){
			break;
		}
		m_xl-=n*g_a;
		if(m_xl<=0) {
			system("cls");
			cout<<"您的门已经被噬梦者攻破,G A M E    O V E R!"<<endl;
			return 0;
		}
		system("cls");
		cout<<"金币:"<<coins<<" 电力:"<<d_n<<"  炮台:"<<p_n<<"个  "<<"门的血量:"<<m_xl<<endl;
		cout<<endl;
		cout<<"      墙墙墙墙    墙墙墙墙"<<endl;
		cout<<"      墙◎◎墙    墙◎◎墙"<<endl;
		cout<<"      墙◎◎墙    墙◎◎墙"<<endl;
		cout<<"      墙◎◎墙    墙◎◎墙"<<endl;
		cout<<"      墙    墙    墙    墙"<<endl;
		cout<<"      墙    墙 怪 墙    墙"<<endl;
		cout<<"      墙    墙 "<<n<<" 墙    墙"<<endl;
		cout<<"墙墙墙墙    墙 门 墙    墙墙墙墙"<<endl;
		cout<<"墙          ◎ ◎ ◎          墙"<<endl;
		cout<<"墙          ◎ 床 ◎    ☆☆☆墙"<<endl;
		cout<<"墙                      ☆★★墙"<<endl;
		cout<<"墙                      ☆★★墙"<<endl;
		cout<<"墙墙墙墙墙墙墙墙墙墙墙墙墙墙墙墙"<<endl;
		cout<<endl;
		cout<<"您正在床上发育……"<<endl;
		cout<<"有"<<n<<"只噬梦者在挠你的门!"<<endl;
		cout<<"输入1以建造炮台:25金币"<<endl;
		cout<<"输入2以升级门:  50金币"<<endl;
		cout<<"输入3以升级床:  35金币"<<endl;
		cout<<"输入4以放弃此次建造机会"<<endl;
		cout<<"输入5以拆除1个炮台:获得15金币"<<endl;
		cout<<"输入6以让门回血"<<endl;
		cout<<"您的门的级位是"<<m<<"级"<<endl;
		cout<<"您的床是"<<c<<"级"<<endl;
		cout<<"◎:炮台"<<endl;
		cout<<"☆:维修台"<<endl;
		cout<<"★:发电机"<<endl;
		n-=p_n*p_a/g_d;
		win-=p_n*p_a/g_d;
		cin>>buy;
		switch(buy) {
			case 1:
				if(coins<25) {
					cout<<"您的钱不够"<<endl;
					break;
				}
				if(p_n==17){
					cout<<"最大上限为17个炮台!"<<endl;
					break;
				} 
				coins-=25;
				p_n++;
				break;
			case 2:
				if(coins<50) {
					cout<<"您的钱不够"<<endl;
					break;
				}
				if(m==19){
					cout<<"您的门已达到黄金门,不能够再次升级了!"<<endl;
					system("pause");
					break;
				}
				coins-=50;
				m++;
				m_x*=7;
				m_xl=m_x;
				break;
			case 3:
				if(coins<35) {
					cout<<"您的钱不够"<<endl;
					break;
				}
				coins-=35;
				c++;
				break;
			case 4:
				break;
			case 5:
				coins+=15;
				p_n--;
			case 6:
				m_xl=m_x;
				break;
			default:
				cout<<"没有此选项"<<endl;
				break;
		}
		if(m_xl==0) {
			system("cls");
			cout<<"您的门已经被噬梦者攻破,G A M E    O V E R!"<<endl;
			return 0;
		}
		if(n==31) {
			n--;
		}
		coins+=c*15;
		sleep(2);
		n++;
		if(n==31) {
			n--;
		}
		d_n+=4*10000;
	}
	cout<<"恭喜您打败了所有噬梦者,获得了胜利!"<<endl;
}
void rules() {
	string o="您在野外建造了一间房屋,现在是晚上,有噬梦者来攻击您。如果您能打败所有(100个)噬梦者,您就胜利了!如果门被挠破,则输!";
	for(int i=0; i<o.size(); i++) {
		cout<<o[i];
		Sleep(100);
	}
	cout<<endl;
	cout<<endl;
	system("pause");
}

3.游戏盒子

#include<bits/stdc++.h>
#include <windows.h>
#include <stdio.h>
#include<conio.h>
#include<time.h>
using namespace std;
int x = 0;
int* X = &x;
char Void[10000] = "\0";
int Key = 0;  
int KeyOut = 0; 
int User; 
int User2; 
int* Q1;
int* Q2;  
int* Q3;
int score;   //游戏得分
const int nn = 809;
struct Point { int x, y; };
int dali;
int fx[4] = { -1,27,1,-27 };
int fxfx[4][2] = { {0,-1},{1,0},{0,1},{-1,0} };
int dis[1000][1000];
int changdi[30][27] = {
	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
	{0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0},
	{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
	{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
	{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
	{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
	{0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0},
	{0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0},
	{0,0,0,0,0,0,1,0,0,0,0,0,2,0,2,0,0,0,0,0,1,0,0,0,0,0,0},
	{0,0,0,0,0,0,1,0,0,0,0,0,2,0,2,0,0,0,0,0,1,0,0,0,0,0,0},
	{0,0,0,0,0,0,1,0,0,2,2,2,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0},
	{0,0,0,0,0,0,1,0,0,2,0,0,0,3,0,0,0,2,0,0,1,0,0,0,0,0,0},
	{0,0,0,0,0,0,1,0,0,2,0,3,3,3,3,3,0,2,0,0,1,0,0,0,0,0,0},
	{2,2,2,2,2,2,1,2,2,2,0,3,3,3,3,3,0,2,2,2,1,2,2,2,2,2,2},
	{0,0,0,0,0,0,1,0,0,2,0,3,3,3,3,3,0,2,0,0,1,0,0,0,0,0,0},
	{0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
	{0,0,0,0,0,0,1,0,0,2,2,2,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0},
	{0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
	{0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
	{0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0},
	{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
	{0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
	{0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0},
	{0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0},
	{0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0},
	{0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0},
	{0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0},
	{0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0},
	{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
int xx, xx1, xx2, xx3, xx4, yy, yy5, yy2, yy3, yy4;
int now, now1, now2, now3, now4;
int gg1, gg2, gg3, gg4;
int fangx, nextfx, last1, last2, last3, last4;
int fenshu, guozi, guaitimer;
int T1, T2, t1, t2, stopped; //T:计时 t1:玩家速度 t2:怪物速度
int ff = 0; //f:{0:继续 1:被吃 2:赢了 3:输了}
int beichi;
#define high 20  //定义地图的高度
#define width 30   //定义地图的宽度
#define snake_maxlength 200  //蛇长最大值
int snake_x[snake_maxlength], snake_y[snake_maxlength]; //蛇的坐标
int snake_length;  //蛇现在的长度
int Map[high][width] = { 0 };  //初始化地图,0表示空格,1表示蛇身,2表示食物,3表示墙,4表示蛇头,现在地图中什么也没有
int food_x, food_y; //食物的坐标
int SCORE;  //本局分数
char input;
char primeinput = '.';
int op = 100;
int Death = 0;
int Guesstimes;
struct account{
	char user[1000];   //用户名
	char password[1000];   //密码
	int coin = 0;   //硬币
	int number;   //编号
	int award = 0;   //奖励次数,主要用于恋爱测试器奖励次数的限定
};
struct account peo[100];   //初设100人,可更改
void HideCursor()
{
	CONSOLE_CURSOR_INFO cursor_info = { 1, 0 };
	SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
float Check(int a)
{
	if (a == 0)   //针对字符和字符串
	{
		float m;
		if (cin >> m)
		{
			return m;
		}
		else
		{
			cout << "输入错误,请重新输入:";
			cin.clear();   //清除这个错误状态
			cin.sync();   //清理缓冲区内容
			cin.get();
			while (!(cin >> m))
			{
				cout << "输入错误,请重新输入:";
				cin.clear();   //清除这个错误状态
				cin.sync();   //清理缓冲区内容
				cin.get();
			}
			return m;
		}
	}
	else if (a == 1){ 
		float m;
		float c;
		if (cin >> m){
			while (1){
				if (m == 1 || m == 2 || m == 0){
					return m;
					break;
				}
				else{
					cout << "输入错误,请重新输入:";
					c = Check(1);   //递归调用,重新检测输入
					return c;
					break;
				}
			}
		}
		else{
			cout << "输入错误,请重新输入:";
			cin.clear();   //清除这个错误状态
			cin.sync();   //清理缓冲区内容
			cin.get();
			while (!(cin >> m)){
				cout << "输入错误,请重新输入:";
				cin.clear();   //清除这个错误状态
				cin.sync();   //清理缓冲区内容
				cin.get();
			}
			while (1){
				if (m == 1 || m == 2 || m == 0){
					return m;
					break;
				}
				else{
					cout << "输入错误,请重新输入:";
					c = Check(1);
					return c;
					break;
				}
			}
		}
	}
	else if (a == 2)   //针对字符和字符串以及特定的数字(1、2)
	{
		float m;
		float c;
		if (cin >> m)
		{
			while (1)
			{
				if (m == 1 || m == 2)
				{
					return m;
					break;
				}
				else
				{
					cout << "输入错误,请重新输入:";
					c = Check(2);
					return c;
					break;
				}
			}
		}
		else
		{
			cout << "输入错误,请重新输入:";
			cin.clear();   //清除这个错误状态
			cin.sync();//清理缓冲区内容
			cin.get();
			while (!(cin >> m))
			{
				cout << "输入错误,请重新输入:";
				cin.clear();   //清除这个错误状态
				cin.sync();   //清理缓冲区内容
				cin.get();
			}
			while (1)
			{
				if (m == 1 || m == 2)
				{
					return m;
					break;
				}
				else
				{
					cout << "输入错误,请重新输入:";
					a = Check(2);
					return a;
					break;
				}
			}
		}
	}
	else if (a == 3)   //针对字符和字符串以及特定的数字(1、2、3)
	{
		float m;
		float c;
		if (cin >> m)
		{
			while (1)
			{
				if (m == 1 || m == 2 || m == 3)
				{
					return m;
					break;
				}
				else
				{
					cout << "输入错误,请重新输入:";
					c = Check(3);
					return c;
					break;
				}
			}
		}
		else
		{
			cout << "输入错误,请重新输入:";
			cin.clear();   //清除这个错误状态
			cin.sync();   //清理缓冲区内容
			cin.get();
			while (!(cin >> m))
			{
				cout << "输入错误,请重新输入:";
				cin.clear();   //清除这个错误状态
				cin.sync();   //清理缓冲区内容
				cin.get();
			}
			while (1){
				if (m == 1 || m == 2 || m == 3){
					return m;
					break;
				}
				else{
					cout << "输入错误,请重新输入:";
					a = Check(3);
					return a;
					break;
				}
			}
		}
	}
	else if (a == 4) {  //针对字符和字符串以及特定的数字(1、0)
		float m;
		float c;
		if (cin >> m){
			while (1){
				if (m == 1 || m == 0){
					return m;
					break;
				}
				else{
					cout << "输入错误,请重新输入:";
					c = Check(4);
					return c;
					break;
				}
			}
		}
		else{
			cout << "输入错误,请重新输入:";
			cin.clear();   //清除这个错误状态
			cin.sync();   //清理缓冲区内容
			cin.get();
			while (!(cin >> m)){
				cout << "输入错误,请重新输入:";
				cin.clear();   //清除这个错误状态
				cin.sync();   //清理缓冲区内容
				cin.get();
			}
			while (1){
				if (m == 1 || m == 0){
					return m;
					break;
				}
				else
				{
					cout << "输入错误,请重新输入:";
					a = Check(4);
					return a;
					break;
				}
			}
		}
	}
}
void Progress(){
	int c = 1, d = 0;
	for (int i = 0; i < 50; i++)
	{
		cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
		cout << "\t\t\t\t+-------------------------------------------------+" << endl;
		cout << "\t\t\t\t|";
		for (int a = 0; a < i; a++)   //打印▋
		{
			cout << "▋";
		}
		for (int b = 49 - i; b > 0; b--)   //打印空格
		{
			cout << " ";
		}
		d += 2;   //进度数
		cout << "|  " << d << "%" << endl;
		cout << "\t\t\t\t+-------------------------------------------------+" << endl;
		cout << "\t\t\t\t               正在加载中,请稍后.";
		for (int j = 0; j < c % 6; j++)
		{
			cout << ".";
		}
		c++;
		cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
		Sleep(150);   //进度条读取速度
		if (i != 49)
		{
			system("cls");   //清屏
		}
	}
	Sleep(3000);
	system("cls");
}
int NormalizeName(char name[1000], int n)
{
	int a = 0;   //计数器
	if (n <= 15)
	{
		for (int i = 0; i < n; i++)
		{
			if (name[i] <= 32 || name[i] == 127)   //为空格或其他特殊情况
			{
				break;
			}
			else
			{
				a++;
			}
		}
		if (a == n)
		{
			return 1;
		}
		else
		{
			return 0;
		}
	}
	else
	{
		return 0;
	}
}
//--------------------------------------------------------------------------------------------------------------
// 用户名查重系统
int CheckName(char name[1000])
{
	int a = 0;   //计数器
	if (x == 0)   //第一个注册的人无重复
	{
		return 1;
	}
	else
	{
		for (int i = 0; i < x; i++)
		{
			if (strcmp(name, peo[i].user) == 0)
			{
				break;
			}
			else
			{
				a++;
			}
		}
		if (a == x)   //用户名无重复
		{
			return 1;
		}
		else
		{
			return 0;
		}
	}
}
//--------------------------------------------------------------------------------------------------------------
// 密码规范系统
int NormalizePassword(char password[1000], int n)
{
	int a = 0;   //计数器
	if (n >= 6 && n <= 15)
	{
		for (int i = 0; i < n; i++)
		{
			if ((password[i] >= 48 && password[i] <= 57) || (password[i] >= 65 && password[i] <= 90) || (password[i] >= 97 && password[i] <= 122))   //为字母或数字
			{
				a++;
			}
			else
			{
				break;
			}
		}
		if (a == n)
		{
			return 1;
		}
		else
		{
			return 0;
		}
	}
	else
	{
		return 0;
	}
}
//--------------------------------------------------------------------------------------------------------------
// 密码找回系统
int RefoundPassword()
{
	while (1)
	{
		char Name2[1000];
		int Key1 = 0;
		cout << "请输入用户名:";
		cin >> Name2;
		for (int i = 0; i < *X; i++)   //逐个人员遍历
		{
			if (strcmp(Name2, peo[i].user) == 0)   //判断输入的用户名有无注册或是否正确
			{
				Key1 = 1;
				User2 = i;
			}
		}
		system("cls");   //清屏
		if (Key1 == 0)   //钥匙解锁失败
		{
			cout << "您的用户名未注册或输入错误!!!" << endl << endl;
			cout << "1.继续找回密码" << endl;
			cout << "2.退出系统" << endl;
			cout << "请输入数字实现对应功能:";
			int m2 = Check(2);   //只返回1、2
			cout << endl;
			if (m2 == 1)
			{
				system("cls");   //清屏
				continue;
			}
			else if (m2 == 2)
			{
				system("cls");   //清屏
				return 0;
			}
		}
		else if (Key1 == 1)   //钥匙解锁成功
		{
			cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
			cout << "\t\t\t\t\t\t     您的密码为:" << peo[User2].password << endl;
			Sleep(2000);
			system("pause");
			system("cls");   //清屏
			return 1;
		}
	}
}
//--------------------------------------------------------------------------------------------------------------
// 账号注册系统:
int Register()
{
	int key1 = 0;   //注册成功的钥匙
	int key2 = 0;   //用户名设置成功的钥匙
	int key3 = 0;   //密码设置成功钥匙
	int key4 = 0;   //退出程序的钥匙
	int h = 0;   //轮转片
	char recheck[100];
	peo[x].number = x + 1;   //标号
	while (1)   //创建用户名
	{
		cout << "请设置用户名(不超过15个字符,空格与汉字为非法字符):";
		cin.get();   //cin.getline前要吸收回车键
		cin.getline(peo[x].user, 1000);
		int n1 = strlen(peo[x].user);
		int p1 = NormalizeName(peo[x].user, n1);   //返回1用户名通过,返回0则不通过
		int p2 = CheckName(peo[x].user);   //返回1用户名通过,返回0则不通过
		if (p1 == 1 && p2 == 1)
		{
			key2 = 1;   //钥匙开锁,用户名设置成功
			break;
		}
		else
		{
			cout << endl << endl;
			cout << "用户名重复或非法!!!" << endl;
			cout << "1.重新设置用户名" << endl;
			cout << "2.退出注册" << endl;
			cout << "请输入数字实现对应功能:";
			int q = Check(2);   //只返回1、2
			cout << endl;
			if (q == 1)   //重新设置用户名
			{
				strcpy(peo[x].user, Void);   //清空输入的用户名
				system("cls");   //清屏
				continue;
			}
			else if (q == 2)    //退出注册
			{
				system("cls");   //清屏
				break;
			}
		}
	}
	cout << endl << endl;
	if (key2 == 1)
	{
		while (1)   //设置密码
		{
			system("cls");   //清屏
			cout << "请设置密码(只能为字母和数字,长度不小于6,不超过15):";
			if (h != 0)
			{
				cin.get();   //cin.getline前要吸收回车键
			}
			cin.getline(peo[x].password, 1000);
			//cout << peo[x].password << endl;
			int n2 = strlen(peo[x].password);
			int p3 = NormalizePassword(peo[x].password, n2);   //返回1密码通过,返回0则不通过
			if (p3 == 1)
			{
				key3 = 1;   //钥匙开锁,密码设置成功
			}
			else
			{
				cout << endl << endl;
				cout << "密码非法!!!" << endl;
				cout << "1.重新设置密码" << endl;
				cout << "2.退出注册" << endl;
				cout << "请输入数字实现对应功能:";
				int q = Check(2);   //只返回1、2
				cout << endl;
				if (q == 1)   //重新设置密码
				{
					strcpy(peo[x].password, Void);   //清空输入的密码
					cout << endl << endl;
					h++;
					continue;
				}
				else if (q == 2)    //退出注册
				{
					system("cls");   //清屏
					break;
				}
			}
			if (key3 == 1)
			{
				system("cls");   //清屏
				while (1)
				{
					cout << "请再次输入密码:";
					cin >> recheck;
					//cout << recheck << endl;
					if (strcmp(recheck, peo[x].password) == 0)
					{
						cout << endl;
						cout << "注册成功!!!" << endl << endl;
						(*X)++;
						key1 = 1;   //钥匙开锁,注册成功
						key4 = 1;   //钥匙开锁,退出设置用户名和密码的程序
						break;
					}
					else
					{
						cout << endl;
						cout << "两次密码不一致!!!" << endl;
						cout << "1.重新设置密码" << endl;
						cout << "2.退出注册" << endl;
						cout << "请输入数字实现对应功能:";
						int z = Check(2);   //只返回1、2
						cout << endl;
						if (z == 1)
						{
							strcpy(recheck, Void);   //清空输入的密码
							strcpy(peo[x].password, Void);   //清空输入的密码
							key3 = 0;   //关锁
							h++;
							break;
						}
						else if (z == 2)
						{
							system("cls");   //清屏
							key4 = 1;   //钥匙开锁,退出设置用户名和密码的程序
							break;
						}
					}
				}
			}
			if (key4 == 1)
			{
				break;
			}
		}
	}
	if (key1 == 1)
	{
		cout << "是否直接进入程序?" << endl;
		cout << "1.是" << endl;
		cout << "2.否" << endl;
		cout << "请输入数字实现对应功能:";
		int m = Check(2);   //只返回1、2
		cout << endl;
		if (m == 1)
		{
			User = x - 1;
			return m;
		}
		else if (m == 2)
		{
			return m;
		}
	}
}
//--------------------------------------------------------------------------------------------------------------
// 账号登录系统
int SignIn()
{
	char Name[1000], Password[1000];
	int Key1 = 0;   //判断用户名正误的钥匙
	int Key2 = 0;   //判断密码正误的钥匙
	while (1)
	{
		cout << "请输入用户名:";   //有BUG
		cin >> Name;
		for (int i = 0; i < *X; i++)   //逐个人员遍历
		{
			if (strcmp(Name, peo[i].user) == 0)   //判断输入的用户名有无注册或是否正确
			{
				Key1 = 1;
				User = i;
			}
		}
		if (Key1 == 0)   //钥匙解锁失败
		{
			cout << "您的用户名未注册或输入错误!!!" << endl << endl;
			cout << "1.继续登录" << endl;
			cout << "2.退出登录" << endl;
			cout << "请输入数字实现对应功能:";
			int m1 = Check(2);   //只返回1、2
			cout << endl;
			if (m1 == 1)
			{
				system("cls");   //清屏
				continue;
			}
			else if (m1 == 2)
			{
				system("cls");   //清屏
				return 0;
			}
		}
		else if (Key1 == 1)   //钥匙解锁成功
		{
			cout << "请输入密码:";
			cin >> Password;
			if (strcmp(Password, peo[User].password) == 0)   //判断输入的密码是否正确
			{
				Key2 = 1;   //钥匙开锁,成功登陆
			}
			if (Key2 == 0)   //密码错误
			{
				cout << endl << "您输入的密码有误" << endl;
				cout << "1.重新登录" << endl;
				cout << "2.找回密码" << endl;
				cout << "3.退出登录" << endl;
				cout << "请输入数字实现对应功能:";
				int m2 = Check(3);   //只返回1、2、3
				cout << endl;
				if (m2 == 1)
				{
					Key1 = 0;   //重新登陆关锁
					system("cls");   //清屏
					continue;
				}
				else if (m2 == 2)
				{
					Key1 = 0;   //重新登陆关锁
					system("cls");   //清屏
					int r = RefoundPassword();
					if (r == 1)
					{
						cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
						cout << "\t\t\t\t\t\t     密码找回成功!!!" << endl;
						Sleep(2000);
						system("cls");   //清屏
						continue;
					}
					else if (r == 0)
					{
						cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
						cout << "\t\t\t\t\t\t     密码找回失败!!!" << endl;
						Sleep(2000);
						system("cls");   //清屏
						continue;
					}
				}
				else if (m2 == 3)
				{
					system("cls");   //清屏
					return 0;
				}
			}
			else if (Key2 == 1)   //密码正确
			{
				system("cls");   //清屏
				cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
				cout << "\t\t\t\t\t\t      登录成功!!!" << endl;
				Sleep(2000);   //延时2秒
				return 1;
			}
		}
	}
}
//--------------------------------------------------------------------------------------------------------------
// 游戏部分
//1.雷霆战机
/*=============== all the structures ===============*/
 
typedef struct Frame
{
	COORD position[2];
	int flag;
}Frame;
 
/*=============== all the functions ===============*/
 
void SetPos(COORD a)// set cursor
{
	HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(out, a);
}
 
void SetPos(int i, int j)// set cursor
{
	COORD pos = { i, j };
	SetPos(pos);
}
 
 
//把第y行,[x1, x2) 之间的坐标填充为 ch
void drawRow(int y, int x1, int x2, char ch)
{
	SetPos(x1, y);
	for (int i = 0; i <= (x2 - x1); i++)
		cout << ch;
}
 
//在a, b 纵坐标相同的前提下,把坐标 [a, b] 之间填充为 ch
void drawRow(COORD a, COORD b, char ch)
{
	if (a.Y == b.Y)
		drawRow(a.Y, a.X, b.X, ch);
	else
	{
		SetPos(0, 25);
		cout << "error code 01:无法填充行,因为两个坐标的纵坐标(x)不相等";
		system("pause");
	}
}
 
//把第x列,[y1, y2] 之间的坐标填充为 ch
void drawCol(int x, int y1, int y2, char ch)
{
	int y = y1;
	while (y != y2 + 1)
	{
		SetPos(x, y);
		cout << ch;
		y++;
	}
}
 
//在a, b 横坐标相同的前提下,把坐标 [a, b] 之间填充为 ch
void drawCol(COORD a, COORD b, char ch)
{
	if (a.X == b.X)
		drawCol(a.X, a.Y, b.Y, ch);
	else
	{
		SetPos(0, 25);
		cout << "error code 02:无法填充列,因为两个坐标的横坐标(y)不相等";
		system("pause");
	}
}
 
//左上角坐标、右下角坐标、用row填充行、用col填充列
void drawFrame(COORD a, COORD  b, char row, char col)
{
	drawRow(a.Y, a.X + 1, b.X - 1, row);
	drawRow(b.Y, a.X + 1, b.X - 1, row);
	drawCol(a.X, a.Y + 1, b.Y - 1, col);
	drawCol(b.X, a.Y + 1, b.Y - 1, col);
}
 
void drawFrame(int x1, int y1, int x2, int y2, char row, char col)
{
	COORD a = { x1, y1 };
	COORD b = { x2, y2 };
	drawFrame(a, b, row, col);
}
 
void drawFrame(Frame frame, char row, char col)
{
	COORD a = frame.position[0];
	COORD b = frame.position[1];
	drawFrame(a, b, row, col);
}
 
void drawPlaying()
{
	drawFrame(0, 0, 48, 24, '=', '|');//	draw Map frame;
	drawFrame(49, 0, 79, 4, '-', '|');//		draw output frame
	drawFrame(49, 4, 79, 9, '-', '|');//		draw score frame
	drawFrame(49, 9, 79, 20, '-', '|');//	draw operate frame
	drawFrame(49, 20, 79, 24, '-', '|');//	draw other message frame
	SetPos(52, 6);
	cout << "得分:";
	SetPos(52, 7);
	cout << "称号:";
	SetPos(52, 10);
	cout << "操作方式:";
	SetPos(52, 12);
	cout << "  a,s,d,w 控制移动,j开炮";
	SetPos(52, 14);
	cout << "  p 暂停游戏";
	SetPos(52, 16);
	cout << "  e 退出游戏";
}
 
//在[a, b)之间产生一个随机整数
int random(int a, int b)
{
	int c = (rand() % (a - b)) + a;
	return c;
}
 
//在两个坐标包括的矩形框内随机产生一个坐标
COORD random(COORD a, COORD b)
{
	int x = random(a.X, b.X);
	int y = random(a.Y, b.Y);
	COORD c = { x, y };
	return c;
}
 
bool  judgeCoordInFrame(Frame frame, COORD spot)
{
	if (spot.X >= frame.position[0].X)
		if (spot.X <= frame.position[1].X)
			if (spot.Y >= frame.position[0].Y)
				if (spot.Y <= frame.position[0].Y)
					return true;
	return false;
}
 
void printCoord(COORD a)
{
	cout << "( " << a.X << " , " << a.Y << " )";
}
 
void printFrameCoord(Frame a)
{
	printCoord(a.position[0]);
	cout << " - ";
	printCoord(a.position[1]);
}
 
int drawMenu()
{
	SetPos(30, 1);
	cout << "P l a n e  W a r";
	drawRow(3, 0, 79, '-');
	drawRow(5, 0, 79, '-');
	SetPos(28, 4);
	cout << "w 和 s 选择, j 确定";
	SetPos(15, 11);
	cout << "1. 简单的敌人";
	SetPos(15, 13);
	cout << "2. 冷酷的敌人";
	drawRow(20, 0, 79, '-');
	drawRow(22, 0, 79, '-');
	SetPos(47, 11);
	cout << "简单的敌人:";
	SetPos(51, 13);
	cout << "简单敌人有着较慢的移动速度。";
	SetPos(24, 21);
	cout << "说明:得分超过200即为胜利";
	int j = 11;
	SetPos(12, j);
	cout << ">>";
	while (1)
	{
		if (_kbhit())
		{
			char x = _getch();
			switch (x)
			{
			case 'w':
			{
				if (j == 13)
				{
					SetPos(12, j);
					cout << " ";
					j = 11;
					SetPos(12, j);
					cout << ">>";
					SetPos(51, 13);
					cout << "            ";
					SetPos(47, 11);
					cout << "简单的敌人:";
					SetPos(51, 13);
					cout << "简单敌人有较慢的移动速度,比较容易对付";
				}
				break;
			}
			case 's':
			{
				if (j == 11)
				{
					SetPos(12, j);
					cout << " ";
					j = 13;
					SetPos(12, j);
					cout << ">>";
					SetPos(51, 13);
					cout << "              ";
					SetPos(47, 11);
					cout << "冷酷的敌人:";
					SetPos(51, 13);
					cout << "冷酷的敌人移动速度较快,不是很好对付哟。";
				}
				break;
			}
			case 'j':
			{
				if (j == 8)	return 1;
				else return 2;
			}
			}
		}
	}
}
/*================== the Game Class ==================*/
 
class Game
{
public:
	COORD position[10];
	COORD bullet[10];
	Frame enemy[8];
	int rank;
	int rankf;
	string title;
	int flag_rank;
 
	Game();
 
	//初始化所有
	void initPlane();
	void initBullet();
	void initEnemy();
 
	//初始化其中一个
	//void initThisBullet( COORD );
	//void initThisEnemy( Frame );
 
	void planeMove(char);
	void bulletMove();
	void enemyMove();
	void drawPlane();
	void drawPlaneToNull();
	void drawBullet();
	void drawBulletToNull();
	void drawEnemy();
	void drawEnemyToNull();
	void drawThisBulletToNull(COORD);
	void drawThisEnemyToNull(Frame);
	void Pause();
	void Playing();
	int judgePlane();
	void judgeEnemy();
	void Shoot();
	void GameOver();
	void printScore();
};
Game::Game()
{
	initPlane();
	initBullet();
	initEnemy();
	score = 0;
	rank = 25;
	rankf = 0;
	flag_rank = 0;
}
void Game::initPlane()
{
	COORD centren = { 39, 22 };
	position[0].X = position[5].X = position[7].X = position[9].X = centren.X;
	position[1].X = centren.X - 2;
	position[2].X = position[6].X = centren.X - 1;
	position[3].X = position[8].X = centren.X + 1;
	position[4].X = centren.X + 2;
	for (int i = 0; i <= 4; i++)
		position[i].Y = centren.Y;
	for (int i = 6; i <= 8; i++)
		position[i].Y = centren.Y + 1;
	position[5].Y = centren.Y - 1;
	position[9].Y = centren.Y - 2;
}
void Game::drawPlane()
{
	for (int i = 0; i < 9; i++)
	{
		SetPos(position[i]);
		if (i != 5)
			cout << "O";
		else if (i == 5)
			cout << "|";
	}
}
void Game::drawPlaneToNull()
{
	for (int i = 0; i < 9; i++)
	{
		SetPos(position[i]);
		cout << " ";
	}
}
void Game::initBullet()
{
	for (int i = 0; i < 10; i++)
		bullet[i].Y = 30;
}
void Game::drawBullet()
{
	for (int i = 0; i < 10; i++)
	{
		if (bullet[i].Y != 30)
		{
			SetPos(bullet[i]);
			cout << "^";
		}
	}
}
void Game::drawBulletToNull()
{
	for (int i = 0; i < 10; i+&#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

谢铭轩

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值