mirror of
https://github.com/Smaug123/AdventOfCode2022
synced 2025-10-05 09:38:40 +00:00
Day 14 (#23)
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
<EmbeddedResource Include="..\AdventOfCode2022.Test\Inputs\Day11.txt" />
|
||||
<EmbeddedResource Include="..\AdventOfCode2022.Test\Inputs\Day12.txt" />
|
||||
<EmbeddedResource Include="..\AdventOfCode2022.Test\Inputs\Day13.txt" />
|
||||
<EmbeddedResource Include="..\AdventOfCode2022.Test\Inputs\Day14.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@@ -2,5 +2,5 @@ namespace AdventOfCode2022.App
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
module Inputs =
|
||||
let days = Array.init 13 (fun day -> Assembly.readResource $"Day%i{day + 1}.txt")
|
||||
let days = Array.init 14 (fun day -> Assembly.readResource $"Day%i{day + 1}.txt")
|
||||
let inline day (i : int) = days.[i - 1]
|
||||
|
@@ -47,7 +47,7 @@ type Benchmark11To15 () =
|
||||
[<GlobalSetup>]
|
||||
member _.Setup () = Run.shouldWrite <- false
|
||||
|
||||
[<Params(11, 12, 13)>]
|
||||
[<Params(11, 12, 13, 14)>]
|
||||
member val Day = 0 with get, set
|
||||
|
||||
[<Params(false, true)>]
|
||||
|
@@ -188,6 +188,22 @@ module Run =
|
||||
if shouldWrite then
|
||||
printfn "%i" output
|
||||
|
||||
|
||||
let day14 (partTwo : bool) (input : string) =
|
||||
let day14 = StringSplitEnumerator.make '\n' input
|
||||
|
||||
if not partTwo then
|
||||
let output = Day14.part1 day14
|
||||
|
||||
if shouldWrite then
|
||||
printfn "%i" output
|
||||
else
|
||||
let output = Day14.part2 day14
|
||||
|
||||
if shouldWrite then
|
||||
printfn "%i" output
|
||||
|
||||
|
||||
let allRuns =
|
||||
[|
|
||||
day1
|
||||
@@ -203,4 +219,5 @@ module Run =
|
||||
day11
|
||||
day12
|
||||
day13
|
||||
day14
|
||||
|]
|
||||
|
Reference in New Issue
Block a user