progress implementing dijkstra's algorithm for path finding using quad trees

This commit is contained in:
2025-01-19 22:45:51 +00:00
parent e64c3bc00d
commit 1ba42462ba
3 changed files with 100 additions and 0 deletions

View File

@@ -147,3 +147,24 @@ structure IntSet =
fun eq (a, b) = a = b
val g = Int.>
end)
structure ValSet =
MakeBinVec
(struct
type elem = {distance: int, from: char}
(* l, e and q functions are not actually used in the ValSet
* because the IntSet is meant to contain keys while the ValSet
* is meant to contain corresponding values, like in a Map structure.
* However, it's required by the functor,
* and it is actually easy to implement so no issue. *)
fun l ({distance = a, ...}: elem, {distance = b, ...}: elem) =
a < b
fun eq ({distance = a, ...}: elem, {distance = b, ...}: elem) =
a = b
fun g ({distance = a, ...}: elem, {distance = b, ...}: elem) =
a > b
end)