progress with fixing path finding

This commit is contained in:
2025-01-21 00:19:38 +00:00
parent 8498fab1dc
commit f948d060ea
2 changed files with 5 additions and 5 deletions

View File

@@ -28,7 +28,7 @@ struct
(isBetween (prevX, curX, prevFinishX) (isBetween (prevX, curX, prevFinishX)
orelse orelse
isBetween (prevX, curFinishX, prevFinishX) isBetween (prevX, curFinishX, prevFinishX)
andalso prevY + Constants.jumpLimit >= curY) andalso prevY + 155 >= curY)
end end
fun canDropDownTo (prevPlat: platform, currentPlat: platform) = fun canDropDownTo (prevPlat: platform, currentPlat: platform) =
@@ -242,6 +242,7 @@ struct
fun filterMinDuplicates (q, eKeys) = fun filterMinDuplicates (q, eKeys) =
let let
val {id = min, ...} = DistHeap.findMin q val {id = min, ...} = DistHeap.findMin q
val pos = IntSet.findInsPos (min, eKeys)
in in
if IntSet.contains (min, eKeys) then if IntSet.contains (min, eKeys) then
let val q = DistHeap.deleteMin q let val q = DistHeap.deleteMin q
@@ -261,7 +262,8 @@ struct
val acc = curID :: acc val acc = curID :: acc
val pos = IntSet.findInsPos (curID, eKeys) val pos = IntSet.findInsPos (curID, eKeys)
val {from, ...} = ValSet.sub (eVals, pos) val {from, distance, ...} = ValSet.sub (eVals, pos)
val _ = print ("266 distance = " ^ Int.toString distance ^ "\n")
in in
helpGetPathList (from, eID, eKeys, eVals, acc) helpGetPathList (from, eID, eKeys, eVals, acc)
end end
@@ -289,7 +291,6 @@ struct
(* find reachable values from min in quad tree *) (* find reachable values from min in quad tree *)
let let
val plat = Platform.find (minID, platforms) val plat = Platform.find (minID, platforms)
val q = DistHeap.deleteMin q
(* add explored *) (* add explored *)
val insPos = IntSet.findInsPos (minID, eKeys) val insPos = IntSet.findInsPos (minID, eKeys)
@@ -318,7 +319,7 @@ struct
(* fold over quad tree, updating any distances (* fold over quad tree, updating any distances
* we find the shortest path for *) * we find the shortest path for *)
val (eVals, q) = FindReachable.foldRegion val (eVals, q) = FindReachable.foldRegion
(0, 0, ww, wh, 0, 0, ww, wh, env, state, platformTree) (0, 0, ww, 100, 0, 0, ww, wh, env, state, platformTree)
in in
loop (pID, eID, platforms, platformTree, q, eKeys, eVals) loop (pID, eID, platforms, platformTree, q, eKeys, eVals)
end end

View File

@@ -52,7 +52,6 @@ struct
else else
let let
val {itemID, ...} = Vector.sub (elements, pos) val {itemID, ...} = Vector.sub (elements, pos)
val _ = print ("foldVec itemID: " ^ Int.toString itemID ^ "\n")
val state = Fn.fState (state, env, itemID) val state = Fn.fState (state, env, itemID)
in in
foldVec (iX, iY, iW, iH, pos + 1, elements, state, env) foldVec (iX, iY, iW, iH, pos + 1, elements, state, env)