Created
June 22, 2015 09:21
-
-
Save ascjones/7dec2e774009b358d43f to your computer and use it in GitHub Desktop.
Count the blobs in a grid
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
| 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