C++实现2048小游戏(控制台版的)

无聊,在公司写了个2048小游戏的程序,聊以自娱。(事实是我手机坏了,没得玩微笑)。 很简单,直接上代码了。


#include <iostream>
#include <windows.h>
#include <ctime>
using namespace std;

int const ROW = 4;
int const COL = 4;
int game[ROW][COL] = {0};

//上下左右
int const UP = 1;
int const DOWN = 2;
int const LEFT = 3;
int const RIGHT = 4;

//游戏所处的状态
int const GAME_OVER = 1;
int const GAME_WIN = 2;
int const GAME_CONTINUE = 3;

enum GameNum
{
	Game_2 = 2,
	Game_4 = 4,
	Game_8 = 8,
	Game_16 = 16,
	Game_32 = 32,
	Game_64 = 64,
	Game_128 = 128,
	Game_256 = 256,
	Game_512 = 512,
	Game_1024 = 1024,
	Game_2048 = 2048,
};

//打印所得的数组
void Print()
{
	system("cls");
	cout << "*****************  2048 控 制 台 版  ******************" << endl;
	cout << "*****************  By Tanzf (Intern) ******************" << endl << endl;
	for (int i = 0; i < ROW; ++i)
	{
		cout << "---------------------------------"<< endl;
		for (int j = 0; j < COL; ++j)
		{
			if (game
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值