A* search algorithm: Difference between revisions

m
m (Automated syntax highlighting fixup (second round - minor fixes))
 
(2 intermediate revisions by 2 users not shown)
Line 103:
f[neighbour] = G[neighbour] + H
 
X.throw RuntimeError(‘A* failed to find a solution’)
 
V (result, cost) = AStarSearch((0, 0), (7, 7), [[(2, 4), (2, 5), (2, 6), (3, 6), (4, 6), (5, 6), (5, 5), (5, 4), (5, 3), (5, 2), (4, 2), (3, 2)]])
Line 1,695:
else foldr Map.delete (g x) ns </syntaxhighlight>
 
Finally, the search algorythmalgorithm, as given in Wikipedia.
 
<syntaxhighlight lang="haskell">get :: (Ord k, Bounded a) => Map k a -> k -> a
Line 4,960:
=={{header|Wren}}==
{{trans|Sidef}}
<syntaxhighlight lang="ecmascriptwren">var Equals = Fn.new { |p1, p2| p1[0] == p2[0] && p1[1] == p2[1] }
 
var Contains = Fn.new { |pairs, p|
1,480

edits