Created
July 29, 2011 10:10
-
-
Save jdoig/1113562 to your computer and use it in GitHub Desktop.
Main program file of first attempt at path finding in F#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Tools | |
open Level | |
open Pathfinding | |
let level1 = {width=5;height=9;map=(loadMap @"C:\Test\lvl1.txt" |> Seq.toList)} | |
let start = level1.GetElement 4 8 | |
let goal = level1.GetElement 4 0 | |
let path = pathFind(level1,goal,start,[{point=start;h=start.Distance goal;g=0.0;parent=None}],[]) | |
let rec readPath (path:PathingNode, list:PathingNode list) = | |
match path.parent.IsNone with | |
| true -> list | |
| false -> readPath (path.parent.Value, path.parent.Value::list) | |
let waypoints = readPath(path, [path]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment