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
| #time "on" | |
| open System | |
| open System.IO | |
| let splitOn c (s: string) = | |
| s.Split [|c|] | |
| let input = | |
| File.ReadAllText(__SOURCE_DIRECTORY__ + "/../data/input15.txt").Replace("\r", "").Replace("\n", "") |
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
| open System | |
| open System.IO | |
| let input = | |
| File.ReadAllLines(__SOURCE_DIRECTORY__ + "/../data/input14.txt") | |
| |> Seq.toArray | |
| |> Array.map Seq.toArray | |
| let swapRowsAndCols (pattern : char array array) = | |
| let swapped = Array.zeroCreate<char array> pattern[0].Length |
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
| #time "on" | |
| open System.IO | |
| let input = | |
| File.ReadAllLines(__SOURCE_DIRECTORY__ + "/../data/input11.txt") | |
| |> Seq.toArray | |
| |> Array.map Seq.toArray | |
| let 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
| #time "on" | |
| open System | |
| open System.IO | |
| let input = | |
| File.ReadAllLines(__SOURCE_DIRECTORY__ + "/../data/input09.txt") | |
| |> Seq.map (fun line -> line.Split " " |> Seq.map Int64.Parse |> Seq.toList) | |
| |> Seq.toList |
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
| #time "on" | |
| open System | |
| open System.IO | |
| open System.Collections.Generic | |
| let input = | |
| File.ReadAllLines(__SOURCE_DIRECTORY__ + "/../data/input08.txt") | |
| let parseLine (str: string) = |
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
| #time "on" | |
| open System | |
| open System.IO | |
| type HandType = | |
| | FiveOfKind of int | |
| | FourOfKind of int * int | |
| | FullHouse of int * int | |
| | ThreeOfKind of int * int * int |
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
| #time "on" | |
| open System | |
| open System.IO | |
| type Mapping = { | |
| Destination: int64 | |
| Source: int64 | |
| Range: int64 | |
| } |
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
| #time "on" | |
| open System | |
| open System.IO | |
| let input = | |
| File.ReadAllLines(__SOURCE_DIRECTORY__ + "/../data/input06.txt") | |
| let rec getWinningMoves time record_distance speed acc = | |
| if speed > time then |
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
| #time "on" | |
| open System | |
| open System.IO | |
| open System.Collections.Generic | |
| let parseCards (str: string) = | |
| str.Trim().Split(' ') |> Seq.filter(not << String.IsNullOrWhiteSpace) |> Seq.map Int32.Parse |> Seq.toArray | |
| let parseLine (str: string) = |
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
| open System | |
| open System.IO | |
| let input = | |
| File.ReadAllLines(__SOURCE_DIRECTORY__ + "/../data/input01.txt") | |
| |> Seq.toList | |
| let findNum1 x = | |
| if x >= '0' && x <= '9' then Some (int (x-'0')) else None |