background image

/*
* 连连看游戏 C 语言源代码
*/

#include <stdio.h>
#include <graphics.h>
#include <stdlib.h>
#include <math.h>
#include <dos.h>

#define    true    1
#define false    0

/* ---------------------全局变量------------------------------------ */
int BkGndColor=BLACK;
int BorderColor=LIGHTGRAY;
int LineColor=LIGHTBLUE;/* 

 

消除一对方块时时候的连线颜色 */

/* Pb - ProgressBar */
int PbColor=LIGHTGREEN;
int PbY=4;
int PbHeight=4;
int  PbValue;            /* 进度条百分比,初始值为 100.*/
long StartTime;        /* 

 

开始时间的秒数,只统计分钟,秒 */

long TotalTime;        /* 游戏总共的最大秒数!,*/

/* BoardDatas: a small-size board */
/* Board[x][y][0] - 0:empty, 1:filled */
/* Board[x][y][1] - cell's key; */
unsigned char Board[10][10][2];
int CellSize=30;
int BoardX=20;
int BoardY=60;
int BoardWidth=10;
int BoardHeight=10;
int CellColor=WHITE;
int SelColor=BLUE;    /* selCell's border rect color */
int CurColor=RED;        /* curCell's border rect color */
int EraColor=CYAN;    /* 用于擦除 cell 的颜色!*/
int PairsCount;        /* how much pairs we have put on board */

/* 

 

用于存储逻辑坐标(索引) */

typedef struct _tagCELL
{
    char x;