<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>
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 }
--- /dev/null
+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
+
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
--- /dev/null
+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
<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>