资源简介
运用了广度优先设计了走迷宫的算法,图形化界面,通过鼠标在迷宫内设置障碍,然后可以显示迷宫的一条最短的路径!

代码片段和文件信息
#include
#include
const int MAX_COW=50MAX_COL=50;
int row=6col=6;
int Num_Point=-1;
HWND hwndEdit1hwndEdit2hwndButton1hwndButton2;
typedef int a[3];
a b[2];
struct newtype
{
int i;
int j;
}path[400];
LRESULT CALLBACK WndProc(HWNDUINTWPARAMLPARAM);
bool check(int iint jint a[MAX_COW][MAX_COL]);
bool Labyrinth(int a[MAX_COW][MAX_COL]);
int WINAPI WinMain(HINSTANCE hInstanceHINSTANCE hPrevInstLPSTR lpszCmdLineint nCmdShow)
{
HWND hwnd ;
MSG Msg ;
WNDCLASS wndclass ;
char lpszClassName[] = “窗口“;
char lpsztitle[]= “走迷宫“;
wndclass.style = 0;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon(hInstance“IDI_ICON“) ;
wndclass.hCursor = LoadCursor( NULLIDC_ARROW);
wndclass.hbrBackground =(HBRUSH) GetStockobject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = lpszClassName;
if( !RegisterClass( &wndclass))
{
MessageBeep(0) ;
return FALSE ;
}
hwnd=CreateWindow(
lpszClassName
lpsztitle
WS_OVERLAPPEDWINDOW
CW_USEDEFAULT
CW_USEDEFAULT
500
550
NULL
NULL
hInstance
NULL) ;
ShowWindow( hwnd SW_SHOW);
UpdateWindow(hwnd);
while( GetMessage(&Msg NULL 0 0))
{
TranslateMessage( &Msg) ;
DispatchMessage( &Msg) ;
}
return Msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwndUINT messageWPARAM wParamLPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
HBRUSH hB;
char str[20];
int T=1;
HFONT hF;
HPEN hP;
POINT origintemp;
static int Mg[MAX_COW][MAX_COL];
static POINT Mouse;
static int Num=0;
const char title[10]=“迷宫游戏“;
const char instruction[50]=“使用说明:鼠标在迷宫里面某个格子内点击一下表示“;
const char instruction2[60]=“设置障碍再点击一下可以取消障碍。“;
const char instruction3[50]=“(注意:行列都不能超过50)“;
int hight=240/rowwidth=240/colijmFlag_BrushFlag;
origin.x=130;
origin.y=130;
switch(message)
{
case WM_CREATE:
hwndEdit1 = CreateWindow(“EDIT“
NULL
WS_CHILD | WS_VISIBLE |ES_NUMBER | ES_LEFT
| ES_MULTILINE | ES_AUTOVSCROLL
180100 20 20
hwnd
NULL
NULL
NULL);
hwndEdit2= CreateWindow(“EDIT“
NULL
WS_CHILD | WS_VISIBLE |ES_NUMBER | ES_LEFT
| ES_MULTILINE | ES_AUTOVSCROLL
250 100 20 20
hwnd
NULL
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
.CA.... 876 2007-12-30 11:17 labyrinth\Debug\ico.res
.CA.... 163889 2008-01-05 14:21 labyrinth\Debug\labyrinth.exe
.CA.... 279356 2008-01-05 14:21 labyrinth\Debug\labyrinth.ilk
.CA.... 27283 2008-01-05 14:21 labyrinth\Debug\labyrinth.obj
.CA.... 3553308 2008-01-05 14:10 labyrinth\Debug\labyrinth.pch
.CA.... 443392 2008-01-05 14:21 labyrinth\Debug\labyrinth.pdb
.CA.... 140288 2008-01-05 14:27 labyrinth\Debug\vc60.idb
.CA.... 77824 2008-01-05 14:21 labyrinth\Debug\vc60.pdb
.CA.... 17628 2007-12-27 20:26 labyrinth\ico.aps
.CA.... 1721 2007-12-27 19:30 labyrinth\ico.rc
.CA.... 766 2007-12-27 19:56 labyrinth\icon1.ico
.CA.... 8229 2008-01-05 14:21 labyrinth\labyrinth.cpp
.CA.... 4075 2007-12-27 19:37 labyrinth\labyrinth.dsp
.CA.... 541 2007-12-24 15:28 labyrinth\labyrinth.dsw
.CA.... 50176 2008-01-05 14:38 labyrinth\labyrinth.ncb
.CA.... 53760 2008-01-05 14:38 labyrinth\labyrinth.opt
.CA.... 252 2008-01-05 14:27 labyrinth\labyrinth.plg
.CA.... 32208 2007-12-27 19:59 labyrinth\mg.aps
.CA.... 1721 2007-12-27 19:59 labyrinth\mg.ico
.CA.... 860 2007-12-27 19:58 labyrinth\mg.res
.CA.... 452 2007-12-27 19:58 labyrinth\resource.h
.CA.... 1721 2007-12-27 19:47 labyrinth\sc
.C.D... 0 2008-01-05 14:21 labyrinth\Debug
.C.D... 0 2008-01-05 14:38 labyrinth
----------- --------- ---------- ----- ----
4860326 24
相关资源
- The Secret Path 3D 3D魔方迷宫[源码][scra
- Windows异步套接字网络编程
- VC 获得文件属性 获取文件的创建时
- 基于MVC模式的会员管理系统
- silicon lab公司的收音IC SI47XX全套开发工
- 读者写者问题(读者优先,写者优先
- MFC程序-碰撞的小球
- vc 柱形图 CBarChart
- 用vc 写的导线测量,针对刚学测绘的
- 用VC 编写的仿QQ聊天室程序源代码
- 栅栏填充算法源码(VC)
- 简单的房屋租赁系统
- .net网站服装销售系统(MVC)
-
ob
jectARX给Auto CAD加工具条 - blowfish的vc2008工程.rar
- 画图程序MFC/VC/VC CRectTracker 串行化
- capon波束形成算法-VC实现
- 读取串口数据并画实时曲线的VC 程序
- VC 游戏编程—附源代码
- IpHlpApi.h&IpHlpApi.lib
- vc 6.0开发的流程图编辑器
- VC 天空盒(skyBox)实现(附源代码)
- c MFC 画多边形
- keil vcom windows 7 64bit 驱动
- vc URL编解码类
- vc编写中国象棋详细源码注释并附有视
- VC 围棋源代码
- 用VC 编写的基于SNMP的路由器拓扑程序
- vc利用MFC底层开发的二维GIS管理软件,
- 兰勃托地图投影VC源码
评论
共有 条评论