91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

隨機迷宮生成用來我自己設計的一種算法,可以生成有一條通路的迷宮。并可自動尋路。 有兩種模式 自動和手動。 自己游戲選手動,查看如何尋路的選自動 自動尋路開始快捷鍵SPACE 沒有C++,與API編程基礎(chǔ)的人不要看。 武漢科技大學的,請不要下載因為這是我的課程大作業(yè),花了3天時間完善的。還要給老師檢查,可別雷同了。

資源截圖

代碼片段和文件信息

#include?“StdAfx.h“
#include?“GoMaze.h“
#include?“Resource.h“

//生成隨數(shù),并且【range_min<=uint?RangedRand(int?range_min?int?range_max)
{
int?u?=?rand();
?u?=?(double)u/?(RAND_MAX?+?1)?*?(range_max?-?range_min)+?range_min;
return?u;
}


//設置地圖
void?CGoMaze::SetMaze(int?nWidthint?nHeightHWND?hwndHINSTANCE?hInst)
{
bitmapstone?=?LoadBitmap(hInstMAKEINTRESOURCE(IDB_STONE));
bitmapin?=?LoadBitmap(hInstMAKEINTRESOURCE(IDB_IN));
bitmapout?=?LoadBitmap(hInstMAKEINTRESOURCE(IDB_OUT));
bitmapman?=?LoadBitmap(hInstMAKEINTRESOURCE(IDB_MAN));
this->hwnd?=?hwnd;
m_wide?=?nWidth;
m_height?=?nHeight;
this->hInst?=?hInst;
CreateMap();//隨機生成地圖
}

CGoMaze::CGoMaze(void)
{
InitList(list);
}

CGoMaze::~CGoMaze(void)
{//銷毀窗口
for(int?i?=0;i for(int?j?=0;j {
if?(maze[i][j]?==?1)
{
DestroyWindow(hwndmaze[i][j]);
}
}
DestroyWindow(hwndmaze[0][0]);
DestroyWindow(hwndmaze[m_height-1][m_wide-1]);
DestroyWindow(hwndman);
DestroyList(list);
}

void?CGoMaze::DrawMaze(void)
{
int?ID?=?2000;
for(int?i?=0;i for(int?j?=0;j {
if?(maze[i][j]?==?1)
{
hwndmaze[i][j]?=?CreateWindow(_T(“static“)NULLSS_BITMAP?|WS_CHILD|WS_VISIBLEj*33i*333333hwnd(HMENU)(ID++)hInstNULL);
SendMessage(hwndmaze[i][j]STM_SETIMAGE(WPARAM)IMAGE_BITMAP(LPARAM)bitmapstone);
}
else
maze[i][j]?=?0;
}
curPos.x=0;curPos.y=0;
endPos.x=m_height-1;endPos.y=m_wide-1;
//小人的圖標
hwndman?=?CreateWindow(_T(“man“)NULLSS_BITMAP?|WS_CHILD|WS_VISIBLE003333hwnd(HMENU)(ID++)hInstNULL);
SendMessage(hwndmanSTM_SETIMAGE(WPARAM)IMAGE_BITMAP(LPARAM)bitmapman);
//出入口圖標
hwndmaze[0][0]?=?CreateWindow(_T(“static“)NULLSS_BITMAP?|WS_CHILD|WS_VISIBLE003333hwnd(HMENU)(ID++)hInstNULL);
SendMessage(hwndmaze[0][0]STM_SETIMAGE(WPARAM)IMAGE_BITMAP(LPARAM)bitmapin);
hwndmaze[m_height-1][m_wide-1]?=?CreateWindow(_T(“static“)NULLSS_BITMAP?|WS_CHILD|WS_VISIBLE(m_wide-1)*33(m_height-1)*333333hwnd(HMENU)(ID++)hInstNULL);
SendMessage(hwndmaze[m_height-1][m_wide-1]STM_SETIMAGE(WPARAM)IMAGE_BITMAP(LPARAM)bitmapout);
}

//inclu為TRUE時包括邊
//獲取每一個點的信息,當inclu為false時計算指定點附近可以打通的墻的個數(shù)
//當inclu為false時計算指定點附近可以打通的墻的個數(shù)包括地圖邊界.
int?CGoMaze::SurroundNum(int?xint?yBOOL?inclu)
{
int?i?=1;
int?num?=?0;
POINT?temp;
int?next_x=x+1next_y=y+1prev_x=x-1prev_y=y-1;
if(!inclu)?ClearList(list);
//下
if?(next_x>=m_height)
{
if(inclu)
num++;
}
else
{
if?(maze[next_x][y]?==?1)
{
temp.x?=?next_x;
temp.y?=?y;
if(!inclu)?ListInsert(listi++temp);
num?++;
}
}
//右
if?(next_y>=m_wide)
{
if(inclu)
num++;
}
else
{
if?(maze[x][next_y]?==?1)
{
temp.x?=?x;
temp.y?=?next_y;
if(!inclu)?ListInsert(listi++temp);
num?++;
}
}
//上
if?(prev_x<0)
{
if(inclu)
num++;
}
else
{
if

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????798??2010-05-30?03:14??Maze\Maze\bitmap1.bmp

?????文件????????798??2010-05-30?03:14??Maze\Maze\bitmap2.bmp

?????文件???????6920??2010-05-31?23:53??Maze\Maze\GoMaze.cpp

?????文件????????875??2010-05-31?23:45??Maze\Maze\GoMaze.h

?????文件???????1078??2010-05-29?12:23??Maze\Maze\icon1.ico

?????文件???????2203??2010-05-29?23:05??Maze\Maze\list.cpp

?????文件????????377??2010-05-29?23:10??Maze\Maze\list.h

?????文件???????3126??2010-05-30?15:37??Maze\Maze\man.bmp

?????文件??????14364??2010-05-30?15:37??Maze\Maze\Maze.aps

?????文件???????8216??2010-05-31?23:49??Maze\Maze\Maze.cpp

?????文件?????????39??2010-05-29?12:02??Maze\Maze\Maze.h

?????文件??????23558??2010-05-29?12:14??Maze\Maze\Maze.ico

?????文件???????5110??2010-05-30?15:37??Maze\Maze\Maze.rc

?????文件???????5370??2010-05-30?18:11??Maze\Maze\Maze.vcproj

?????文件???????1413??2010-05-31?23:58??Maze\Maze\Maze.vcproj.ANDIS-PC.ANDIS.user

?????文件???????1919??2010-05-29?12:02??Maze\Maze\ReadMe.txt

?????文件???????1441??2010-05-30?15:37??Maze\Maze\resource.h

????.......?????23558??2003-07-24?09:52??Maze\Maze\small.ico

?????文件????????209??2010-05-29?12:02??Maze\Maze\stdafx.cpp

?????文件????????429??2010-05-31?22:15??Maze\Maze\stdafx.h

?????文件???????3030??2010-05-29?14:08??Maze\Maze\stone.bmp

?????文件???????1026??2010-05-29?12:02??Maze\Maze\targetver.h

?????文件????????878??2010-05-29?12:02??Maze\Maze.sln

????..A..H.?????29184??2010-05-31?23:58??Maze\Maze.suo

?????文件??????90112??2010-05-31?23:53??Maze\Release\Maze.exe

?????目錄??????????0??2010-05-31?23:59??Maze\Maze

?????目錄??????????0??2010-05-31?23:59??Maze\Release

?????目錄??????????0??2010-05-31?23:59??Maze

?????文件??????90112??2010-05-31?23:53??Maze.exe

-----------?---------??----------?-----??----

............此處省略2個文件信息

評論

共有 條評論