diff options
Diffstat (limited to 'aoc-2022-dotnet/Day08')
-rw-r--r-- | aoc-2022-dotnet/Day08/Day08.fsproj | 4 | ||||
-rw-r--r-- | aoc-2022-dotnet/Day08/Program.fs | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/aoc-2022-dotnet/Day08/Day08.fsproj b/aoc-2022-dotnet/Day08/Day08.fsproj index e337a41..b9a3919 100644 --- a/aoc-2022-dotnet/Day08/Day08.fsproj +++ b/aoc-2022-dotnet/Day08/Day08.fsproj @@ -15,4 +15,8 @@ <Compile Include="Program.fs" /> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Common\Common.fsproj" /> + </ItemGroup> + </Project> diff --git a/aoc-2022-dotnet/Day08/Program.fs b/aoc-2022-dotnet/Day08/Program.fs index 1a98c6d..23f93c0 100644 --- a/aoc-2022-dotnet/Day08/Program.fs +++ b/aoc-2022-dotnet/Day08/Program.fs @@ -1,11 +1,9 @@ module Day08 open System.IO -open System.Globalization +open Common -let parseMatrix = - array2D - >> Array2D.map CharUnicodeInfo.GetDigitValue +let parseMatrix = array2D >> Array2D.map Util.charToInt let mapEachToSeq mapping m = seq { @@ -35,8 +33,7 @@ let scenicScore (m: 'a [,]) r c = let solution1 = parseMatrix >> mapEachToSeq isVisible - >> Seq.filter id - >> Seq.length + >> Util.countWhere id let solution2 = parseMatrix >> mapEachToSeq scenicScore >> Seq.max |