资源简介
运用了广度优先设计了走迷宫的算法,图形化界面,通过鼠标在迷宫内设置障碍,然后可以显示迷宫的一条最短的路径!
代码片段和文件信息
#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
相关资源
- bootstrap +springMVC+mybtis分页
- vc 通过com操作xls
- 基于winpcap的网络入侵检测系统(源码
- 基于Directx的VC视频捕获源代码.rar
- 利用NI的GPIB-USB-HS控制FLUKE8508A
- HEVC码率控制文献总结与代码分析
- 改变 CListCtrl、CHeaderCtrl 高度、字体、
- spring-mvc4.2.4 中文API文档
- 指纹识别算法
- 多媒体播放器VC,适合初学者
- VC vfm类库 摄像头webcam捕捉图像接口程
- MVC+EasyUI简单使用Demo
- vc中通过解析mid/mif文件访问mapinfo数据
- 基于vc的串口通信,实现两台计算机之
- VC将二维数组显示为图像
- DevComponents.DotNetBar2 破解版
- 网上选课系统(源码+详细说明书)
- Open SSl 1.1
- vc动画图形的制作
- 基于MVC的酒店管理系统
- VCS2016.6 ubuntu安装与破解方法
- spring-mvc-官方中文文档
- VC实现的数字水印图像处理
- synopsys vcs 的安装教程
- MVC登录增删改查界面
- 思科routing and switching CCIE 5.0诊断题v
- TFIDF算法实现
- 指纹提取与识别系统VC源码opencv
- opengl迷宫游戏
- 定时器的配置文件两种方式:springm
评论
共有 条评论