Skip to content

Instantly share code, notes, and snippets.

@ascjones
Created June 22, 2015 09:21
Show Gist options
  • Save ascjones/7dec2e774009b358d43f to your computer and use it in GitHub Desktop.
Save ascjones/7dec2e774009b358d43f to your computer and use it in GitHub Desktop.
Count the blobs in a grid
module Blob
type Cell =
| Black
| White
type Grid = Cell [,]
Array2D.init 4 4 (fun x y -> x + y) |> Array2D.mapi (fun x y _ -> (x,y))
//let countBlobs grid =
// let gridCoords =
// grid
// |> Array2D.mapi (fun x y c -> (x,y,c))
// |> Array2D
//
// let rec loop count =
// match
// let rec walk count (x,y) =
// match grid.[x,y] with
// | Black ->
// walk (count + 1) (x,y) // todo
// | White ->
// Array2D.mapi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment