Created
July 29, 2011 07:08
-
-
Save jdoig/1113357 to your computer and use it in GitHub Desktop.
Tools for the first pass of my pathfinding
This file contains 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
module Tools | |
open System | |
let sqr x = float(x * x) (* Square two ints into a float *) | |
(* Remove element where predicate *) | |
let rec remove l predicate = | |
match l with | |
| [] -> [] | |
| hd::tl -> if predicate(hd) then | |
(remove tl predicate) | |
else | |
hd::(remove tl predicate) | |
let loadMap path = | |
IO.File.ReadAllText(path).Split(';') | |
|> Array.filter(fun s -> s<> String.Empty) | |
|> Array.map(fun s-> Int32.Parse(s.Replace(";",String.Empty))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment