跳到正文

剪贴板

剪贴板 oixwc3lm

原文
剪贴板信息

剪贴板信息

收录
更新

前情提要

玩家:这 也 运 行 不 了 啊 ? C E 啊 ?

我:你在哪里运行的?

玩家:洛 谷 I D E 啊 ? 差 评 !

我:先别急着差评,你在 Dev-C++ 上运行一下试试……

总结

请在 Dev-C++ 上运行,否则会有 CE 的风险。


C++ 游戏党福利!!!

虽然现在只有二个,以后慢慢更新

我开源是为了你们好,再不关注+收藏我可就伤心了qwq

1.消灭星星。

C++
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
const int maxn = 20;
bool start_game = false;
int a[maxn][maxn];
string control;
struct pos {
	int x;
	int y;
};
bool vis[maxn][maxn];
int easy = 5, hard = 10, points = 0, wrong = 0;
int wide, dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};

class RandomNum {
	public:
		int creataRandomNum() {
			return rand() % 5 + 1;
		}
};

void Color(int a) {
	if (a == 0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
	if (a == 1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE);
	if (a == 2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
	if (a == 3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE);
	if (a == 4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
	if (a == 5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
}

int main();

bool remove(int x, int y) {
	if (x < 1 || x > wide || y < 1 || y > wide) {
		printf("错误:不在游戏区域内。");
		wrong++;
		return false;
	}
	int s = a[x][y];
	memset(vis, false, sizeof(vis));
	queue <pos> q;
	q.push({x, y});
	vis[x][y] = true;
	if (a[x][y] == 0) {
		cout << "错误: 这里没有方块。" << endl;
		wrong++;
		return false;
	}
	int no = 0;
	for (int i = 0; i < 4; i++)
		if (a[x + dx[i]][y + dy[i]] != s)
			no++;
	if (no == 4) {
		cout << "错误: 你不能消除此方块。" << endl;
		wrong++;
		return false;
	}
	int cnt = 1;
	while (!q.empty()) {
		pos u = q.front();
		q.pop();
		a[u.x][u.y] = 0;
		for (int i = 0; i < 4; i++) {
			pos p = {u.x + dx[i], u.y + dy[i]};
			if (p.x >= 1 && p.x <= wide && p.y >= 1 && p.y <= wide && vis[p.x][p.y] == false && a[p.x][p.y] == s) {
				q.push(p);
				cnt++;
				vis[p.x][p.y] = true;
			}
		}
	}
	printf("得分:%d\n", cnt);
	if (cnt >= 5) printf("漂亮的一击!\n");
	points += cnt;
	for (int i = 1; i <= wide; i++) {
		int cnt0 = 0;
		for (int j = wide; j >= 1; j--) if (a[j][i] == 0) cnt0++;
		while (cnt0--) {
			int m = wide;
			while (a[m][i] != 0) m--;
			for (int j = m; j >= 2; j--) swap(a[j][i], a[j - 1][i]);
		}
	}
	int cnt_ = 0;
	for (int i = 1; i <= wide; i++) {
		bool flag = true;
		for (int j = 1; j <= wide; j++) {
			if (a[j][i] != 0) {
				flag = false;
				break;
			}
		}
		if (flag) cnt_++;
	}
	for (int i = 1; i <= cnt_; i++) {
		for (int j = 1; j <= wide; j++) {
			bool flag = true;
			for (int k = 1; k <= wide; k++) {
				if (a[k][j] != 0) {
					flag = false;
					break;
				}
			}
			if (flag) {
				for (int k = 1; k <= wide; k++)
					for (int s = j; s < wide; s++)
						swap(a[k][s], a[k][s + 1]);
				break;
			}
		}
	}
	return true;
}

void read() {
	while (1) {
		cin >> control;
		if (control == "map") {
			cout << "请使用英文输入法。" << endl;
			cout << "所有的括号内为应输入的数字。" << endl;
			cout << "本游戏与您玩过的消灭星星最大的不同:只能通过键盘键入操控字符。" << endl;
			cout << "命令1 \"map\" 了解如何玩这个游戏。" << endl;
			cout << "命令2 \"easy\" 宽度=" << easy << "。" << endl;
			cout << "命令3 \"hard\" 宽度=" << hard <<  "。" << endl;
			cout << "命令4 \"click (x) (y)\" 点击第x行第y列的方块。" << endl;
			cout << "命令5 \"again\" 重开一局游戏。" << endl;
			cout << "附注:() 并不用输入,例如,上面的 click (x) (y),如果你要点击第一行,第二列,直接输入 click 1 2 就行了,不用加括号" << endl;
			continue;
		} else if (control == "click") {
			if (start_game == true) {
				int x, y;
				cin >> x >> y;
				if (remove(x, y)) break;
				else continue;
			} else {
				cout << "错误: 你还没有开始游戏。" << endl;
				continue;
			}
		} else if (control == "easy") {
			if (start_game == false) {
				wide = easy;
				break;
			} else {
				cout << "错误: 你已经开始了游戏。" << endl;
				continue;
			}
		} else if (control == "hard") {
			if (start_game == false) {
				wide = hard;
				break;
			} else {
				cout << "错误: 你已经开始了游戏。" << endl;
				continue;
			}
		} else if (control == "again") {
			main();
			return;
		} else cout << "错误: 没有此命令 \"" << control << "\" 。" << endl;
	}
	return;
}

bool check() {
	for (int i = 1; i <= wide; i++)
		for (int j = 1; j <= wide; j++)
			for (int k = 0; k < 4; k++)
				if (a[i][j] == a[i + dx[k]][j + dy[k]] && a[i][j] != 0) return true;
	return false;
}

void print() {
	Color(0);
	printf(" ");
	for (int i = 1; i <= wide; i++) printf(" %d",i);
	printf("\n");
	for (int i = 1; i <= wide; i++) {
		Color(0);
		printf("%d",i);
		if (i < 10) printf(" ");
		for (int j = 1; j <= wide; j++) {
			if (a[i][j]) {
				Color(a[i][j]);
				cout << "■";
			}
			else cout << "  ";
		}
		printf("\n");
	}
	Color(0);
	return;
}

void play_game() {
	while (check()) {
		cout << "已消除方块数:" << points << endl;
		print();
		read();
	}
	print();
	cout << "游戏结束!" << endl << "已消除方块数:" << points << endl;
	return;
}

void background() {
	start_game = false;
	cout << "输入 \"map\" 了解如何玩这个游戏。" << endl;
	read();
	srand(unsigned(time(NULL)));
	for (int i = 1; i <= wide; i++) {
		for (int j = 1; j <= wide; j++) {
			RandomNum random_num;
			a[i][j] = random_num.creataRandomNum();
		}
	}
	start_game = true;
	return;
}

int main() {
	start_game = false;
	Color(0);
	cout << "Author: liuruiqing" << endl;
	points = 0;
	background();
	play_game();
	return 0;
}
  1. 坦克大战(关卡时常更新)
C++
#include <bits/stdc++.h>
#include <conio.h>
#include <windows.h>

using namespace std;

#define shoot 115
#define shang 72
#define xia 80
#define zuo 75
#define you 77
#define _pause 32

#define s(x) Sleep(x);
#define c(x) Color(x);
#define b(x) BackGround(x);
#define clear system("pause"); system("cls");

struct zd {
	int x, y;
	int dir;
	int dr_or_me; //敌人0,我1
	int si;
};

struct dr {
	int x, y;
	int dir;
	int si;
};

int jiangli[10] = {0, 10, 20, 50, 75, 100, 150, 200, 300, 500}, has = 1;
int* zdsi[15][20];

//背景颜色的代码:0黑色 1蓝色 2绿色 3湖蓝色 4红色 5紫色 6黄色 7白色 8灰色 9淡蓝色
//改变当前光标方块的背景颜色和字体颜色
void BackGround(unsigned int BackGroundColor) {
	HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);  //获取控制台的句柄
	SetConsoleTextAttribute(handle, BackGroundColor * 0x10);//改变当前光标的背景和字体颜色
}

const int hang = 10, kuan = 15, yijiesuo = 4;

int is_zd[15][20], zd_dom[15][20], is_dr[15][20];

int mp[11][11][16] = {
	{},
	{
		{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, 0, 0, 0, 0},
		{0, 4, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 4},
		{0, 0, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 0},
		{0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0},
		{0, 0, 4, 0, 3, 0, 3, 3, 3, 3, 3, 0, 3, 0, 4, 0},
		{0, 6, 6, 6, 0, 0, 6, 6, 0, 6, 6, 0, 0, 6, 6, 6},
		{0, 0, 0, 0, 6, 0, 0, 3, 4, 3, 0, 0, 6, 0, 0, 0},
		{0, 0, 6, 0, 6, 0, 0, 6, 6, 6, 0, 0, 6, 0, 6, 0},
		{0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0},
		{0, 0, 0, 0, 0, 0, 0, 6, 5, 6, 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, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0},
		{0, 6, 6, 0, 0, 6, 0, 0, 6, 0, 0, 6, 0, 0, 6, 6},
		{0, 6, 4, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 4, 6},
		{0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0},
		{0, 0, 6, 3, 0, 0, 6, 3, 6, 3, 6, 0, 0, 3, 6, 0},
		{0, 3, 3, 3, 0, 0, 6, 6, 0, 6, 6, 0, 0, 3, 3, 3},
		{0, 0, 0, 0, 6, 0, 0, 4, 4, 4, 0, 0, 6, 0, 0, 0},
		{0, 0, 6, 0, 6, 0, 0, 0, 0, 0, 0, 0, 6, 0, 6, 0},
		{0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0},
		{0, 0, 0, 0, 0, 0, 0, 6, 5, 6, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		{0, 4, 6, 0, 6, 0, 4, 6, 0, 6, 4, 0, 6, 0, 6, 4},
		{0, 4, 4, 0, 3, 6, 4, 0, 0, 0, 4, 6, 3, 0, 4, 4},
		{0, 0, 0, 0, 0, 0, 6, 0, 6, 0, 6, 0, 0, 0, 0, 0},
		{0, 0, 0, 0, 0, 0, 4, 3, 6, 3, 4, 0, 0, 3, 6, 0},
		{0, 3, 3, 3, 0, 0, 6, 6, 0, 6, 6, 0, 0, 3, 3, 3},
		{0, 0, 6, 0, 0, 3, 6, 4, 6, 4, 6, 3, 0, 0, 6, 0},
		{0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0},
		{0, 3, 3, 0, 0, 0, 0, 6, 6, 6, 0, 0, 0, 0, 3, 3},
		{0, 0, 0, 0, 0, 0, 0, 6, 5, 6, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		{0, 0, 6, 0, 0, 4, 4, 6, 0, 6, 6, 0, 6, 6, 6, 0},
		{0, 6, 6, 6, 0, 4, 0, 6, 4, 4, 4, 4, 4, 4, 4, 0},
		{0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0},
		{0, 3, 0, 0, 0, 4, 0, 6, 0, 6, 0, 4, 0, 4, 4, 4},
		{0, 3, 0, 0, 0, 4, 0, 6, 0, 6, 0, 4, 0, 0, 0, 0},
		{0, 6, 0, 0, 0, 6, 0, 6, 4, 6, 0, 0, 0, 3, 3, 4},
		{0, 0, 3, 4, 4, 4, 0, 0, 0, 0, 0, 6, 0, 3, 0, 0},
		{0, 0, 0, 6, 3, 0, 0, 6, 6, 6, 0, 0, 0, 3, 0, 3},
		{0, 0, 6, 0, 0, 0, 0, 6, 5, 6, 0, 0, 0, 3, 0, 0}
	}
  // 你可以在这里设计关卡,如果觉得好欢迎私信我投稿。
};

int ming = 5, fangxiang = 1;
int now[15][20], pts = 0;
const int movx[4] = {-1, 1, 0, 0}, movy[4] = {0, 0, -1, 1};

void Color(int a) {
	if (a == 0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);//白
	if (a == 1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE);//靛蓝
	if (a == 2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);//绿
	if (a == 3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE);//紫
	if (a == 4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);//红
	if (a == 5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);//海蓝
	if (a == 6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);//米黄
}

void setbg(int x, int y, int z, int a) {
	b(0);
	c(0);
	printf("关卡号:%d 得分:%d 生命:%d 击杀数:%d\n", a, pts, ming, z);
	b(7);
	for (int i = 1; i <= y + 2; i++) printf("  ");
	b(0);
	printf("\n");
	for (int i = 1; i <= x; i++) {
		b(7);
		printf("  ");
		for (int j = 1; j <= y; j++) {
			b(0);
			if (!now[i][j]) printf("  ");
			else {
				b(now[i][j]);
				if (now[i][j] == 2) {
					if (fangxiang == 1) cout << "↑";
					else if (fangxiang == 2) cout << "↓";
					else if (fangxiang == 3) cout << "←";
					else if (fangxiang == 4) cout << "→";
				} else if (now[i][j] == 8) {
					if (is_dr[i][j] == 1) cout << "↑";
					else if (is_dr[i][j] == 2) cout << "↓";
					else if (is_dr[i][j] == 3) cout << "←";
					else if (is_dr[i][j] == 4) cout << "→";
				} else if (is_zd[i][j]) {
					if (is_zd[i][j] == 1) cout << "↑";
					else if (is_zd[i][j] == 2) cout << "↓";
					else if (is_zd[i][j] == 3) cout << "←";
					else if (is_zd[i][j] == 4) cout << "→";
				} else printf("  ");
			}
		}
		b(7);
		printf("  \n");
	}
	for (int i = 1; i <= y + 2; i++) printf("  ");
	printf("\n");
	b(0);
}

void jiazai(int x) {
	printf("33%%...");
	s(x);
	system("cls");
	printf("67%%...");
	s(x);
	system("cls");
	printf("83%%...");
	s(x);
	system("cls");
	printf("100%%");
	s(x);
	system("cls");
}

zd zdq[100010];
dr drq[100010];
int zdfront = 1, zdrear = 0;
int drfront = 1, drrear = 0;

bool play_game(int x) {
	int drb[3] = {1, 8, 15}, sn = 1;
	double tim = 0;
	//jiazai(1000);
	int kill = 0, nowdiren = 3, nowx = 10, nowy = 6;
	for (int i = 1; i <= hang; i++) {
		for (int j = 1; j <= kuan; j++) {
			now[i][j] = mp[x][i][j];
			if (i == nowx && j == nowy) now[i][j] = 2;
		}
	}
	zdfront = 1, zdrear = 0;
	drfront = 1, drrear = 0;
	drq[++drrear] = {1, 1, 2, 0};
	drq[++drrear] = {1, 8, 2, 0};
	drq[++drrear] = {1, 15, 2, 0};
	while (1) {
		tim += 1;
		while (nowdiren < 3) drq[++drrear] = {1, drb[sn], 2, 0}, sn = sn % 3 + 1, ++nowdiren;
		for (int i = 1; i <= hang; i++)
			for (int j = 1; j <= kuan; j++)
				zdsi[i][j] = NULL;
		memset(is_dr, 0, sizeof(is_dr));
		memset(is_zd, 0, sizeof(is_zd));
		memset(zd_dom, 0, sizeof(zd_dom));
		for (int i = 1; i <= hang; i++) {
			for (int j = 1; j <= kuan; j++) {
				now[i][j] = mp[x][i][j];
				if (i == nowx && j == nowy) now[i][j] = 2;
			}
		}
		for (int i = 1; i <= hang; i++)
			for (int j = 1; j <= kuan; j++)
				zdsi[i][j] = NULL;
		for (int i = drfront; i <= drrear; i++) now[drq[i].x][drq[i].y] = 8, is_dr[drq[i].x][drq[i].y] = drq[i].dir;
		for (int i = zdfront; i <= zdrear; i++) {
			zd_dom[zdq[i].x][zdq[i].y] = zdq[i].dr_or_me + 1;
			zdsi[zdq[i].x][zdq[i].y] = &zdq[i].si;
			now[zdq[i].x][zdq[i].y] = 1 + zdq[i].dr_or_me * 8, is_zd[zdq[i].x][zdq[i].y] = zdq[i].dir;
		}
		//???
		system("cls");
		setbg(hang, kuan, kill, x);
		s(200);
		if (ming == 0) return false;
		if (pts >= jiangli[has]) ++ming, ++has;
		if (kill >= 10) return true;
		int ch = -1;
		if (kbhit()) {
			ch = getch();
			if (ch == 224) ch = getch();
		}

		if (zd_dom[nowx][nowy] == 1) --ming, nowx = 10, nowy = 6;
		if (ch != -1) {
			if (ch == _pause) {
				printf("\n\n\n");
				system("pause");
			}
			if (ch == shoot)
				if (tim >= 3)
					zdq[++zdrear] = {nowx, nowy, fangxiang, 1, 0}, tim = 0;
			if (ch == shang) {
				fangxiang = 1;
				int sx = nowx + movx[fangxiang - 1], sy = nowy + movy[fangxiang - 1];
				if (sx >= 1 && sx <= hang && sy >= 1 && sy <= kuan && !now[sx][sy]) swap(now[sx][sy], now[nowx][nowy]), nowx = sx, nowy = sy;
			}
			if (ch == xia) {
				fangxiang = 2;
				int sx = nowx + movx[fangxiang - 1], sy = nowy + movy[fangxiang - 1];
				if (sx >= 1 && sx <= hang && sy >= 1 && sy <= kuan && !now[sx][sy]) swap(now[sx][sy], now[nowx][nowy]), nowx = sx, nowy = sy;
			}
			if (ch == zuo) {
				fangxiang = 3;
				int sx = nowx + movx[fangxiang - 1], sy = nowy + movy[fangxiang - 1];
				if (sx >= 1 && sx <= hang && sy >= 1 && sy <= kuan && !now[sx][sy]) swap(now[sx][sy], now[nowx][nowy]), nowx = sx, nowy = sy;
			}
			if (ch == you) {
				fangxiang = 4;
				int sx = nowx + movx[fangxiang - 1], sy = nowy + movy[fangxiang - 1];
				if (sx >= 1 && sx <= hang && sy >= 1 && sy <= kuan && !now[sx][sy]) swap(now[sx][sy], now[nowx][nowy]), nowx = sx, nowy = sy;
			}
			if (zd_dom[nowx][nowy] == 1) --ming, nowx = 10, nowy = 6;
		}
		// 更新敌人
		int r2 = drrear;
		for (int i = drfront; i <= r2; i++) {
			now[drq[i].x][drq[i].y] = 0;
			if (is_zd[drq[i].x][drq[i].y] && zd_dom[drq[i].x][drq[i].y] == 2) {
				*zdsi[drq[i].x][drq[i].y] = 1;
				b(0);
				c(0)
				++pts, ++drfront, ++kill;
				--nowdiren;
				continue;
			}
			int opt = rand() % 20;
			if (opt <= 3) {
				int sx = drq[i].x + movx[opt], sy = drq[i].y + movy[opt];
				if (sx < 1 || sx > hang || sy < 1 || sy > kuan || (now[sx][sy] && now[sx][sy] != 1 && now[sx][sy] != 9)) {
					drq[++drrear] = {drq[i].x, drq[i].y, opt + 1, 0};
					++drfront;
					continue;
				}
				else if (is_zd[sx][sy] && zd_dom[drq[i].x][drq[i].y] == 2) {
					++pts, ++drfront, ++kill;
					*zdsi[sx][sy] = 1;
					b(0);
					c(0);
					--nowdiren;
					continue;
				}
				else {
					drq[++drrear] = {sx, sy, opt + 1, 0};
					++drfront;
				}
			}
			else {
				drq[++drrear] = {drq[i].x, drq[i].y, drq[i].dir, 0};
				++drfront;
			}
			if (opt <= 4) {
				zdq[++zdrear] = {drq[i].x, drq[i].y, drq[i].dir, 0, 0};
			}
		}
		// 更新子弹
		int r1 = zdrear;
		for (int i = zdfront; i <= r1; i++) {
			if (zdq[i].si) {
				++zdfront;
				continue;
			}
			int sx = zdq[i].x + movx[zdq[i].dir - 1], sy = zdq[i].y + movy[zdq[i].dir - 1];
			if (sx < 1 || sx > hang || sy < 1 || sy > kuan || now[sx][sy] == 4) {
				++zdfront;
				continue;
			}
			if (now[sx][sy] == 6) {
				now[sx][sy] = 0, ++zdfront;
				mp[x][sx][sy] = 0;
				continue;
			}
			if (now[sx][sy] == 5) {
				now[sx][sy] = 0;
				mp[x][sx][sy] = 0;
				b(0);
				c(0);
				puts("你的旗子被轰了。");
				s(1000);
				return false;
			}
			zdq[++zdrear] = {sx, sy, zdq[i].dir, zdq[i].dr_or_me, 0};
			++zdfront;
			//
		}
	}
}

void start_game() {
	cout << "欢迎来到坦克大战!" << endl;
	cout << "规则请输入 \"map\"。如不需要,请输入 \"No\"。" << endl;
	string in;
	cin >> in;
	if (in == "map") {
		cout << "用方向键控制我方坦克。" << endl;
		cout << "s键射击,会出现一个我方子弹。" << endl;
		cout << "所有时刻场上有3个敌人。" << endl;
		cout << "你可以用子弹打他们,当子弹移到目标坦克上时,那个坦克阵亡。你的积分+1,击杀数+1。" << endl;
		cout << "如果击杀数>=10,进入下一关。" << endl;
		cout << "敌人会射出子弹,如果你碰到了对方的子弹,你的血量-1。" << endl;
		cout << "你的初始血量=5,如果血量=0,游戏结束,你输了。" << endl;
		cout << "达到一定的积分,你就能获得血量。" << endl;
		cout << "下面是一些图标的意思:" << endl;
		b(1);cout << "↑";cout << "↓";cout << "←"; cout << "→";c(0);cout << "是敌人的子弹,中间的箭头是子弹朝向的方向" << endl;
		b(2);cout << "↑";cout << "↓";cout << "←"; cout << "→";c(0);cout << "是自己,中间的箭头是自己朝向的方向" << endl;
		b(3);cout << "  ";c(0);cout << "是河水,你我双方的坦克都不能越过,但是子弹可以" << endl;
		b(4);cout << "  ";c(0);cout << "是水泥,你我双方的坦克和子弹都不能越过" << endl;
		b(5);cout << "  ";c(0);cout << "是军旗,如果任意一方的子弹碰到它,游戏立即结束,你输了" << endl;
		b(6);cout << "  ";c(0);cout << "是砖块,你我双方的坦克都不能越过,但是如果子弹碰到它,他就会消失" << endl;
		b(7);cout << "  ";c(0);cout << "这是道具,但是还没有更新,如果想体验私信我,我会很快更。" << endl;
		b(8);cout << "↑";cout << "↓";cout << "←"; cout << "→";c(0);cout << "是敌人,中间的箭头是敌人朝向的方向" << endl;
		b(9);cout << "↑";cout << "↓";cout << "←"; cout << "→";c(0);cout << "是自己的子弹,中间的箭头是子弹朝向的方向" << endl;
		s(5000);
	}
	b(0);
	c(0);
	cout << "让我们从第1关开始吧!" << endl;
	s(1000);
	clear
	for (int i = 1; i <= yijiesuo; i++) {
		if (play_game(i)) {
			system("cls");
			s(500);
			b(0);
			c(0);
			cout << "很好!进入下一关!" << endl;
			clear
		} else {
			system("cls");
			s(500);
			b(0);
			c(0);
			cout << "很遗憾,你失败了。" << endl;
			cout << "下回再来!" << endl;
			clear
			exit(0);
		}
	}
	cout << "这就是全部关卡了,更新进度:" << yijiesuo << "/30" << endl;
	cout << "下回再来!" << endl;
	s(2000);
	clear
	exit(0);
}

int main() {
	srand(unsigned(time(NULL)));
	b(0);
	c(0);
	cout << "Author: liuruiqing" << endl;
	start_game();
	clear
	return 0;
}

建议时常来看一看(一般是一月更行一次),但有些游戏会出新玩法(一般是一月更行一次)。

有 BUG 可以私信我。