[C++] 小游戏 征伐 SLG DNF 0.0.2 版本 zty出品

目录

[大家好~ 今天zty带来的是](#大家好~ 今天zty带来的是)

[War and Expedition SLG DNF 0.0.2 version](#War and Expedition SLG DNF 0.0.2 version)

讲人话就是

[War and Expedition = (游戏名,即征伐)](#War and Expedition = (游戏名,即征伐))

[SLG = (即时战略类游戏)](#SLG = (即时战略类游戏))

[DNF =(Did Not Finish)](#DNF =(Did Not Finish))

[0.0.2 = (内测版本号)](#0.0.2 = (内测版本号))

[version = (版本)](#version = (版本))

[适配编译器: Dev C++ 6.7.5](#适配编译器: Dev C++ 6.7.5)

地图介绍看上一篇文章

[先赞后看 养成习惯](#先赞后看 养成习惯)

CODE:

后记


大家好~ 今天zty带来的是

War and Expedition SLG DNF 0.0.2 version

讲人话就是

War and Expedition = (游戏名,即征伐)

SLG = (即时战略类游戏)

DNF =(Did Not Finish)

0.0.2 = (内测版本号)

version = (版本)

适配编译器: Dev C++ 6.7.5

地图介绍看上一篇文章

OK啊,废话不多说

++先赞后看 养成习惯++

CODE:

cpp 复制代码
#include<bits/stdc++.h>
//#include<dpcq.h>
#include<conio.h>
#include<time.h>
#include<windows.h>
using namespace std;
long long tb = 0;
void zhandou();
void chaxun();
void buzhen();
void kuojun();
void budui();
void Yan(int a) {// 1蓝 2绿 3紫 4红 5黄 6深蓝 7棕 8浅灰 9深灰 10绿绿 11绿紫 12绿黄 13蓝蓝
	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_RED | FOREGROUND_GREEN);
	if (a == 6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
	if (a == 7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN);
	if (a == 8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
	if (a == 9) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
	if (a == 10) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | BACKGROUND_GREEN);
	if (a == 11) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_BLUE | BACKGROUND_GREEN);
	if (a == 12) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_GREEN);
	if (a == 13) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE | BACKGROUND_INTENSITY | BACKGROUND_BLUE);
}
void Bai() {
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
}
int tu[43][43] = { //1河流 2桥梁 3高山 4未定城 5地图边界 6我城 7我都 8敌城 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, 5},
	{5, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 3, 3, 3, 0, 0, 0, 8, 0, 0, 9, 5},
	{5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
};
struct wj {
	string jiangjun;//将军
	int bh;//编号
	int b;//步兵
	int d;//盾兵
	int g;//弓箭手
	int q;//骑兵
	bool state = 1; //是否存在
	int hen;
	int zong;
}
w1 = {"\0", 1, 0, 0, 0, 0, 1, 1, 2},
w2 = {"\0", 2, 0, 0, 0, 0, 1, 2, 1},
w3 = {"\0", 3, 0, 0, 0, 0, 1, 2, 2};
struct dj {
	string jiangjun;//将军
	int bh;//编号
	int b;//步兵
	int g;//弓箭手
	int d;//盾兵
	int q;//骑兵
	bool state = 1; //是否存在
	int hen;
	int zong;
}
d1 = {"\0", 1, 0, 0, 0, 0, 1, 40, 39},
d2 = {"\0", 2, 0, 0, 0, 0, 1, 39, 39},
d3 = {"\0", 3, 0, 0, 0, 0, 1, 39, 40};
struct jj {
	string name;
	int gong;
	float bjiacheng;//步兵加成
	float djiacheng;//盾兵加成
	float gjiacheng;//弓箭加成
	float qjiacheng;//骑兵加成
	int bh;
}
lb = {"吕布", 30, 1.2, 1.1, 1.1, 1.6, 1},
zy = {"赵云", 27, 1.3, 1.3, 1.4, 2.0, 2},
dw = {"典韦", 28, 1.9, 1.8, 1.8, 0.9, 3},
gy = {"关羽", 27, 1.5, 1.5, 1.5, 1.9, 4},
mc = {"马超", 25, 1.7, 1.4, 1.5, 1.7, 5},
zf = {"张飞", 24, 1.7, 1.3, 1.5, 1.7, 6},
hz = {"黄忠", 22, 1.6, 2.0, 1.9, 1.3, 7},
xc = {"许褚", 26, 1.4, 1.9, 1.4, 1.8, 8},
sc = {"孙策", 22, 1.4, 1.5, 2.3, 1.4, 9},
dsc = {"太史慈", 22, 1.6, 1.5, 1.9, 1.7, 10},
xhd = {"夏侯惇", 24, 1.6, 1.2, 1.6, 1.8, 11},
xhy = {"夏侯渊", 25, 1.5, 1.2, 1.8, 1.7, 12},
zl = {"张辽", 26, 1.8, 1.5, 1.3, 1.8, 13},
zh = {"张郃", 21, 1.8, 1.6, 1.2, 1.8, 14},
xh = {"徐晃", 24, 1.6, 1.9, 1.2, 1.6, 15},
pd = {"庞德", 19, 1.2, 1.4, 1.8, 1.7, 16},
gn = {"甘宁", 23, 1.8, 1.4, 1.7, 1.5, 17},
zt = {"周泰", 22, 1.5, 1.8, 1.4, 1.7, 18},
wy = {"魏延", 20, 1.6, 1.7, 1.3, 1.5, 19},
zx = {"张绣", 22, 1.8, 1.3, 1.6, 1.6, 20},
wc = {"文丑", 17, 1.5, 1.5, 1.7, 1.5, 21},
yl = {"颜良", 17, 1.6, 1.4, 1.1, 1.4, 22},
dai = {"邓艾", 13, 1.5, 1.2, 1.5, 1.3, 23},
jw = {"姜维", 20, 1.5, 1.1, 1.6, 1.3, 24},
zgl = {"诸葛亮", 4, 2, 2, 2, 2, 25};
struct sb { //士兵
	string name;
	int gong;
	int xue;
	int jl;
	int jiazhi;
}
q = {"枪兵", 20, 7, 1, 1},
j = {"骑兵", 28, 9, 2, 2},
d = {"盾兵", 35, 3, 1, 1},
g = {"弓兵", 17, 6, 4, 1};

//void cd() {
//A:
//	cout << "   1.部队  2.查询  \n";
//	int b = _getch();
//	switch (b) {
//		case 1:
//			budui();
//			break;
//		case 2:
//			chaxun();
//			goto A;
//			break;
//		default:
//			goto A;
//			break;
//	}
//}

void zhanling(int shei) {
	switch (shei) {
		case 1:
			if (tu[w1.hen - 1][w1.zong] == 4 ) {
				tu[w1.hen - 1][w1.zong] = 6;
			}
			if (tu[w1.hen + 1][w1.zong] == 4 ) {
				tu[w1.hen + 1][w1.zong] = 6;
			}
			if ( tu[w1.hen][w1.zong - 1] == 4) {
				tu[w1.hen][w1.zong - 1] = 6;
			}
			if ( tu[w1.hen][w1.zong + 1] == 4) {
				tu[w1.hen][w1.zong + 1] = 6;
			}
			return;
			break;
		case 2:
			if (tu[w2.hen - 1][w2.zong] == 4 ) {
				tu[w2.hen - 1][w2.zong] = 6;
			}
			if (tu[w2.hen + 1][w2.zong] == 4 ) {
				tu[w2.hen + 1][w2.zong] = 6;
			}
			if ( tu[w2.hen][w2.zong - 1] == 4) {
				tu[w2.hen][w2.zong - 1] = 6;
			}
			if ( tu[w2.hen][w2.zong + 1] == 4) {
				tu[w2.hen][w2.zong + 1] = 6;
			}
			break;
		case 3:
			if (tu[w3.hen - 1][w3.zong] == 4 ) {
				tu[w3.hen - 1][w3.zong] = 6;
			}
			if (tu[w3.hen + 1][w3.zong] == 4 ) {
				tu[w3.hen + 1][w3.zong] = 6;
			}
			if ( tu[w3.hen][w3.zong - 1] == 4) {
				tu[w3.hen][w3.zong - 1] = 6;
			}
			if ( tu[w3.hen][w3.zong + 1] == 4) {
				tu[w3.hen][w3.zong + 1] = 6;
			}
			break;
		default:
			//TODO
			break;
	}
}
void kuojun(int a) {
kj:
	cout << "扩军:\n1,枪兵 1铜币/人 2,盾兵 1铜币/人 3,弓兵 1铜币/人 4,骑兵 2铜币/人 0,返回\n 铜币:";
	cout << tb;
	cout << "\n\n";
	int xuan = _getch();
	int sl = 0;
	switch (xuan) {
		case 1:
			cout << "扩军数量:";
			cin >> sl;
			if (tb - sl >= 0) {
				tb -= sl;
				if (a == 1) {
					w1.b += sl;
				} else if (a == 2) {
					w2.b += sl;
				} else {
					w3.b += sl;
				}
				goto kj;
			}
			cout << "钱不够\n\n";
			break;
		case 2:
			cout << "扩军数量:";
			cin >> sl;
			if (tb - sl >= 0) {
				tb -= sl;
				if (a == 1) {
					w1.d += sl;
				} else if (a == 2) {
					w2.d += sl;
				} else {
					w3.d += sl;
				}
				goto kj;
			}
			cout << "钱不够\n\n";
			break;
		case 3:
			cout << "扩军数量:";
			cin >> sl;
			if (tb - sl >= 0) {
				tb -= sl;
				if (a == 1) {
					w1.d += sl;
				} else if (a == 2) {
					w2.d += sl;
				} else {
					w3.d += sl;
				}
				goto kj;
			}
			cout << "钱不够\n\n";
			break;
		case 4:
			cout << "扩军数量:";
			cin >> sl;
			if (tb - sl * 2 >= 0) {
				tb -= sl * 2;
				if (a == 1) {
					w1.b += sl;
				} else if (a == 2) {
					w2.b += sl;
				} else {
					w3.b += sl;
				}
				goto kj;
			}
			cout << "钱不够\n\n";
			break;
		case 0:

			break;
		default:
			goto kj;
			break;
	}
}
void shuchuditu() {
	for (int i = 0; i < 42; i++) { //1河流 2桥梁 3高山 4未定城 5地图边界 6我城 7我都 8敌城 9敌都
		for (int j = 0; j < 42; j++) {
			switch (tu[i][j]) {
				case 1:
					if ((i == w1.hen && j == w1.zong)   ) {
						Yan(1);
						cout << "①";
						break;
					}
					if ( (i == w2.hen && j == w2.zong)) {
						Yan(1);
						cout << "②";
						break;
					}
					if ((i == w3.hen && j == w3.zong)) {
						Yan(1);
						cout << "③";
						break;
					}
					if ((i == d1.hen && j == d1.zong)   ) {
						Yan(3);
						cout << "①";
						break;
					}
					if ( (i == d2.hen && j == d2.zong)) {
						Yan(3);
						cout << "②";
						break;
					}
					if ((i == d3.hen && j == d3.zong)) {
						Yan(3);
						cout << "③";
						break;
					}
					Yan(13);
					cout << "~ ";
					break;
				case 2:
					if ((i == w1.hen && j == w1.zong)   ) {
						Yan(1);
						cout << "①";
						break;
					}
					if ( (i == w2.hen && j == w2.zong)) {
						Yan(1);
						cout << "②";
						break;
					}
					if ((i == w3.hen && j == w3.zong)) {
						Yan(1);
						cout << "③";
						break;
					}
					if ((i == d1.hen && j == d1.zong)   ) {
						Yan(3);
						cout << "①";
						break;
					}
					if ( (i == d2.hen && j == d2.zong)) {
						Yan(3);
						cout << "②";
						break;
					}
					if ((i == d3.hen && j == d3.zong)) {
						Yan(3);
						cout << "③";
						break;
					}
					Yan(7);
					cout << "〓";
					break;
				case 3:
					if ((i == w1.hen && j == w1.zong)   ) {
						Yan(1);
						cout << "①";
						break;
					}
					if ( (i == w2.hen && j == w2.zong)) {
						Yan(1);
						cout << "②";
						break;
					}
					if ((i == w3.hen && j == w3.zong)) {
						Yan(1);
						cout << "③";
						break;
					}
					if ((i == d1.hen && j == d1.zong)   ) {
						Yan(3);
						cout << "①";
						break;
					}
					if ( (i == d2.hen && j == d2.zong)) {
						Yan(3);
						cout << "②";
						break;
					}
					if ((i == d3.hen && j == d3.zong)) {
						Yan(3);
						cout << "③";
						break;
					}
					Yan(9);
					cout << "■";
					break;
				case 4:
					if ((i == w1.hen && j == w1.zong)   ) {
						Yan(1);
						cout << "①";
						break;
					}
					if ( (i == w2.hen && j == w2.zong)) {
						Yan(1);
						cout << "②";
						break;
					}
					if ((i == w3.hen && j == w3.zong)) {
						Yan(1);
						cout << "③";
						break;
					}
					if ((i == d1.hen && j == d1.zong)   ) {
						Yan(3);
						cout << "①";
						break;
					}
					if ( (i == d2.hen && j == d2.zong)) {
						Yan(3);
						cout << "②";
						break;
					}
					if ((i == d3.hen && j == d3.zong)) {
						Yan(3);
						cout << "③";
						break;
					}
					Yan(0);
					cout << "◎";
					break;
				case 5:
					if ((i == w1.hen && j == w1.zong)   ) {
						Yan(1);
						cout << "①";
						break;
					}
					if ( (i == w2.hen && j == w2.zong)) {
						Yan(1);
						cout << "②";
						break;
					}
					if ((i == w3.hen && j == w3.zong)) {
						Yan(1);
						cout << "③";
						break;
					}
					if ((i == d1.hen && j == d1.zong)   ) {
						Yan(3);
						cout << "①";
						break;
					}
					if ( (i == d2.hen && j == d2.zong)) {
						Yan(3);
						cout << "②";
						break;
					}
					if ((i == d3.hen && j == d3.zong)) {
						Yan(3);
						cout << "③";
						break;
					}
					Yan(8);
					cout << "■";
					break;
				case 6:
					if ((i == w1.hen && j == w1.zong)   ) {
						Yan(1);
						cout << "①";
						break;
					}
					if ( (i == w2.hen && j == w2.zong)) {
						Yan(1);
						cout << "②";
						break;
					}
					if ((i == w3.hen && j == w3.zong)) {
						Yan(1);
						cout << "③";
						break;
					}
					if ((i == d1.hen && j == d1.zong)   ) {
						Yan(3);
						cout << "①";
						break;
					}
					if ( (i == d2.hen && j == d2.zong)) {
						Yan(3);
						cout << "②";
						break;
					}
					if ((i == d3.hen && j == d3.zong)) {
						Yan(3);
						cout << "③";
						break;
					}
					Yan(1);
					cout << "●";
					break;
				case 7:
					if ((i == w1.hen && j == w1.zong)   ) {
						Yan(1);
						cout << "①";
						break;
					}
					if ( (i == w2.hen && j == w2.zong)) {
						Yan(1);
						cout << "②";
						break;
					}
					if ((i == w3.hen && j == w3.zong)) {
						Yan(1);
						cout << "③";
						break;
					}
					if ((i == d1.hen && j == d1.zong)   ) {
						Yan(3);
						cout << "①";
						break;
					}
					if ( (i == d2.hen && j == d2.zong)) {
						Yan(3);
						cout << "②";
						break;
					}
					if ((i == d3.hen && j == d3.zong)) {
						Yan(3);
						cout << "③";
						break;
					}
					Yan(1);
					cout << "★";
					break;
				case 8:
					if ((i == w1.hen && j == w1.zong)   ) {
						Yan(3);
						cout << "①";
						break;
					}
					if ( (i == w2.hen && j == w2.zong)) {
						Yan(3);
						cout << "②";
						break;
					}
					if ((i == w3.hen && j == w3.zong)) {
						Yan(3);
						cout << "③";
						break;
					}
					if ((i == d1.hen && j == d1.zong)   ) {
						Yan(3);
						cout << "①";
						break;
					}
					if ( (i == d2.hen && j == d2.zong)) {
						Yan(3);
						cout << "②";
						break;
					}
					if ((i == d3.hen && j == d3.zong)) {
						Yan(3);
						cout << "③";
						break;
					}
					Yan(3);
					cout << "○";
					break;
				case 9:
					if ((i == w1.hen && j == w1.zong)   ) {
						Yan(3);
						cout << "①";
						break;
					}
					if ( (i == w2.hen && j == w2.zong)) {
						Yan(3);
						cout << "②";
						break;
					}
					if ((i == w3.hen && j == w3.zong)) {
						Yan(3);
						cout << "③";
						break;
					}
					if ((i == d1.hen && j == d1.zong)   ) {
						Yan(3);
						cout << "①";
						break;
					}
					if ( (i == d2.hen && j == d2.zong)) {
						Yan(3);
						cout << "②";
						break;
					}
					if ((i == d3.hen && j == d3.zong)) {
						Yan(3);
						cout << "③";
						break;
					}
					Yan(3);
					cout << "☆";
					break;
				case 0:
					if ((i == w1.hen && j == w1.zong)   ) {
						Yan(1);
						cout << "①";
						break;
					}
					if ( (i == w2.hen && j == w2.zong)) {
						Yan(1);
						cout << "②";
						break;
					}
					if ((i == w3.hen && j == w3.zong)) {
						Yan(1);
						cout << "③";
						break;
					}
					if ((i == d1.hen && j == d1.zong)   ) {
						Yan(3);
						cout << "①";
						break;
					}
					if ( (i == d2.hen && j == d2.zong)) {
						Yan(3);
						cout << "②";
						break;
					}
					if ((i == d3.hen && j == d3.zong)) {
						Yan(3);
						cout << "③";
						break;
					}
					Yan(10);
					cout << "十";
					break;
				default:
					break;
			}

		}
	}
	return;
}
void budui() {
	shuchuditu();
	if (w1.state) {
		cout << "\n\n第一集团军  将军:";
		cout << w1.jiangjun;
		cout << "  位置:" << w1.hen << " " << w1.zong;
		cout << "\n枪兵数量:" << w1.b << "盾兵数量:" << w1.d << "弓兵数量:" << w1.g << "骑兵数量:" << w1.q;
		cout << "\n\n军令:\n    w.向北一格 a.向西一格 s.向南一格 d.向东一格 q.战斗 e.驻扎 r.扩军 f.占领\n";
a:
		char x = _getch();
		switch (x) {
			case 'w':
				if (tu[w1.hen - 1][w1.zong] == 0 || tu[w1.hen - 1][w1.zong] == 2) {
					w1.hen--;
				} else {
					goto a;
				}
				break;
			case 'a':
				if (tu[w1.hen][w1.zong - 1] == 0 || tu[w1.hen][w1.zong - 1] == 2) {
					w1.zong--;
				} else {
					goto a;
				}
				break;
			case 's':
				if (tu[w1.hen + 1][w1.zong] == 0 || tu[w1.hen + 1][w1.zong] == 2) {
					w1.hen++;
				} else {
					goto a;
				}
				break;
			case 'd':
				if (tu[w1.hen][w1.zong + 1] == 0 || tu[w1.hen][w1.zong + 1] == 2) {
					w1.zong++;
				} else {
					goto a;
				}
				break;
			case 'f':
				zhanling(1);
				break;
			case 'r':
				kuojun(1);
				goto a;
				break;
			case 'q':
				if ((w1.hen + 1 == d1.hen && w1.zong - 1 == d1.zong) || (w1.hen + 1 == d2.hen && w1.zong - 1 == d2.zong) || (w1.hen + 1 == d3.hen && w1.zong - 1 == d3.zong)) {
					//zhandou();
				}
				if ((w1.hen + 1 == d1.hen && w1.zong == d1.zong) || (w1.hen + 1 == d2.hen && w1.zong == d2.zong) || (w1.hen + 1 == d3.hen && w1.zong == d3.zong)) {
					//zhandou();
				}
				if ((w1.hen + 1 == d1.hen && w1.zong + 1 == d1.zong) || (w1.hen + 1 == d2.hen && w1.zong + 1 == d2.zong) || (w1.hen + 1 == d3.hen && w1.zong + 1 == d3.zong)) {
					//zhandou();
				}
				if ((w1.hen == d1.hen && w1.zong - 1 == d1.zong) || (w1.hen == d2.hen && w1.zong - 1 == d2.zong) || (w1.hen == d3.hen && w1.zong - 1 == d3.zong)) {
					//zhandou();
				}
				if ((w1.hen == d1.hen && w1.zong + 1 == d1.zong) || (w1.hen == d2.hen && w1.zong + 1 == d2.zong) || (w1.hen == d3.hen && w1.zong + 1 == d3.zong)) {
					//zhandou();
				}
				if ((w1.hen - 1 == d1.hen && w1.zong - 1 == d1.zong) || (w1.hen - 1 == d2.hen && w1.zong - 1 == d2.zong) || (w1.hen - 1 == d3.hen && w1.zong - 1 == d3.zong)) {
					//zhandou();
				}
				if ((w1.hen - 1 == d1.hen && w1.zong == d1.zong) || (w1.hen - 1 == d2.hen && w1.zong == d2.zong) || (w1.hen - 1 == d3.hen && w1.zong == d3.zong)) {
					//zhandou();
				}
				if ((w1.hen - 1 == d1.hen && w1.zong + 1 == d1.zong) || (w1.hen - 1 == d2.hen && w1.zong + 1 == d2.zong) || (w1.hen - 1 == d3.hen && w1.zong + 1 == d3.zong)) {
					//zhandou();
				}
				goto a;
				break;
			case 'e':
				break;
			default:
				goto a;
				break;
		}
	}
	system("cls");
	shuchuditu();
	if (w2.state) {
		cout << "\n\n第二集团军  将军:";
		cout << w2.jiangjun;
		cout << "  位置:" << w2.hen << " " << w2.zong;
		cout << "\n枪兵数量:" << w2.b << "盾兵数量:" << w2.d << "弓兵数量:" << w2.g << "骑兵数量:" << w2.q;
		cout << "\n\n军令:\n    w.向北一格 a.向西一格 s.向南一格 d.向东一格 q.战斗 e.驻扎 r.扩军 f.占领\n";
b:
		char x = _getch();
		switch (x) {
			case 'w'://2 4 6 7 0
				if (tu[w2.hen - 1][w2.zong] == 0 || tu[w2.hen - 1][w2.zong] == 2) {
					w2.hen--;
				} else {
					goto b;
				}
				break;
			case 'a':
				if (tu[w2.hen][w2.zong - 1] == 0 || tu[w2.hen][w2.zong - 1] == 2) {
					w2.zong--;
				} else {
					goto b;
				}
				break;
			case 's':
				if (tu[w2.hen + 1][w2.zong] == 0 || tu[w2.hen + 1][w2.zong] == 2) {
					w2.hen++;
				} else {
					goto b;
				}
				break;
			case 'd':
				if (tu[w2.hen][w2.zong--] == 0 || tu[w2.hen][w2.zong--] == 2) {
					w2.zong++;
				} else {
					goto b;
				}
				break;
			case 'f':
				zhanling(2);
				break;
			case 'r':
				kuojun(2);
				goto b;
				break;
			case 'q':
				if ((w2.hen + 1 == d1.hen && w2.zong - 1 == d1.zong) || (w2.hen + 1 == d2.hen && w2.zong - 1 == d2.zong) || (w2.hen + 1 == d3.hen && w2.zong - 1 == d3.zong)) {
					//zhandou();
				}
				if ((w2.hen + 1 == d1.hen && w2.zong == d1.zong) || (w2.hen + 1 == d2.hen && w2.zong == d2.zong) || (w2.hen + 1 == d3.hen && w2.zong == d3.zong)) {
					//zhandou();
				}
				if ((w2.hen + 1 == d1.hen && w2.zong + 1 == d1.zong) || (w2.hen + 1 == d2.hen && w2.zong + 1 == d2.zong) || (w2.hen + 1 == d3.hen && w2.zong + 1 == d3.zong)) {
					//zhandou();
				}
				if ((w2.hen == d1.hen && w2.zong - 1 == d1.zong) || (w2.hen == d2.hen && w2.zong - 1 == d2.zong) || (w2.hen == d3.hen && w2.zong - 1 == d3.zong)) {
					//zhandou();
				}
				if ((w2.hen == d1.hen && w2.zong + 1 == d1.zong) || (w2.hen == d2.hen && w2.zong + 1 == d2.zong) || (w2.hen == d3.hen && w2.zong + 1 == d3.zong)) {
					//zhandou();
				}
				if ((w2.hen - 1 == d1.hen && w2.zong - 1 == d1.zong) || (w2.hen - 1 == d2.hen && w2.zong - 1 == d2.zong) || (w2.hen - 1 == d3.hen && w2.zong - 1 == d3.zong)) {
					//zhandou();
				}
				if ((w2.hen - 1 == d1.hen && w2.zong == d1.zong) || (w2.hen - 1 == d2.hen && w2.zong == d2.zong) || (w2.hen - 1 == d3.hen && w2.zong == d3.zong)) {
					//zhandou();
				}
				if ((w2.hen - 1 == d1.hen && w2.zong + 1 == d1.zong) || (w2.hen - 1 == d2.hen && w2.zong + 1 == d2.zong) || (w2.hen - 1 == d3.hen && w2.zong + 1 == d3.zong)) {
					//zhandou();
				}
				goto b;
				break;
			case 'e':
				break;
			default:
				goto b;
				break;
		}
	}
	system("cls");
	shuchuditu();
	if (w3.state) {
		cout << "\n\n第三集团军  将军:";
		cout << w3.jiangjun;
		cout << "  位置:" << w3.hen << " " << w3.zong;
		cout << "\n枪兵数量:" << w3.b << "盾兵数量:" << w3.d << "弓兵数量:" << w3.g << "骑兵数量:" << w3.q;
		cout << "\n\n军令:\n    w.向北一格 a.向西一格 s.向南一格 d.向东一格 q.战斗 e.驻扎 r.扩军 f.占领\n";
c:
		char x = _getch();
		switch (x) {
			case 'w'://2 4 6 7 0
				if (tu[w2.hen - 1][w2.zong] == 0 || tu[w3.hen - 1][w2.zong] == 2) {
					w3.hen--;
				} else {
					goto c;
				}
				break;
			case 'a':
				if (tu[w2.hen ][w2.zong - 1] == 0 || tu[w3.hen][w2.zong - 1] == 2) {
					w3.zong--;
				} else {
					goto c;
				}
				break;
			case 's':
				if (tu[w2.hen + 1][w2.zong] == 0 || tu[w3.hen + 1][w2.zong] == 2) {
					w3.hen++;
				} else {
					goto c;
				}
				break;
			case 'd':
				if (tu[w2.hen][w2.zong + 1] == 0 || tu[w3.hen][w2.zong + 1] == 2) {
					w3.zong++;
				} else {
					goto c;
				}
				break;

			case 'f':
				zhanling(3);
				break;
			case 'r':
				kuojun(3);
				goto c;
				break;
			case 'q':
				if ((w3.hen + 1 == d1.hen && w3.zong - 1 == d1.zong) || (w3.hen + 1 == d2.hen && w3.zong - 1 == d2.zong) || (w3.hen + 1 == d3.hen && w3.zong - 1 == d3.zong)) {
					//zhandou();
				}
				if ((w3.hen + 1 == d1.hen && w3.zong == d1.zong) || (w3.hen + 1 == d2.hen && w3.zong == d2.zong) || (w3.hen + 1 == d3.hen && w3.zong == d3.zong)) {
					//zhandou();
				}
				if ((w3.hen + 1 == d1.hen && w3.zong + 1 == d1.zong) || (w3.hen + 1 == d2.hen && w3.zong + 1 == d2.zong) || (w3.hen + 1 == d3.hen && w3.zong + 1 == d3.zong)) {
					//zhandou();
				}
				if ((w3.hen == d1.hen && w3.zong - 1 == d1.zong) || (w3.hen == d2.hen && w3.zong - 1 == d2.zong) || (w3.hen == d3.hen && w3.zong - 1 == d3.zong)) {
					//zhandou();
				}
				if ((w3.hen == d1.hen && w3.zong + 1 == d1.zong) || (w3.hen == d2.hen && w3.zong + 1 == d2.zong) || (w3.hen == d3.hen && w3.zong + 1 == d3.zong)) {
					//zhandou();
				}
				if ((w3.hen - 1 == d1.hen && w3.zong - 1 == d1.zong) || (w3.hen - 1 == d2.hen && w3.zong - 1 == d2.zong) || (w3.hen - 1 == d3.hen && w3.zong - 1 == d3.zong)) {
					//zhandou();
				}
				if ((w3.hen - 1 == d1.hen && w3.zong == d1.zong) || (w3.hen - 1 == d2.hen && w3.zong == d2.zong) || (w3.hen - 1 == d3.hen && w3.zong == d3.zong)) {
					//zhandou();
				}
				if ((w3.hen - 1 == d1.hen && w3.zong + 1 == d1.zong) || (w3.hen - 1 == d2.hen && w3.zong + 1 == d2.zong) || (w3.hen - 1 == d3.hen && w3.zong + 1 == d3.zong)) {
					//zhandou();
				}
				goto c;
				break;
			case 'e':
				break;
			default:
				goto c;
				break;
		}
	}
}
int main() {
	system("mode con cols=84 lines=52");

	Yan(5);
	cout << "       征伐 1w01a 测试版  \n";
	cout << "                            zty出品\n";
	cout << "                                    \n ";
	cout << "                                    \n ";
	cout << "                                    \n ";
	cout << "             输入' y ' 开始游戏     \n";
	system("cls");
	while (1) {
		system("cls");
		budui();
	}

	return 0;
}

后记

作者:zty郑桐羽呀

联系方式:(不挂了,有事私信)

相关推荐
不去幼儿园9 分钟前
【MARL】深入理解多智能体近端策略优化(MAPPO)算法与调参
人工智能·python·算法·机器学习·强化学习
Mr_Xuhhh11 分钟前
重生之我在学环境变量
linux·运维·服务器·前端·chrome·算法
Ajiang28247353041 小时前
对于C++中stack和queue的认识以及priority_queue的模拟实现
开发语言·c++
盼海1 小时前
排序算法(五)--归并排序
数据结构·算法·排序算法
幽兰的天空1 小时前
Python 中的模式匹配:深入了解 match 语句
开发语言·python
Theodore_10224 小时前
4 设计模式原则之接口隔离原则
java·开发语言·设计模式·java-ee·接口隔离原则·javaee
网易独家音乐人Mike Zhou5 小时前
【卡尔曼滤波】数据预测Prediction观测器的理论推导及应用 C语言、Python实现(Kalman Filter)
c语言·python·单片机·物联网·算法·嵌入式·iot
‘’林花谢了春红‘’6 小时前
C++ list (链表)容器
c++·链表·list
----云烟----6 小时前
QT中QString类的各种使用
开发语言·qt
lsx2024066 小时前
SQL SELECT 语句:基础与进阶应用
开发语言