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

目录

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

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

讲人话就是

图标解释:

[绿色代表空地,可通过,对应数值 0](#绿色代表空地,可通过,对应数值 0)

[蓝色"~ "为水,不可通过,对应数值 1](#蓝色“~ ”为水,不可通过,对应数值 1)

[棕色"="为桥梁,可通过,对应数值 2](#棕色“=”为桥梁,可通过,对应数值 2)

[灰色三角形为高山,不可通过,对应数值 3](#灰色三角形为高山,不可通过,对应数值 3)

[白色双层同心圆为未定义的城池,可通过,对应数值 4](#白色双层同心圆为未定义的城池,可通过,对应数值 4)

[灰色边框为边界,不可通过,对应数值 5](#灰色边框为边界,不可通过,对应数值 5)

[蓝色圆形为己方城池,可通过,对应数值 6](#蓝色圆形为己方城池,可通过,对应数值 6)

[蓝色五角星为己方都城,可通过,对应数值 7](#蓝色五角星为己方都城,可通过,对应数值 7)

[紫色圆形为敌方城池,可通过,对应数值 8](#紫色圆形为敌方城池,可通过,对应数值 8)

[紫色五角星为敌方都城,可通过,对应数值 9](#紫色五角星为敌方都城,可通过,对应数值 9)

CODE:

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

后记


大家好~~~~~~~~~~~~~~,好久不见,zty CSP初赛爆了,又来做游戏了,本次带来的是

先赞后看 养成习惯

War and Expedition SLG DNF 0.0.1 version

讲人话就是

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

SLG = (即时战略类游戏)

DNF =(Did Not Finish)

0.0.1 = (内测版本号)

version = (版本)

本版本只包含地图打印及上色,

图标解释:

绿色代表空地,可通过, 对应数值 0
蓝色"~ "为水,不可通过,对应数值 1
棕色"="为桥梁,可通过,对应数值 2
灰色三角形为高山,不可通过,对应数值 3
白色双层同心圆为未定义的城池,可通过,对应数值 4
灰色边框为边界,不可通过,对应数值 5
蓝色圆形为己方城池,可通过,对应数值 6
蓝色五角星为己方都城,可通过,对应数值 7
紫色圆形为敌方城池,可通过,对应数值 8
紫色五角星为敌方都城,可通过,对应数值 9

CODE:

cpp 复制代码
#include<bits/stdc++.h>
#include<manyheader.h>
//#include<dpcq.h>
using namespace std;

void Yan(int a) {// 1蓝 2绿 3紫 4红 5黄 6深蓝
	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敌城 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, 7, 0, 0, 6, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5},
	{5, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5},
	{5, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5},
	{5, 6, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 3, 0, 0, 0, 1, 1, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 5},
	{5, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 2, 0, 0, 0, 3, 3, 3, 0, 0, 8, 0, 0, 8, 5},
	{5, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 4, 3, 3, 0, 0, 0, 0, 0, 0, 0, 5},
	{5, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 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},
};
int main() {
	system("mode con cols=84 lines=52");
	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:
					Yan(13);
					cout << "~ ";
					break;
				case 2:
					Yan(7);
					cout << "〓";
					break;
				case 3:
					Yan(9);
					cout << "▲";
					break;
				case 4:
					Yan(0);
					cout << "◎";
					break;
				case 5:
					Yan(8);
					cout << "■";
					break;
				case 6:
					Yan(1);
					cout << "●";
					break;
				case 7:
					Yan(1);
					cout << "★";
					break;
				case 8:
					Yan(3);
					cout << "○";
					break;
				case 9:
					Yan(3);
					cout << "☆";
					break;
				case 0:
					Yan(10);
					cout << "十";
					break;
				default:
					break;
			}

		}
	}
	system("pause");
	return 0;
}

适配编译器: Dev C++ 6.7.5

后记

作者:zty郑桐羽呀

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

相关推荐
盼海4 分钟前
排序算法(五)--归并排序
数据结构·算法·排序算法
幽兰的天空5 分钟前
Python 中的模式匹配:深入了解 match 语句
开发语言·python
Theodore_10223 小时前
4 设计模式原则之接口隔离原则
java·开发语言·设计模式·java-ee·接口隔离原则·javaee
网易独家音乐人Mike Zhou3 小时前
【卡尔曼滤波】数据预测Prediction观测器的理论推导及应用 C语言、Python实现(Kalman Filter)
c语言·python·单片机·物联网·算法·嵌入式·iot
‘’林花谢了春红‘’5 小时前
C++ list (链表)容器
c++·链表·list
----云烟----5 小时前
QT中QString类的各种使用
开发语言·qt
lsx2024065 小时前
SQL SELECT 语句:基础与进阶应用
开发语言
开心工作室_kaic5 小时前
ssm161基于web的资源共享平台的共享与开发+jsp(论文+源码)_kaic
java·开发语言·前端
向宇it6 小时前
【unity小技巧】unity 什么是反射?反射的作用?反射的使用场景?反射的缺点?常用的反射操作?反射常见示例
开发语言·游戏·unity·c#·游戏引擎
武子康6 小时前
Java-06 深入浅出 MyBatis - 一对一模型 SqlMapConfig 与 Mapper 详细讲解测试
java·开发语言·数据仓库·sql·mybatis·springboot·springcloud