资源简介
内有N个范例,每个都可以使用,算法使用图形表示。上手容易。
代码片段和文件信息
/*
NOTE: This code was written using Microsoft‘s Visual C++ v 6.0.
I don‘t know how well it will work with other compilers.
You also will need the Direct X 7.0 SDK and to install the lib
and include files from the SDK to your C++ lib and include
folders. You can get the DirectX 7.0 SDK (large!) here:
http://download.microsoft.com/download/win98SE/SDK/7.0/W9X/EN-US/dx7sdk-700.1.exe
===========================
A* Pathfinder - Basics Demo
===========================
By Patrick Lester pwlester@policyalmanac.org
This demo mirrors the tutorial found at
http://www.policyalmanac.org/games/aStarTutorial.htm
While this demo is fine for demonstration purposes if you want
to write/develop your own A* code Demo 2 is probably a better
starting point. Among other things it lacks the overhead required
to allow step-by-step pathfinding in this demo.
Instructions
------------
Demo finds the shortest path between the green square and the
red square.
- Start the pathfinding search by pressing the enter button.
- After the path is found reset by clicking the mouse. You can
draw new walls and then press enter to search again.
- Press 1 to do a step-by-step search. Continue pressing 1 for each
new step. Press enter to finish a step-by-step search all at once.
- Draw blue walls by left clicking on the screen.
- Erase blue walls by left clicking on them.
- Move the red target around by right clicking on the screen.
- Move the green start square around by holding the “g“ button
(g for green) down while left clicking on the screen.
Results
-------
- Path is marked by red dots.
- Squares highlighted in green were added to the “open list“ of
squares to be checked but were never fully checked.
- Squares highlighted in blue were fully checked and added to the
“closed list“.
- Grey pointers point to a square‘s parent.
- F G and H costs are printed in each cell. The F cost is
printed in the upper left corner G in lower left corner and
H in lower right corner.
Please email comments to Patrick Lester at pwlester@policyalmanac.org
*/
#define WINDOW_NAME “Program“ //Visible when game is minimized
#include “../common/launchWindows.h“
#include “../common/dxLibrary.h“
#include “aStarLibrary - do not use.h“
//-----------------------------------------------------------------------------
// Global variables and constants
//-----------------------------------------------------------------------------
cImage* mousePointer;
cImage* grid; cImage* greengrid; cImage* bluegrid; cImage* dottedPath;
cImage* greenBlock; cImage* redBlock; cImage* wallBlock;
cImage* parentArrow[9]; cImage* number[10];
int drawing=0 erasing=0 g_showDirections=0;
//Set pathfinderID and starting locations
int pathfinderID = 1;
int startX = 3 startY = 6; //Set seeker location
int targetX = 12 targetY = 6;//Set initial target location. This can
//be changed by right-clicking on the map.
//
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 161792 2006-10-26 12:39 A星算法\教程\A算法.doc
文件 63611 2006-10-28 00:29 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog.htm
文件 1686 2006-10-25 13:58 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\100x30_Logo.gif
文件 4425 2006-10-25 13:58 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\counter.js
文件 694 2006-10-28 00:28 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\deferShowVerifyImage.js
文件 6262 2006-10-28 00:13 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\image001.jpg
文件 4888 2006-10-28 00:13 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\image002.jpg
文件 13120 2006-10-28 00:13 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\image003.jpg
文件 12874 2006-10-28 00:13 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\image004.jpg
文件 13815 2006-10-28 00:13 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\image005.jpg
文件 24870 2006-10-28 00:13 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\image006.jpg
文件 25676 2006-10-28 00:13 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\image007.jpg
文件 8624 2006-10-25 13:57 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\jsfr
文件 3008 2006-10-25 13:58 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\PoweredByAsp.Net.gif
文件 820 2006-10-28 00:29 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\print.css
文件 1702 2006-10-28 00:13 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\showads.js
文件 5963 2006-10-28 00:29 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\st
文件 96 2006-10-28 00:13 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\trans.gif
文件 18 2006-10-28 00:27 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\urltag.aspx
文件 21474 2006-10-28 00:13 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\WebResource(1).axd
文件 20931 2006-10-28 00:13 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\WebResource.axd
文件 429 2006-10-25 13:58 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files\xm
目录 0 2011-01-27 14:39 A星算法\教程\A路径寻找算法入门 - 楚门技术写作&文章收藏 - CSDNBlog_files
文件 13073 2006-10-26 11:47 A星算法\教程\初识A算法 - GameRes_com.files\ti
目录 0 2011-01-27 14:39 A星算法\教程\初识A算法 - GameRes_com.files
文件 8225 2006-10-26 12:42 A星算法\教程\初识A算法 - GameRes_com.htm
文件 1309 2006-10-26 11:49 A星算法\教程\深入A算法 - GameRes_com.files\a8first_2_1.gif
文件 2666 2006-10-26 11:49 A星算法\教程\深入A算法 - GameRes_com.files\a8first_2_2.gif
文件 13073 2006-10-26 11:47 A星算法\教程\深入A算法 - GameRes_com.files\ti
目录 0 2011-01-27 14:39 A星算法\教程\深入A算法 - GameRes_com.files
............此处省略94个文件信息
- 上一篇:matlab rtw
- 下一篇:MFC单文档实现多视图
评论
共有 条评论