Skip to content

Commit bd13fd2

Browse files
committed
Update documentation
1 parent d70fd00 commit bd13fd2

2 files changed

Lines changed: 127 additions & 146 deletions

File tree

‎README.md‎

Lines changed: 127 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,139 @@
11
astar-algorithm-cpp
22
===================
33

4-
Implementation of the A* algorithm in C++
4+
Summary
5+
-------
6+
7+
This code is an efficient implementation in C++ of the A* algorithm. It accompanies the A* tutorial on this site: http://www.heyes-jones.com/astar.html
8+
9+
The code has been used in several popular video games including THQ's "Company of Heroes", Activision's "Gun" as well as in the popular game prototyping engine Angel. http://code.google.com/p/angel-engine/
10+
11+
It has also used in many University assignments and projects.
12+
13+
Description
14+
===========
15+
16+
This implementation is intended to be simple to read yet fairly
17+
efficient. To build it you can compile, with any recent C++ compiler,
18+
the following files :
19+
20+
For 8-puzzle solver
21+
22+
8puzzle.cpp
23+
stlastar.h
24+
optionally fsa.h
25+
26+
Command line
27+
28+
8puzzle with no arguments runs with one of the boards in the cpp file, you can
29+
select the one you want changing the conditional compiliation instructions. Or if you
30+
prefer pass in a board on the command line using digits for the tile positions, where
31+
zero is the space. The board runs from left to right, each row at a time:
32+
33+
8puzzle 013824765
34+
35+
For path finder
36+
37+
findpath.cpp
38+
stlastar.h
39+
optionally fsa.h
40+
41+
pathfind has no arguments. You can edit the simple map in pathfind.cpp and the start
42+
and goal co-ordinates to experiement with the pathfinder.
43+
44+
Fixed size allocator notes: As mentioned briefly in the tutorial you can enable and disable the
45+
faster memory allocation. This allocates a fixed size block of memory, so you have to specify this size
46+
with the astar constructor. You need to enlarge it if you hit an out of memory assert during the
47+
search.
48+
49+
Compilation notes:
50+
51+
Microsoft Visual C++ : Confirmed working with version 8.0.50727 with some deprecation warnings
52+
I'm going to leave the deprecation warnings in so that it still works cleanly with GCC.
53+
TODO Make a non-deprecated compliant version using compiler checking
54+
55+
GCC notes : Compiled using version 3.4.4
56+
57+
Please let me know if it doesn't work for you and I will try to help. I cannot help if you are using
58+
an old compiler such as Turbo C++, since I update the code to meet Ansi Standard C++ as required.
59+
60+
At least in as far as the Microsoft and GCC compilers adhere to Ansi and add breaking changes.
61+
62+
History:
63+
64+
Updated 3rd August 2006
65+
-----------------------
66+
67+
Fixed memory leak
68+
Fixed special case handling for finding better path to a closed node
69+
Fixed bug with comparing the start node with a new node by pointer instead of value
70+
Changed code to use Manhattan distance heuristic with pathfind.cpp as it is more correct
71+
72+
73+
Updated 27th September 2005
74+
---------------------------
75+
76+
Thanks to Gyan singh for pointing out the code no longer compiles under GCC.
77+
78+
Well, that was the case. I've removed a Gnu offending conio.h include, and added lots more typename
79+
keywords, which seem to be required now when making an iterator using a template type.
80+
81+
If anyone knows what the breaking change to the compiler was for, let me know.
82+
83+
Updated 6th September 2005
84+
--------------------------
85+
86+
Finally set the path to fsa.h correctly, sorry about that.
87+
8puzzle.cpp now defaults to using a demo puzzle that solves in a short time.
88+
Added typename keyword to comply with latest ISO standards.
89+
90+
Updated November 26th 2001
91+
--------------------------
92+
93+
Fixed a bug. When a node is deleted from the Open list I did sort_heap when make_heap
94+
is needed to keep the heap structure valid. This causes the search to go awry under some
95+
conditions. Thanks to Mike Ryynanen for tracking this down.
96+
97+
justinhj@gmail.com
98+
99+
Copyright (C) 2001-2013 Justin Heyes-Jones
100+
101+
Permission is given by the author to freely redistribute and
102+
include this code in any program as long as this credit is
103+
given where due.
104+
105+
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
106+
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
107+
INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE
108+
IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
109+
OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
110+
PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED
111+
CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL
112+
DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY
113+
NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
114+
WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE
115+
OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
116+
THIS DISCLAIMER.
117+
118+
119+
120+
121+
122+
123+
124+
125+
126+
127+
128+
129+
130+
5131

6-
This code is part of the site Justin Heyes-Jones has been running since 2001, teaching folk about the A algorithm.
7132

8-
See http://www.heyes-jones.com/astar.html to learn more.
9133

10-
The code is designed to be easy to understand, easy to add your own runtime debugging monitoring the open and closed lists for example. Efficiency is considered, and the open list is implemented as a priority queue using STL.
11134

12-
Now on google hosting, the project is now open to the public to help me maintain different versions and fix bugs.
13135

14-
Using a templated class to allow polymorphism without the overhead of vtables. In addition a simplified and fast memory manager is included, speeding up the search.
15136

16-
Two canonical examples of A are provided. The 8-puzzle and a path finder.
17137

18-
You can email Justin at justinhj@gmail.com
19138

20139

‎readme.txt‎

Lines changed: 0 additions & 138 deletions
This file was deleted.

0 commit comments

Comments
 (0)