From 37ee031810f6d00caaa5ac57d389e62d3367485b Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sun, 13 Dec 2020 00:04:37 -0600 Subject: [PATCH] Too sleepy for day 13... --- 2020/src/aoc2020.nim | 2 +- 2020/src/day12.nim | 4 +--- 2020/src/day13.nim | 5 +++++ 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 2020/src/day13.nim diff --git a/2020/src/aoc2020.nim b/2020/src/aoc2020.nim index 169c5dc..95f7268 100644 --- a/2020/src/aoc2020.nim +++ b/2020/src/aoc2020.nim @@ -9,4 +9,4 @@ proc solve_for_day(n: int) {.used.} = when isMainModule: # solve_all() - solve_for_day(12) + solve_for_day(13) diff --git a/2020/src/day12.nim b/2020/src/day12.nim index 1b3cda1..610db94 100644 --- a/2020/src/day12.nim +++ b/2020/src/day12.nim @@ -1,4 +1,4 @@ -import streams, sequtils, strutils, tables +import streams, strutils, tables type Dir = enum north, east, south, west @@ -40,7 +40,6 @@ proc part2*(s: Stream): int = var p = (0, 0) var wp = (10, -1) for l in s.lines: - echo (d, p, wp, l) let arg = l[1..^1].parseInt case l[0]: of 'N': wp = wp.move(dirMap[north], arg) @@ -50,7 +49,6 @@ proc part2*(s: Stream): int = of 'L': wp = wp.left(arg div 90) of 'R': wp = wp.right(arg div 90) else: p = p.move(wp, arg) - echo (d, p, wp) p[0].abs + p[1].abs doAssert "F10\nN3\nF7\nR90\nF11".newStringStream.part2 == 286 diff --git a/2020/src/day13.nim b/2020/src/day13.nim new file mode 100644 index 0000000..e9bd03b --- /dev/null +++ b/2020/src/day13.nim @@ -0,0 +1,5 @@ +import streams +proc part1*(s: Stream): int = + 9 +proc part2*(s: Stream): int = + 9