Beginning of day 22
authorUmmon <greg.burri@gmail.com>
Fri, 22 Dec 2017 09:13:35 +0000 (10:13 +0100)
committerUmmon <greg.burri@gmail.com>
Fri, 22 Dec 2017 09:13:35 +0000 (10:13 +0100)
AdventOfCode2017/AdventOfCode2017.fsproj
AdventOfCode2017/Day20.fs
AdventOfCode2017/Day22.fs [new file with mode: 0644]
Tests/Day20 tests.fs
Tests/Day22 tests.fs [new file with mode: 0644]
Tests/Tests.fsproj

index 4cc42dc..257e1c6 100644 (file)
@@ -79,6 +79,7 @@
     <Compile Include="Day18Part2.fs" />
     <Compile Include="Day19.fs" />
     <Compile Include="Day20.fs" />
+    <Compile Include="Day22.fs" />
     <Compile Include="Program.fs" />
     <None Include="App.config" />
     <Content Include="Data\day01.input">
     <Content Include="Data\day20.input">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <None Include="Data\day22.input" />
     <Content Include="packages.config" />
   </ItemGroup>
   <ItemGroup>
index 031fadd..218e095 100644 (file)
@@ -5,7 +5,7 @@ open System
 type Vec =
     { X : float; Y : float; Z : float }
     with
-        member this.ManhattanNorm = abs this.X  + abs this.Y + abs this.Z
+        member this.ManhattanNorm = abs this.X + abs this.Y + abs this.Z
 
 type Particule =
     { Pos : Vec; V : Vec; A : Vec }
diff --git a/AdventOfCode2017/Day22.fs b/AdventOfCode2017/Day22.fs
new file mode 100644 (file)
index 0000000..a651517
--- /dev/null
@@ -0,0 +1,19 @@
+module AdventOfCode2017.Day22
+
+type M = Set<int * int>
+
+let parseInput (lines : string[]) : M =
+    for i = 0 to lines.Length do
+        for
+
+
+let infection (m : M) : int =
+
+    let rec burst (i, j) (di, dj) n m =
+        if n = 0 then
+            ()
+        else
+            burst (i, j) (di, dj) (n - 1) m
+
+    23
+
index 27cc33f..ce41f5f 100644 (file)
@@ -7,26 +7,12 @@ open Swensen.Unquote
 
 open AdventOfCode2017
 
-type ``Day20 tests`` (output : ITestOutputHelper) =
+type ``Day22 tests`` (output : ITestOutputHelper) =
 
     [<Fact>]
     let ``(Part1) From web page`` () =
-        let input =
-            [|
-                "p=< 3,0,0>, v=< 2,0,0>, a=<-1,0,0>"
-                "p=< 4,0,0>, v=< 0,0,0>, a=<-2,0,0>"
-            |] |> Day20.parseInput
-
-        Day20.nearestZero input =! 0
+        ()
 
     [<Fact>]
     let ``(Part2) From web page`` () =
-        let input =
-            [|
-                "p=<-6,0,0>, v=< 3,0,0>, a=< 0,0,0>"
-                "p=<-4,0,0>, v=< 2,0,0>, a=< 0,0,0>"
-                "p=<-2,0,0>, v=< 1,0,0>, a=< 0,0,0>"
-                "p=< 3,0,0>, v=<-1,0,0>, a=< 0,0,0>"
-            |] |> Day20.parseInput
-
-        Day20.nbAlive input =! 1
\ No newline at end of file
+        ()
\ No newline at end of file
diff --git a/Tests/Day22 tests.fs b/Tests/Day22 tests.fs
new file mode 100644 (file)
index 0000000..27cc33f
--- /dev/null
@@ -0,0 +1,32 @@
+namespace AdventOfCode2017.Tests
+
+open System
+open Xunit
+open Xunit.Abstractions
+open Swensen.Unquote
+
+open AdventOfCode2017
+
+type ``Day20 tests`` (output : ITestOutputHelper) =
+
+    [<Fact>]
+    let ``(Part1) From web page`` () =
+        let input =
+            [|
+                "p=< 3,0,0>, v=< 2,0,0>, a=<-1,0,0>"
+                "p=< 4,0,0>, v=< 0,0,0>, a=<-2,0,0>"
+            |] |> Day20.parseInput
+
+        Day20.nearestZero input =! 0
+
+    [<Fact>]
+    let ``(Part2) From web page`` () =
+        let input =
+            [|
+                "p=<-6,0,0>, v=< 3,0,0>, a=< 0,0,0>"
+                "p=<-4,0,0>, v=< 2,0,0>, a=< 0,0,0>"
+                "p=<-2,0,0>, v=< 1,0,0>, a=< 0,0,0>"
+                "p=< 3,0,0>, v=<-1,0,0>, a=< 0,0,0>"
+            |] |> Day20.parseInput
+
+        Day20.nbAlive input =! 1
\ No newline at end of file
index 1987918..228586e 100644 (file)
@@ -75,6 +75,7 @@
     <Compile Include="Day18 tests.fs" />
     <Compile Include="Day19 tests.fs" />
     <Compile Include="Day20 tests.fs" />
+    <Compile Include="Day22 tests.fs" />
     <Content Include="App.config" />
     <Content Include="packages.config" />
   </ItemGroup>