aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2022-04-03 16:48:37 +0800
committerkaiwu <kaiwu2004@gmail.com>2022-04-03 16:48:37 +0800
commit1e7f58a8c34b916b1bb7cc1155cd25db8801e284 (patch)
tree929b324afeec00dd5b928938626eeefc9fa0841c
parentaa64dbe8a6c980da4476ea8549a0508d29b0027d (diff)
downloadadvent-of-code-1e7f58a8c34b916b1bb7cc1155cd25db8801e284.tar.gz
advent-of-code-1e7f58a8c34b916b1bb7cc1155cd25db8801e284.zip
2016 day1
-rw-r--r--src/2016/day1/README.md21
-rw-r--r--src/2016/day1/aoc.cpp3
-rw-r--r--src/2016/day1/aoc.h6
-rw-r--r--src/2016/day1/input1
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/test_2016.cpp9
7 files changed, 43 insertions, 0 deletions
diff --git a/src/2016/day1/README.md b/src/2016/day1/README.md
new file mode 100644
index 0000000..64299f9
--- /dev/null
+++ b/src/2016/day1/README.md
@@ -0,0 +1,21 @@
+--- Day 1: No Time for a Taxicab ---
+
+Santa's sleigh uses a very high-precision clock to guide its movements, and the clock's oscillator is regulated by stars. Unfortunately, the stars have been stolen... by the Easter Bunny. To save Christmas, Santa needs you to retrieve all fifty stars by December 25th.
+
+Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
+
+You're airdropped near Easter Bunny Headquarters in a city somewhere. "Near", unfortunately, is as close as you can get - the instructions on the Easter Bunny Recruiting Document the Elves intercepted start here, and nobody had time to work them out further.
+
+The Document indicates that you should start at the given coordinates (where you just landed) and face North. Then, follow the provided sequence: either turn left (L) or right (R) 90 degrees, then walk forward the given number of blocks, ending at a new intersection.
+
+There's no time to follow such ridiculous instructions on foot, though, so you take a moment and work out the destination. Given that you can only walk on the street grid of the city, how far is the shortest path to the destination?
+
+For example:
+
+ Following R2, L3 leaves you 2 blocks East and 3 blocks North, or 5 blocks away.
+ R2, R2, R2 leaves you 2 blocks due South of your starting position, which is 2 blocks away.
+ R5, L5, R5, R3 leaves you 12 blocks away.
+
+How many blocks away is Easter Bunny HQ?
+
+
diff --git a/src/2016/day1/aoc.cpp b/src/2016/day1/aoc.cpp
new file mode 100644
index 0000000..014f893
--- /dev/null
+++ b/src/2016/day1/aoc.cpp
@@ -0,0 +1,3 @@
+#include "aoc.h"
+
+namespace aoc2016 {}
diff --git a/src/2016/day1/aoc.h b/src/2016/day1/aoc.h
new file mode 100644
index 0000000..95823fe
--- /dev/null
+++ b/src/2016/day1/aoc.h
@@ -0,0 +1,6 @@
+#pragma once
+#include "common.h"
+
+namespace aoc2016 {
+
+}
diff --git a/src/2016/day1/input b/src/2016/day1/input
new file mode 100644
index 0000000..22adf2a
--- /dev/null
+++ b/src/2016/day1/input
@@ -0,0 +1 @@
+R1, L3, R5, R5, R5, L4, R5, R1, R2, L1, L1, R5, R1, L3, L5, L2, R4, L1, R4, R5, L3, R5, L1, R3, L5, R1, L2, R1, L5, L1, R1, R4, R1, L1, L3, R3, R5, L3, R4, L4, R5, L5, L1, L2, R4, R3, R3, L185, R3, R4, L5, L4, R48, R1, R2, L1, R1, L4, L4, R77, R5, L2, R192, R2, R5, L4, L5, L3, R2, L4, R1, L5, R5, R4, R1, R2, L3, R4, R4, L2, L4, L3, R5, R4, L2, L1, L3, R1, R5, R5, R2, L5, L2, L3, L4, R2, R1, L4, L1, R1, R5, R3, R3, R4, L1, L4, R1, L2, R3, L3, L2, L1, L2, L2, L1, L2, R3, R1, L4, R1, L1, L4, R1, L2, L5, R3, L5, L2, L2, L3, R1, L4, R1, R1, R2, L1, L4, L4, R2, R2, R2, R2, R5, R1, L1, L4, L5, R2, R4, L3, L5, R2, R3, L4, L1, R2, R3, R5, L2, L3, R3, R1, R3
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f4f1776..1603ee8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,6 +22,8 @@ set(SOLUTION_FILES
"2015/day20/aoc.cpp"
"2015/day21/aoc.cpp"
"2015/day22/aoc.cpp"
+
+ "2016/day1/aoc.cpp"
)
add_library(solution SHARED ${SOLUTION_FILES})
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index b91258c..d6d67e6 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -2,6 +2,7 @@ set(TEST_FILES
catch_main.cpp
test_common.cpp
test_2015.cpp
+ test_2016.cpp
)
add_executable(aoc ${TEST_FILES})
diff --git a/test/test_2016.cpp b/test/test_2016.cpp
new file mode 100644
index 0000000..260fe96
--- /dev/null
+++ b/test/test_2016.cpp
@@ -0,0 +1,9 @@
+#include "2016/day1/aoc.h"
+#include "catch.hpp"
+#include <stdio.h>
+
+TEST_CASE("No Time for a Taxicab", "[day1]") {
+ // line_view lv = load_file("../src/2016/day1/input");
+}
+
+