Skip to content

Instantly share code, notes, and snippets.

@jdoig
Created July 29, 2011 07:08
Show Gist options
  • Save jdoig/1113357 to your computer and use it in GitHub Desktop.
Save jdoig/1113357 to your computer and use it in GitHub Desktop.
Tools for the first pass of my pathfinding
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