《颜色消除》游戏

news/2025/1/16 13:44:53/

分享一个有趣的自创C++小游戏

别忘了一连三键哦

#include <bits/stdc++.h>
#include <windows.h>
#include <time.h>
#include <conio.h>
using namespace std;
int jiu1[11], jiu2[11], jiu3[11];
int yi,er,sa;
int die;
//上:1 下:2 左:4 右:6
int a[1111][30][30] = {{{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},{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},{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},{0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,0,0,0,0,0},{0,0,0,0,0,0,1,0,0,0,0,0,0,0,6,0,0,0,0,0},{0,0,0,0,0,0,4,4,4,4,4,6,6,6,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,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,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,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,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,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,0,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0,0,0,0,0},},{{1,0,0,0,0,6,6,6,2,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,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,0,0,0,0,0,0,0,0,0,0,0,6,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,0,0,0,1,1,1,1,1,1,0,0,1,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,4,0,0,6,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,2,4,0,0,6,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,0,0,0},{0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,4,0,0,0,0},{0,0,0,1,0,0,0,0,0,0,2,0,0,0,0,4,0,0,0,0},{0,0,0,0,1,0,0,0,0,0,0,2,0,0,1,4,0,0,0,0},{0,0,0,0,0,1,0,0,0,0,0,0,2,1,0,4,0,0,0,0},{0,0,0,0,0,0,1,0,0,0,0,1,1,4,0,4,0,0,0,0},{0,0,0,0,0,0,0,6,0,0,0,6,0,6,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,1,0,1,0,0,6,0,4,0,0,0,0},{0,0,0,0,0,0,0,0,0,1,0,0,0,6,0,4,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,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},},
};
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
VOID SetPosC(COORD a) { // set cursorHANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(out, a);
}
VOID SetPos(int x, int y) { // set cursor2COORD pos= {x, y};SetPosC(pos);
}
//1蓝 2绿 3淡蓝 4红 5粉 6土黄 7白 8灰 color(前景,背景)
void color(int ForgC, int BackC) {WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
void HideCursor(bool Visible) {CONSOLE_CURSOR_INFO Cursor;Cursor.bVisible = !Visible;Cursor.dwSize = sizeof(Cursor);HANDLE Hand = GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorInfo(Hand, &Cursor);
}
void slowsay(string s) {for (int i = 0; i < s.size(); i++) {cout << s[i];Sleep(30);}
}
int read() {char ch=_getch();while(ch>'9'||ch<'0') ch=_getch();return ch-48;
}
bool ok(int guan) {for (int i = 0; i < 20; i++) {for (int j = 0; j < 20; j++) {if (a[guan][i][j]) return false;}}return true;
}
void go(int guan) {SetPos(0, 0);printf("第%d关\n\n", guan + 1);for (int i = 0; i < 20; i++) {if (i == 0) {color(1, 0);for (int j = 0; j < 40; j++) {printf("-");}printf("\n");}for (int j = 0; j < 20; j++) {if (j == 0) {color(4, 0);printf("|");}color(a[guan][i][j], 0);printf("■");if (j == 19) {color(6, 0);printf("|");}}printf("\n");if (i == 19) {color(2, 0);for (int j = 0; j < 40; j++) {printf("-");}printf("\n");}}
}
void start(int guan) {
abc:SetPos(0, 0);printf("第%d关\n\n", guan + 1);for (int i = 0; i < 20; i++) {if (i == 0) {color(1, 0);for (int j = 0; j < 40; j++) {printf("-");}printf("\n");}for (int j = 0; j < 20; j++) {if (j == 0) {color(4, 0);printf("|");}color(a[guan][i][j], 0);printf("■");if (j == 19) {color(6, 0);printf("|");}}printf("\n");if (i == 19) {color(2, 0);for (int j = 0; j < 40; j++) {printf("-");}printf("\n");}}if (ok(guan)) {MessageBox(NULL, "做答成功!", "作答成功", MB_OK);SetPos(0, 0);return;}int x = _getch();int op = -1;if (KEY_DOWN(VK_UP)) op = 1;if (KEY_DOWN(VK_DOWN)) op = 2;if (KEY_DOWN(VK_LEFT)) op = 3;if (KEY_DOWN(VK_RIGHT)) op = 4;if (x == 27) {MessageBox(NULL, "失败乃成功之母", "作答“成功”", MB_OK);exit(0);} else if (x == 13) {MessageBox(NULL, "再来一遍!", "AGAIN!", MB_OK);for (int i = 0; i < 20; i++) {for (int j = 0; j < 20; j++) {a[guan][i][j] = xcc[guan][i][j];}}goto abc;}if (op == 1) {for (int i = 0; i < 20; i++) {for (int j = 0; j < 20; j++) {if (a[guan][i][j]) {int k = 0;while (a[guan][k][j]) k++;if (k >= i) continue;a[guan][k][j] = a[guan][i][j];a[guan][i][j] = 0;if (a[guan][k][j] == 1 && k == 0) {a[guan][k][j] = 0;}go(guan);}}}} else if (op == 2) {for (int i = 19; i >= 0; i--) {for (int j = 19; j >= 0; j--) {if (a[guan][i][j]) {int k = 19;while (a[guan][k][j]) k--;if (k <= i) continue;a[guan][k][j] = a[guan][i][j];a[guan][i][j] = 0;if (a[guan][k][j] == 2 && k == 19) {a[guan][k][j] = 0;}go(guan);}}}} else if (op == 3) {for (int j = 0; j < 20; j++) {for (int i = 0; i < 20; i++) {if (a[guan][i][j]) {int k = 0;while (a[guan][i][k]) k++;if (k >= j) continue;a[guan][i][k] = a[guan][i][j];a[guan][i][j] = 0;if (a[guan][i][k] == 4 && k == 0) {a[guan][i][k] = 0;}go(guan);}}}} else if (op == 4) {for (int j = 19; j >= 0; j--) {for (int i = 0; i < 20; i++) {if (a[guan][i][j]) {int k = 19;while (a[guan][i][k]) k--;if (k <= j) continue;a[guan][i][k] = a[guan][i][j];a[guan][i][j] = 0;if (a[guan][i][k] == 6 && k == 19) {a[guan][i][k] = 0;}go(guan);}}}}start(guan);
}
signed main() {srand(time(NULL));HideCursor(true);SetPos(50, 6);color(2, 0);slowsay("【版本7.2.16】最新版本————更新中(目前共6关)");SetPos(50, 8);slowsay("作者『逍遥君』");SetPos(50, 10);slowsay("「板块消除」");SetPos(50, 12);slowsay("逍遥君办公室");SetPos(50, 14);slowsay("放弃挑战按[ESC],重来此关按[ENTER]");SetPos(50, 16);slowsay("一直打完所有关卡才算通关");SetPos(0, 25);slowsay("玩法:按上、下、左、右键可以让所有颜色的方块向上、下、左、右移动");SetPos(0, 26);slowsay("上、下、左、右各有一栏颜色条,和它相同的颜色碰到它会消失");SetPos(0, 27);slowsay("你需要让整个盘面里面的颜色全部消失【注意:当颜色本来就在消除线旁边时,再继续移动则不会被消除】\n");SetPos(15, 10);printf("  ■■■■");SetPos(15, 11);printf(" ■      ■");SetPos(15, 12);printf("          ■");SetPos(15, 13);printf("         ■  ");SetPos(15, 14);printf("      ■■   ");SetPos(15, 15);printf("         ■ ");SetPos(15, 16);printf("          ■");SetPos(15, 17);printf(" ■      ■");SetPos(15, 18);printf("  ■■■■");Sleep(1000);SetPos(15, 10);cout << "           \n                              \n                              \n                              \n                              \n                              \n                              \n                              \n                              \n";SetPos(0, 0);SetPos(15, 10);printf("   ■■■■");SetPos(15, 11);printf(" ■       ■");SetPos(15, 12);printf("         ■");SetPos(15, 13);printf("       ■  ");SetPos(15, 14);printf("     ■   ");SetPos(15, 15);printf("   ■ ");SetPos(15, 16);printf(" ■");SetPos(15, 17);printf("■");SetPos(15, 18);printf("■■■■■");Sleep(1000);SetPos(15, 10);cout << "             \n                              \n                              \n                              \n                              \n                              \n                              \n                              \n                              \n";SetPos(15, 10);printf("      ■");SetPos(15, 11);printf("   ■ ■");SetPos(15, 12);printf("      ■");SetPos(15, 13);printf("      ■  ");SetPos(15, 14);printf("      ■   ");SetPos(15, 15);printf("      ■ ");SetPos(15, 16);printf("      ■");SetPos(15, 17);printf("      ■");SetPos(15, 18);printf("■■■■■■■");Sleep(1000);SetPos(15, 10);cout << "             \n                              \n                              \n                              \n                              \n                              \n                              \n                              \n                              \n";SetPos(0, 0);int end = 6;for (int i = 0; i < end; i++) {MessageBox(NULL, "开始游戏", "下一关", MB_OK);start(i);}system("cls");slowsay("Thanks for playing...\n");slowsay("您已通关,亲爱的大脑玩家,您还没玩够吗?");return 0;
}


http://www.ppmy.cn/news/911675.html

相关文章

Docker基础(二)

1、Docker工作原理 Docker是一个Clinet-Server结构的系统&#xff0c;Docker守护进程运行在主机上&#xff0c;然后通过Socket连接从客户端访问&#xff0c;守护进程从客户端接受命令并管理运行在主机上的容器。 容器&#xff0c;是一个运行时环境&#xff0c;就是我们前面说的…

2023年关于前端发展趋势

2023年关于前端发展趋势 跨平台开发&#xff1a;随着React、Vue等框架的成熟&#xff0c;以及WebAssembly、Progressive Web Apps等技术的普及&#xff0c;前端开发将更加跨平台。开发人员可以使用相同的代码库&#xff0c;在多个平台上构建应用程序&#xff0c;包括桌面应用程…

深度学习中的优化算法之Adam

之前在https://blog.csdn.net/fengbingchun/article/details/124909910 介绍过深度学习中的优化算法Adadelta&#xff0c;这里介绍下深度学习的另一种优化算法Adam。论文名字为《ADAM: A METHOD FOR STOCHASTIC OPTIMIZATION》&#xff0c;论文地址&#xff1a;https://arxiv.o…

51单片机GSM 收发短信打电话源码 sim800c 900c

在代码编程之前 大家必须先手续AT指令并且测试是否能正常接收发短信 AT指令可以找卖家要 按照流程发送即可 注意事项&#xff1a;卡的斜口朝外 稳定1A的电流 使用移动卡 程序功能&#xff1a;按下K2发送短信 发短信 接下来放源码 亲测有效&#xff1a; //按下K2发送短信#inc…

Mysql单表多表查询练习

题目要求&#xff1a; 1.查询student表的所有记录 2.查询student表的第2到4条记录 3.从student表查询所有的学生的学号&#xff08;id&#xff09;&#xff0c;姓名&#xff08;name&#xff09;&#xff0c;和院系&#xff08;department&#xff09;的信息 4.从student表…

CentOS(tlinux)安装php55w失败,Requires: libjpeg.so.62(LIBJPEG_6.2)(64bit)解决办法

问题描述&#xff1a; 使用yum install 下载php55w&#xff08;或php55w-gd 、php55w-bcmath等等&#xff09;命令时&#xff0c;报了如下错误&#xff1a; Error: Package: php55w-gd-5.5.34-1.w6.x86_64 (local) Requires: libjpeg.so.62(LIBJPEG_6.2)(64bit) You…

AIP650 I2C通讯

AIP650 I2C通讯 /*** file aip650.c** date 2020-5-19** author aron566** copyright None** brief AIP650 I2C通讯** details None** version V1.1*/ #ifdef __cplusplus ///<use C compiler extern "C" { #endif /** Includes -------------------------…

mysql数据900W+从17s到300ms是怎么做到的?sql优化的魅力(荣耀典藏版)

前言 首先说明一下MySQL的版本&#xff1a; mysql> select version(); ----------- | version() | ----------- | 5.7.17 | ----------- 1 row in set (0.00 sec) 表结构&#xff1a; mysql> desc test; -------------------------------------------------------…