-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.fs
30 lines (25 loc) · 1.13 KB
/
Program.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
open System
open System.IO
open Solutions
type solver = seq<string> -> string
type problemSolution = { partOne: solver; partTwo: solver }
let problemRunners = Map [
(1, { partOne = One.onePartOne; partTwo = One.onePartTwo })
(2, { partOne = Two.partOne; partTwo = Two.partTwo })
(3, { partOne = Three.partOne; partTwo = Three.partTwo })
(4, { partOne = Four.partOne; partTwo = Four.partTwo })
(5, { partOne = Five.partOne; partTwo = Five.partTwo })
(6, { partOne = Six.partOne; partTwo = Six.partTwo })
(7, { partOne = Seven.partOne; partTwo = Seven.partTwo })
(8, { partOne = Eight.partOne; partTwo = Eight.partTwo })
(9, { partOne = Nine.partOne; partTwo = Nine.partTwo })
(10, { partOne = Ten.partOne; partTwo = Ten.partTwo })
]
[<EntryPoint>]
let main args =
let day = args[0] |> int
let part = args[1] |> int
match problemRunners.TryFind day with
| Some solvers -> System.IO.File.ReadLines($"Inputs/{day}.txt") |> (if part = 1 then solvers.partOne else solvers.partTwo) |> printf "%s\n"
| None -> printf $"no solver for day {day} part {part} exists\n"
0