File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
lib/move_your_cedric/models Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,7 @@ defmodule MoveYourCedric.Models.Player do
1414 position: nil ,
1515 status: :idle ,
1616 target: nil ,
17- path: nil ,
18- completed: true
17+ path: nil
1918 }
2019 { :ok , state }
2120 end
@@ -219,7 +218,8 @@ defmodule MoveYourCedric.Models.Player do
219218 Astar . cost_to_enter ( current . position , neighbor . position ) +
220219 Astar . manhattan_distance ( neighbor . position , state . target )
221220 end )
222- |> Enum . min ( )
221+ # Avoid a weird crash when no route's available... Probably a wrong fix.
222+ |> Enum . min ( fn -> 0 end )
223223
224224 IO . puts ( "Calculated shortest path available" )
225225
@@ -243,7 +243,7 @@ defmodule MoveYourCedric.Models.Player do
243243 }
244244
245245 if not neighbor_in_open_list do
246- node
246+ node
247247 else
248248 nil
249249 end
You can’t perform that action at this time.
0 commit comments