fix tests

This commit is contained in:
Folkert 2021-02-16 01:06:24 +01:00
parent 411a265024
commit 0fc66aa61d
3 changed files with 7 additions and 7 deletions

View file

@ -42,7 +42,7 @@ cheapestOpen = \costFunction, model ->
else
Ok smallestSoFar
Set.foldl model.openSet folder (Err KeyNotFound)
Set.walk model.openSet folder (Err KeyNotFound)
|> Result.map (\x -> x.position)
@ -101,11 +101,11 @@ astar = \costFn, moveFn, goal, model ->
neighbours = moveFn current
newNeighbours = Set.diff neighbours modelPopped.evaluated
newNeighbours = Set.difference neighbours modelPopped.evaluated
modelWithNeighbours = { modelPopped & openSet : Set.union modelPopped.openSet newNeighbours }
modelWithCosts = Set.foldl newNeighbours (\nb, md -> updateCost current nb md) modelWithNeighbours
modelWithCosts = Set.walk newNeighbours (\nb, md -> updateCost current nb md) modelWithNeighbours
astar costFn moveFn goal modelWithCosts

View file

@ -42,7 +42,7 @@ cheapestOpen = \costFunction, model ->
else
Ok smallestSoFar
Set.foldl model.openSet folder (Err KeyNotFound)
Set.walk model.openSet folder (Err KeyNotFound)
|> Result.map (\x -> x.position)
@ -101,11 +101,11 @@ astar = \costFn, moveFn, goal, model ->
neighbours = moveFn current
newNeighbours = Set.diff neighbours modelPopped.evaluated
newNeighbours = Set.difference neighbours modelPopped.evaluated
modelWithNeighbours = { modelPopped & openSet : Set.union modelPopped.openSet newNeighbours }
modelWithCosts = Set.foldl newNeighbours (\nb, md -> updateCost current nb md) modelWithNeighbours
modelWithCosts = Set.walk newNeighbours (\nb, md -> updateCost current nb md) modelWithNeighbours
astar costFn moveFn goal modelWithCosts

View file

@ -3257,7 +3257,7 @@ mod solve_expr {
else
Ok { position, cost: 0.0 }
Set.foldl model.openSet folder (Ok { position: boom {}, cost: 0.0 })
Set.walk model.openSet folder (Ok { position: boom {}, cost: 0.0 })
|> Result.map (\x -> x.position)
astar : Model position -> Result position [ KeyNotFound ]*