SHARE
TWEET

Untitled

a guest Dec 8th, 2019 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. open System.IO
  2.  
  3. let input =
  4.     File.ReadLines("input\\8.txt")
  5.     |> Seq.head
  6.     |> Seq.map (string >> int)
  7.     |> List.ofSeq
  8.     |> List.chunkBySize 25
  9.     |> List.chunkBySize 6
  10.  
  11. let getPixel input x y =
  12.     input
  13.     |> List.map (fun layer -> layer |> List.item y |> List.item x)
  14.     |> List.find ((<>) 2)
  15.  
  16. let partOne input =
  17.     input
  18.     |> List.minBy (List.collect id >> List.where ((=) 0) >> List.length)
  19.     |> List.collect id
  20.     |> List.countBy id
  21.  
  22. let partTwo input =
  23.     [for y in 0..5 do yield [for x in 0..24 do yield getPixel input x y]]
  24.  
  25. input |> partOne |> printfn "%A"
  26. input |> partTwo |> printfn "%A"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top