Day 3
authorGreg Burri <greg.burri@gmail.com>
Sun, 3 Dec 2017 14:28:28 +0000 (15:28 +0100)
committerGreg Burri <greg.burri@gmail.com>
Sun, 3 Dec 2017 14:28:28 +0000 (15:28 +0100)
AdventOfCode2017/AdventOfCode2017.fsproj
AdventOfCode2017/Program.fs

index 4092b9b..31f6027 100644 (file)
@@ -25,7 +25,7 @@
     <PlatformTarget>AnyCPU</PlatformTarget>
     <DocumentationFile>bin\$(Configuration)\$(AssemblyName).XML</DocumentationFile>
     <Prefer32Bit>true</Prefer32Bit>
-    <StartArguments>2</StartArguments>
+    <StartArguments>3</StartArguments>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
@@ -58,6 +58,7 @@
     <Compile Include="AssemblyInfo.fs" />
     <Compile Include="Day1.fs" />
     <Compile Include="Day2.fs" />
+    <Compile Include="Day3.fs" />
     <Compile Include="Program.fs" />
     <None Include="App.config" />
     <Content Include="packages.config" />
index b541671..2c103a7 100644 (file)
@@ -10,11 +10,15 @@ let day2 () =
     let array = File.ReadAllText "Data/day2" |> Day2.parseInput
     sprintf "part1 = %A, part2 = %A" (Day2.checksum1 array) (Day2.checksum2 array)
 
+let day3 () =
+    let input = 325489
+    sprintf "part1 = %A, part2 = %A" (Day3.spiralManhattanDistanceSum input) (Day3.spiralAdjacentSumBiggerThan input)
 
 let doDay (n : int) =
     let result =
         match n with
         | 2 -> day2 ()
+        | 3 -> day3 ()
         | _ -> day1 ()
     printfn "Result of day %i: %s" n result