A* search algorithm: Difference between revisions
m
→{{header|11l}}: X.throw
Thundergnat (talk | contribs) m (Automated syntax highlighting fixup (second round - minor fixes)) |
Alextretyak (talk | contribs) m (→{{header|11l}}: X.throw) |
||
(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
<syntaxhighlight lang="haskell">get :: (Ord k, Bounded a) => Map k a -> k -> a
Line 4,960:
=={{header|Wren}}==
{{trans|Sidef}}
<syntaxhighlight lang="
var Contains = Fn.new { |pairs, p|
|