You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-9Lines changed: 20 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,25 @@
1
1
# A-Star-Java-Implementation
2
-
A* also called A Star, algorithm java implementation
3
2
4
-
This is a java implementation of the A Star algorithm. I couldn't find any good java implementations of this famous AI algorithm on the web so I decided to make my own.
3
+
A*, also called A Star, is a graph traversal and path search algorithm, which is used in many fields of computer science due to its completeness, optimality, and optimal efficiency.
5
4
6
-
The implementation includes 3 files:
7
-
- AStar.java : Main algorithm class.
8
-
- Node.java : Class for the nodes used by the algorithm.
9
-
- AStarTest.java : Class with a main method and a simple test for the algorithm implementation
5
+
The implementation includes several files:
6
+
- AStar.java: Main algorithm class.
7
+
- Node.java: Class for the nodes used by the algorithm.
8
+
- searchstrategy package: Strategy pattern with several map search algorithms:
9
+
1. Diagonals - when enabled, also considers diagonal moves
10
+
2. Manhattan distance - default mode, only considers vertical and horizontal moves
10
11
11
-
## Search Area
12
+
13
+
## A* specifications
14
+
15
+
- For node n, gScore[n] is the cost of the cheapest path currently known from start to n.
16
+
- For node n, fScore[n] = gScore[n] + heuristic(n), where gScore(n) is the distance from the starting node to n
17
+
and h(n) is a heuristic value of estimation distance from node n to finish node.
18
+
- h(n) is a heuristic value of estimation distance from node n to finish node
19
+
20
+
## Example provided
21
+
22
+
### Search Area
12
23
13
24
0 1 2 3 4 5 6
14
25
0 - - - - - - -
@@ -18,7 +29,7 @@ The implementation includes 3 files:
18
29
4 - - - - - - -
19
30
5 - - - - - - -
20
31
21
-
## Search Path with diagonals
32
+
###Search Path with diagonals
22
33
23
34
0 1 2 3 4 5 6
24
35
0 - - - * - - -
@@ -28,7 +39,7 @@ The implementation includes 3 files:
0 commit comments