From 9c03cb50c386189dcbbc438a09c618aa7fd4555c Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Fri, 15 Dec 2017 14:58:34 -0500 Subject: Day 11 https://www.redblobgames.com/grids/hexagons/#coordinates-cube --- 2017/input/day11.txt | 1 + 2017/src/bin/day11.rs | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 2017/input/day11.txt create mode 100644 2017/src/bin/day11.rs (limited to '2017') diff --git a/2017/input/day11.txt b/2017/input/day11.txt new file mode 100644 index 0000000..ce4568b --- /dev/null +++ b/2017/input/day11.txt @@ -0,0 +1 @@ +se,nw,ne,s,sw,sw,sw,sw,nw,sw,nw,nw,ne,nw,nw,n,se,ne,n,n,n,n,n,n,n,n,ne,n,se,ne,n,s,n,ne,ne,ne,ne,n,se,ne,se,se,ne,se,ne,s,sw,ne,se,ne,nw,se,se,se,se,se,se,se,se,se,ne,s,se,se,n,n,se,se,s,se,se,ne,se,s,se,n,nw,sw,s,ne,se,s,s,ne,s,s,sw,s,se,s,se,s,s,ne,s,s,s,nw,s,s,nw,s,ne,s,s,s,sw,s,s,nw,se,s,s,s,sw,sw,s,s,sw,sw,s,sw,s,sw,sw,sw,sw,s,s,s,s,nw,s,sw,ne,s,sw,sw,nw,sw,sw,n,nw,sw,sw,sw,sw,se,sw,sw,se,nw,n,se,sw,sw,sw,s,nw,se,sw,n,se,sw,sw,sw,sw,se,sw,sw,nw,n,sw,sw,sw,nw,sw,n,nw,nw,n,nw,nw,se,nw,sw,sw,sw,s,nw,nw,sw,nw,n,nw,se,sw,nw,nw,se,nw,nw,nw,sw,nw,se,nw,se,nw,nw,nw,s,nw,nw,nw,nw,sw,nw,nw,nw,sw,nw,n,ne,se,s,nw,nw,n,nw,nw,nw,nw,n,nw,nw,nw,nw,nw,nw,n,sw,nw,ne,se,se,nw,n,nw,n,nw,n,n,n,ne,ne,s,nw,nw,n,n,nw,nw,se,se,n,n,n,nw,nw,se,n,nw,n,n,n,nw,nw,nw,s,nw,n,nw,n,n,nw,n,nw,n,n,n,n,n,n,n,n,n,s,nw,s,ne,sw,n,n,nw,n,s,n,se,nw,s,n,n,n,n,n,n,n,n,sw,s,n,n,s,n,n,sw,n,s,n,n,n,n,sw,n,n,n,n,ne,n,n,ne,n,n,ne,ne,n,s,ne,n,n,n,n,n,s,s,ne,n,n,ne,n,sw,n,ne,n,n,ne,n,n,n,s,ne,ne,se,n,ne,n,ne,se,ne,ne,n,ne,ne,ne,se,ne,n,se,n,ne,n,ne,sw,n,ne,nw,ne,ne,n,se,ne,ne,ne,n,n,n,ne,ne,ne,n,n,ne,ne,ne,n,sw,ne,n,s,ne,nw,ne,n,ne,n,n,ne,n,n,se,ne,ne,ne,n,ne,ne,n,ne,ne,ne,ne,nw,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,s,ne,ne,ne,ne,ne,ne,ne,n,ne,ne,nw,ne,ne,ne,ne,ne,ne,ne,s,n,n,ne,ne,se,ne,se,ne,ne,ne,ne,ne,s,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,n,ne,n,ne,ne,nw,ne,ne,ne,ne,ne,ne,ne,ne,se,se,s,se,ne,ne,ne,ne,se,ne,se,ne,se,ne,ne,ne,se,se,ne,nw,sw,sw,se,ne,ne,s,se,se,se,nw,se,n,se,se,se,se,ne,ne,ne,ne,n,ne,ne,ne,ne,nw,se,se,se,ne,se,ne,se,ne,se,ne,se,ne,se,n,s,ne,ne,ne,s,se,ne,se,se,se,nw,ne,nw,se,n,se,se,se,se,ne,ne,se,se,se,se,se,ne,se,ne,se,se,ne,se,nw,n,se,se,se,se,se,se,se,se,n,se,nw,se,se,se,se,se,se,sw,ne,n,se,se,nw,s,s,se,nw,se,se,sw,se,se,se,ne,s,ne,se,ne,se,se,sw,se,se,nw,se,se,se,n,se,nw,n,se,sw,se,se,se,se,ne,se,se,n,se,se,se,se,se,n,se,se,se,se,s,se,se,se,sw,se,ne,se,se,se,sw,se,sw,se,se,s,se,se,s,se,se,ne,se,n,s,se,s,se,s,se,se,se,se,se,s,se,se,s,se,se,se,sw,se,se,n,se,s,ne,se,se,nw,se,se,se,n,se,se,se,se,s,se,n,se,se,se,se,se,se,nw,se,se,se,sw,se,se,se,s,se,s,ne,se,se,se,n,n,se,n,ne,s,se,nw,se,ne,se,sw,s,se,se,s,se,s,sw,se,n,se,se,se,sw,s,se,se,se,se,se,se,s,s,s,sw,ne,se,s,se,se,se,n,s,nw,s,se,n,se,s,se,s,se,s,ne,se,se,s,se,s,n,se,ne,se,se,se,s,s,se,s,se,s,nw,se,n,s,se,s,se,ne,ne,se,s,s,s,s,se,s,s,s,s,s,ne,se,se,nw,se,n,s,se,s,s,n,se,se,nw,se,s,sw,s,s,se,se,s,ne,s,s,s,s,s,s,s,ne,nw,s,s,s,s,s,s,s,s,se,s,s,n,ne,se,nw,ne,s,nw,ne,nw,se,s,s,s,se,sw,s,s,se,se,s,s,se,s,s,s,se,s,s,s,s,sw,s,s,se,s,se,sw,s,s,s,s,s,s,s,s,s,s,s,s,s,s,nw,se,s,s,nw,s,s,s,s,s,s,s,s,s,se,s,s,s,s,sw,s,s,s,s,s,s,n,s,nw,s,s,s,s,s,ne,se,n,s,s,n,s,s,n,sw,s,s,nw,s,sw,sw,s,sw,s,sw,sw,nw,s,nw,s,nw,s,s,ne,s,s,sw,s,sw,s,nw,s,s,s,sw,s,s,s,sw,sw,s,s,sw,s,s,s,s,s,s,nw,s,s,s,s,sw,sw,nw,s,s,s,s,sw,s,s,n,sw,s,ne,s,sw,n,s,se,s,s,s,sw,se,s,s,sw,s,se,s,s,ne,s,s,se,sw,s,s,ne,n,sw,s,se,s,s,nw,sw,sw,sw,s,s,s,ne,se,sw,s,s,s,ne,nw,s,s,s,s,s,sw,sw,s,s,ne,s,se,s,s,s,sw,n,s,sw,sw,sw,sw,nw,s,s,s,sw,nw,s,se,sw,s,n,s,sw,nw,s,s,sw,s,sw,sw,sw,s,sw,s,s,s,n,s,s,sw,sw,sw,se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ne,ne,ne,se,se,se,sw,ne,ne,ne,nw,ne,ne,s,ne,se,se,se,nw,se,ne,ne,n,n,se,se,se,ne,se,sw,se,s,se,sw,ne,se,ne,sw,ne,se,se,se,s,ne,se,n,se,se,se,nw,se,se,se,ne,se,ne,se,se,nw,ne,n,se,ne,ne,se,ne,se,se,ne,se,se,ne,se,nw,ne,se,ne,se,se,nw,s,n,ne,ne,s,nw,ne,se,sw,ne,sw,ne,ne,ne,se,se,sw,ne,ne,se,se,se,n,se,ne,se,se,ne,ne,se,se,se,ne,se,ne,se,se,n,se,n,n,se,ne,ne,se,se,se,ne,n,se,se,se,se,ne,se,se,ne,se,se,se,se,se,ne,se,n,se,se,se,se,se,se,s,ne,se,se,sw,se,se,ne,ne,ne,ne,se,nw,ne,se,ne,ne,se,nw,ne,nw,ne,se,nw,se,se,se,nw,n,se,sw,ne,ne,ne,ne,se,sw,se,s,nw,ne,s,ne,se,se,ne,nw,n,sw,se,ne,ne,ne,se,se,ne,ne,se,se,sw,se,ne,ne,se,s,se,se,se,ne,se,se,s,se,ne,sw,sw,se,ne,se,ne,ne,se,sw,sw,ne,se,ne,se,ne,se,ne,se,sw,n,se,ne,ne,nw,s,n,se,se,s,ne,sw,se,ne,se,ne,ne,ne,ne,ne,n,se,se,ne,se,se,se,ne,se,ne,n,se,n,n,ne,ne,sw,se,ne,se,se,se,se,se,ne,se,ne,ne,ne,se,ne,nw,ne,s,se,sw,se,n,ne,ne,se,se,se,sw,se,se,se,s,se,se,se,se,ne,se,se,ne,se,sw,nw,ne,se,se,se,s,n,se,se,ne,ne,ne,se,ne,se,se,se,sw,ne,se,se,se,n,se,se,se,se,se,se,n,se,se,se,se,se,sw,se,se,se,se,se,se,n,ne,ne,se,ne,se,se,ne,ne,se,se,ne,ne,ne,se,se,se,se,se,ne,sw,ne,se,ne,se,s,se,ne,se,se,se,ne,se,se,se,se,nw,se,se,se,s,n,se,se,se,se,se,ne,sw,sw,ne,sw,se,se,ne,sw,se,se,se,s,ne,ne,se,se,se,ne,se,ne,se,n,se,n,ne,ne,se,se,se,ne,n,se,se,se,se,s,ne,sw,n,se,ne,se,se,ne,s,ne,se,se,se,ne,s,nw,s,ne,n,se,ne,s,s,s,ne,ne,ne,se,ne,ne,s,sw,se,se,se,se,sw,nw,ne,nw,se,se,se,se,s,se,se,s,se,ne,se,n,nw,s,se,se,se,se,ne,se,se,sw,ne,se,se,se,ne,ne,se,se,se,se,ne,n,se,se,se,se,se,ne,se,s,se,se,s,se,sw,se,se,se,ne,ne,se,se,s,se,n,se,se,se,se,se,se,nw,nw,se,ne,se,ne,se,se,se,se,n,se,se,se,ne,se,se,se,n,se,se,nw,se,se,ne,ne,se,se,ne,se,ne,n,s,se,se,se,sw,se,se,se,se,se,se,ne,n,se,se,ne,se,se,se,se,se,se,se,se,se,se,n,se,nw,se,se,se,se,se,se,se,ne,se,se,se,s,n,se,se,se,se,se,s,se,ne,se,se,ne,se,se,nw,n,se,se,n,se,ne,se,se,se,se,s,se,se,se,se,se,se,se,ne,s,s,se,se,sw,se,se,se,se,se,se,se,se,nw,sw,se,se,se,se,ne,se,se,n,se,ne,ne,n,se,nw,ne,se,se,ne,se,se,se,se,se,ne,se,n,ne,se,se,s,se,se,se,se,se,se,se,se,s,sw,se,ne,se,se,se,se,se,se,s,n,s,se,se,sw,se,se,se,se,se,se,se,se,se,se,se,s,se,sw,se,se,se,se,se,n,se,sw,n,se,n,se,se,nw,se,nw,se,sw,se,se,se,se,se,se,se,se,se,se,se,se,se,se,se,se,sw,se,se,se,se,se,se,se,se,se,nw,se,se,sw,ne,n,n,s,nw,nw,s,nw,n,nw,nw,sw,sw,sw,sw,s,sw,se,s,s,s,s,s,s,s,se,s,se,s,se,se,s,se,se,se,se,se,se,se,se,se,ne,se,se,se,ne,se,se,se,ne,se,se,s,sw,ne,ne,se,ne,ne,s,sw,sw,ne,ne,n,ne,ne,ne,n,ne,ne,ne,ne,ne,n,ne,ne,ne,n,s,n,n,ne,s,n,ne,sw,ne,ne,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,n,sw,s,s,s,ne,se,s,sw,s,sw,sw,sw,s,s,n,sw,se,sw,s,s,sw,sw,sw,sw,s,s,sw,s,s,sw,sw,n,s,s,sw,sw,sw,s,nw,s,s,sw,sw,ne,s,s,s,se,sw,se,s,sw,ne,sw,s,s,s,s,s,s,se,s,s,s,s,s,s,s,s,sw,s,sw,s,s,n,s,ne,sw,sw,s,s,sw,s,s,s,s,s,sw,s,s,s,nw,nw,s,sw,s,s,se,sw,s,s,s,s,s,nw,s,s,sw,sw,s,s,s,s,sw,s,sw,s,s,s,n,s,ne,s,s,s,s,sw,s,s,n,sw,n,n,nw,s,sw,s,sw,s,ne,nw,ne,ne,sw,s,s,se,nw,s,s,s,s,sw,se,s,s,sw,nw,s,s,s,nw,sw,se,s,s,s,s,s,s,sw,s,s,nw,s,s,sw,s,s,s,s,s,s,s,s,s,sw,s,s,s,se,s,s,s,sw,s,s,s,sw,s,s,s,n,s,se,s,sw,ne,s,s,sw,s,se,sw,n,s,s,nw,n,n,nw,s,s,s,s,s,se,ne,sw,nw,s,s,s,nw,s,s,ne,s,s,s,s,s,s,n,s,s,ne,nw,n,sw,s,s,s,s,s,s,sw,se,s,nw,s,s,sw,s,s,sw,se,sw,s,s,s,s,s,s,s,s,ne,sw,s,sw,sw,s,s,s,s,s,s,s,s,sw,s,se,s,s,s,s \ No newline at end of file diff --git a/2017/src/bin/day11.rs b/2017/src/bin/day11.rs new file mode 100644 index 0000000..174f950 --- /dev/null +++ b/2017/src/bin/day11.rs @@ -0,0 +1,42 @@ +use std::io::{self, Read}; + +#[derive(Debug, Clone, Copy)] +struct Hex(i32, i32, i32); + +impl Hex { + fn mov(self, dir: &str) -> Self { + let Hex(x, y, z) = self; + match dir { + "n" => Hex(x, y + 1, z - 1), + "ne" => Hex(x + 1, y, z - 1), + "se" => Hex(x + 1, y - 1, z), + "s" => Hex(x, y - 1, z + 1), + "sw" => Hex(x - 1, y, z + 1), + "nw" => Hex(x - 1, y + 1, z), + _ => unimplemented!(), + } + } +} + +fn solve1(input: &str) -> i32 { + let mut hex = Hex(0, 0, 0); + for dir in input.split(',') { + hex = hex.mov(dir); + } + (hex.0.abs() + hex.1.abs() + hex.2.abs()) / 2 +} + +fn main() { + let mut input = String::new(); + io::stdin().read_to_string(&mut input).unwrap(); + + println!("Part 1: {}", solve1(input.trim())); +} + +#[test] +fn part1() { + assert_eq!(3, solve1("ne,ne,ne")); + assert_eq!(0, solve1("ne,ne,sw,sw")); + assert_eq!(2, solve1("ne,ne,s,s")); + assert_eq!(3, solve1("se,sw,se,sw,sw")); +} -- cgit 1.4.1