mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
fix tests
This commit is contained in:
parent
411a265024
commit
0fc66aa61d
3 changed files with 7 additions and 7 deletions
|
@ -42,7 +42,7 @@ cheapestOpen = \costFunction, model ->
|
||||||
else
|
else
|
||||||
Ok smallestSoFar
|
Ok smallestSoFar
|
||||||
|
|
||||||
Set.foldl model.openSet folder (Err KeyNotFound)
|
Set.walk model.openSet folder (Err KeyNotFound)
|
||||||
|> Result.map (\x -> x.position)
|
|> Result.map (\x -> x.position)
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,11 +101,11 @@ astar = \costFn, moveFn, goal, model ->
|
||||||
|
|
||||||
neighbours = moveFn current
|
neighbours = moveFn current
|
||||||
|
|
||||||
newNeighbours = Set.diff neighbours modelPopped.evaluated
|
newNeighbours = Set.difference neighbours modelPopped.evaluated
|
||||||
|
|
||||||
modelWithNeighbours = { modelPopped & openSet : Set.union modelPopped.openSet newNeighbours }
|
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
|
astar costFn moveFn goal modelWithCosts
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ cheapestOpen = \costFunction, model ->
|
||||||
else
|
else
|
||||||
Ok smallestSoFar
|
Ok smallestSoFar
|
||||||
|
|
||||||
Set.foldl model.openSet folder (Err KeyNotFound)
|
Set.walk model.openSet folder (Err KeyNotFound)
|
||||||
|> Result.map (\x -> x.position)
|
|> Result.map (\x -> x.position)
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,11 +101,11 @@ astar = \costFn, moveFn, goal, model ->
|
||||||
|
|
||||||
neighbours = moveFn current
|
neighbours = moveFn current
|
||||||
|
|
||||||
newNeighbours = Set.diff neighbours modelPopped.evaluated
|
newNeighbours = Set.difference neighbours modelPopped.evaluated
|
||||||
|
|
||||||
modelWithNeighbours = { modelPopped & openSet : Set.union modelPopped.openSet newNeighbours }
|
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
|
astar costFn moveFn goal modelWithCosts
|
||||||
|
|
||||||
|
|
|
@ -3257,7 +3257,7 @@ mod solve_expr {
|
||||||
else
|
else
|
||||||
Ok { position, cost: 0.0 }
|
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)
|
|> Result.map (\x -> x.position)
|
||||||
|
|
||||||
astar : Model position -> Result position [ KeyNotFound ]*
|
astar : Model position -> Result position [ KeyNotFound ]*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue