当前位置:首页 » 课程大全 » c连连看课程设计报告

c连连看课程设计报告

发布时间: 2021-02-07 20:03:43

1. JAVA 版 连连看 课程实践训练报告

围观围观

2. 求用C编写一个连连看的小游戏

去下载。上网络上查就行

3. 求c语言的连连看源程序

参考:

http://wapwenku..com/view/45e5361014791711cc7917f8?pn=2&vw=all&ssid=&from=&bd_page_type=1&uid=&pu=rc@1,pic@on,sl@1,pw@1000,sz@224_220,pd@1,fz@2,lp@0,tpl@color,&st=1&wk=rd&maxpage=6&pos=all


以下是部分代码:

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

#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;
char y;
} CELL;

CELL selCell,curCell;/*缓存前一个被选中的位置以及当前所处位置!*/

/*Scan Codes Define*/
enum KEYCODES
{
K_ESC =0x011b,
K_UP =0x4800, /* upward arrow */
K_LEFT =0x4b00,
K_DOWN =0x5000,
K_RIGHT =0x4d00,
K_SPACE =0x3920,
K_P =0x1970,
K_RETURN =0x1c0d, /* Enter */
};/* ---------------------函数列表------------------------------------ */
void InitGame(char *bgiPath);
void PlayGame();
void QuitGame();
void InitProgressBar();
void UpdateProgressBar(int percent);
void DrawCell(int key,int x,int y,int color);
void EraseCell(int x,int y);
void DrawBorderRect(CELL *c,int color);
void DrawGameOver(char* info);
int GetKeyCode();
int FindPath(CELL *c1,CELL *c2);
/*绘制消除方块时候的连接路径!,用指定颜色!*/
void DrawPath(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4,int color);

/* ----------------------函数实现----------------------------------- */

/* ----------------------[ 核心算法 ]---------------------------------
* 先进行水平方向判断,找出两点所在的水平直线活动范围,
* 算出这两条线段在垂直方向的共同区域!!!,
* 遍历该区域判断能否在两线段间架起公垂线,能则两点连接上;
* 接着进行垂直方向判断,类同。无论两点在不在一条直线上,
* 都能使用该算法,因为两点同线只是两点作为矩形对角点的特例而已。
*/

/* 找到两个CELL之间的路径,成功返回true */
int FindPath(CELL *c1,CELL *c2)
{
int i,j,

path,min1,max1,min2,max2,left,right,top,bottom;
/*---------------(0)判断是否点中相同块! ------------*/
if(Board[c1->x][c1->y][1] != Board[c2->x][c2->y][1])
return false;
/*---------------(1)查找水平方向公共区域!-----------*/
min1=max1=c1->x;
min2=max2=c2->x;
while(min1-1>=0 && Board[min1-1][c1->y][0]==0) min1--;
while(min2-1>=0 && Board[min2-1][c2->y][0]==0) min2--;
left=max(min1,min2); /* 左边界 */
while(max1+1<BoardWidth && Board[max1+1][c1->y][0]==0) max1++;
while(max2+1<BoardWidth && Board[max2+1][c2->y][0]==0) max2++;
right=min(max1,max2); /* 右边界 */

/* 检查两条水平线之间是否有公垂线连通!*/
/* 可以在边缘连通 */
if(left==0)
{
/* 左边缘连通 */
DrawPath(c1->x,c1->y, -1,c1->y, -1,c2->y, c2->x,c2->y, LineColor);
delay(6000);
DrawPath(c1->x,c1->y, -1,c1->y, -1,c2->y, c2->x,c2->y, BkGndColor);/*插除线条!*/
return true;
}
if(right==(BoardWidth-1))
{
DrawPath(c1->x,c1->y, BoardWidth,c1->y, BoardWidth,c2->y, c2->x,c2->y, LineColor);
delay(6000);
DrawPath(c1->x,c1->y, BoardWidth,c1->y, BoardWidth,c2->y, c2->x,c2->y, BkGndColor);/*插除线条!*/
return true;
}

for(i=left;i<=right;i++)
{
path=0;/*统计垂直的公垂线长度!*/
for(j=min(c1->y,c2->y)+1;j<max(c1->y,c2->y);j++)
{
path+=Board[i][j][0];
if(path>0) break;
}
if(path==0)
{
DrawPath(c1->x,c1->y, i,c1->y, i,c2->y, c2->x,c2->y, LineColor);
delay(6000);
DrawPath(c1->x,c1->y, i,c1->y, i,c2->y, c2->x,c2->y, BkGndColor);/*插除线条!*/
return true;
}
}

/*---------------(2)查找垂直方向公共区域!-----------*/
min1=max1=c1->y;
min2=max2=c2->y;
while(min1-1>=0 && Board[c1->x][min1-1][0]==0) min1--;
while(min2-1>=0 && Board[c2->x][min2-1][0]==0) min2--;
top=max(min1,min2);
while(max1+1<BoardHeight && Board[c1->x][max1+1][0]==0) max1++;
while(max2+1<BoardHeight && Board[c2->x][max2+1][0]==0) max2++;
bottom=min(max1,max2);

/* 检查两条垂直线之间是否有公垂线连通!*/
/* 可以在边缘连通 */
if(top==0)
{
/* 同在顶端消除 */
DrawPath(c1->x,c1->y, c1->x,-1, c2->x,-1, c2->x,c2->y, LineColor);
delay(6000);
DrawPath(c1->x,c1->y, c1->x,-1, c2->x,-1, c2->x,c2->y, BkGndColor);/*插除线条!*/
return true;
}
if(bottom==(BoardHeight-1))
{
DrawPath(c1->x,c1->y, c1->x,BoardHeight, c2->x,BoardHeight, c2->x,c2->y, LineColor);
delay(6000);
DrawPath(c1->x,c1->y, c1->x,BoardHeight, c2->x,BoardHeight, c2->x,c2->y, BkGndColor);/*插除线条!*/
return true;
}


4. 怎样用c语言编写连连看的小游戏

问题太大了,不知道怎么回答。找点有关游戏编程的书看吧。

5. 如何用c语言实现连连看

你如要通过调用图片来做,那还要繁,PIX图片格式适合使用。
如只要简单的方形,三角形回那还简单些。
己完成了答一些简单的,

http://hi..com/ryw12403/blog/item/f13de6b342780ea0d9335ab4.html

6. 连连看c语言代码怎么写

是连连看游戏?

7. c语言连连看课程设计求代码

你好!
这个课设有新意,矩阵是几乘几的呢

8. c语言课设 "连连看" 有多少不用老师就会的

老师能用就用吧,不然等毕业了,整天说:大学什么都没学到,学的东西都没用。呵呵~~

9. 大一学生用c语言做连连看

ActivityRecord sourceRecord = null;
ActivityRecord resultRecord = null;
if (resultTo != null) {
sourceRecord = isInAnyStackLocked(resultTo);
if (DEBUG_RESULTS) Slog.v(
TAG, "Will send result to " + resultTo + " " + sourceRecord);
if (sourceRecord != null) {
if (requestCode >= 0 && !sourceRecord.finishing) {
resultRecord = sourceRecord;
}
}

10. c语言做的连连看的源代码

刚入门还是先打好基础,所谓,欲速则不达嘛~~

自己先尝试,不会的,或者有问题再来问,不要总是要完整的源码

热点内容
武汉大学学生会辅导员寄语 发布:2021-03-16 21:44:16 浏览:612
七年级学生作文辅导学案 发布:2021-03-16 21:42:09 浏览:1
不屑弟高考成绩 发布:2021-03-16 21:40:59 浏览:754
大学毕业证会有成绩单 发布:2021-03-16 21:40:07 浏览:756
2017信阳学院辅导员招聘名单 发布:2021-03-16 21:40:02 浏览:800
查询重庆2018中考成绩查询 发布:2021-03-16 21:39:58 浏览:21
结业考试成绩怎么查询 发布:2021-03-16 21:28:40 浏览:679
14中医医师资格笔试考试成绩查分 发布:2021-03-16 21:28:39 浏览:655
名著赏析课程标准 发布:2021-03-16 21:27:57 浏览:881
北京大学商业领袖高端培训课程 发布:2021-03-16 21:27:41 浏览:919