Combine AoC Repos
This commit is contained in:
1
2016/day01/input
Normal file
1
2016/day01/input
Normal file
@@ -0,0 +1 @@
|
||||
R3, L5, R2, L1, L2, R5, L2, R2, L2, L2, L1, R2, L2, R4, R4, R1, L2, L3, R3, L1, R2, L2, L4, R4, R5, L3, R3, L3, L3, R4, R5, L3, R3, L5, L1, L2, R2, L1, R3, R1, L1, R187, L1, R2, R47, L5, L1, L2, R4, R3, L3, R3, R4, R1, R3, L1, L4, L1, R2, L1, R4, R5, L1, R77, L5, L4, R3, L2, R4, R5, R5, L2, L2, R2, R5, L2, R194, R5, L2, R4, L5, L4, L2, R5, L3, L2, L5, R5, R2, L3, R3, R1, L4, R2, L1, R5, L1, R5, L1, L1, R3, L1, R5, R2, R5, R5, L4, L5, L5, L5, R3, L2, L5, L4, R3, R1, R1, R4, L2, L4, R5, R5, R4, L2, L2, R5, R5, L5, L2, R4, R4, L4, R1, L3, R1, L1, L1, L1, L4, R5, R4, L4, L4, R5, R3, L2, L2, R3, R1, R4, L3, R1, L4, R3, L3, L2, R2, R2, R2, L1, L4, R3, R2, R2, L3, R2, L3, L2, R4, L2, R3, L4, R5, R4, R1, R5, R3
|
109
2016/day01/main.go
Normal file
109
2016/day01/main.go
Normal file
@@ -0,0 +1,109 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
north = iota
|
||||
east
|
||||
south
|
||||
west
|
||||
)
|
||||
|
||||
type pos struct {
|
||||
dir int
|
||||
x int
|
||||
y int
|
||||
}
|
||||
|
||||
func (s *pos) TurnLeft() {
|
||||
s.dir++
|
||||
if s.dir > west {
|
||||
s.dir = north
|
||||
}
|
||||
}
|
||||
|
||||
func (s *pos) TurnRight() {
|
||||
s.dir--
|
||||
if s.dir < north {
|
||||
s.dir = west
|
||||
}
|
||||
}
|
||||
|
||||
func (s *pos) CoordsToString() string {
|
||||
return strconv.Itoa(s.x) + "-" + strconv.Itoa(s.y)
|
||||
}
|
||||
|
||||
func (s *pos) DistanceTravelled() int {
|
||||
return int(math.Abs(float64(s.y)) + math.Abs(float64(s.x)))
|
||||
}
|
||||
|
||||
func (s *pos) Walk(dist int) {
|
||||
switch s.dir {
|
||||
case north:
|
||||
s.y += dist
|
||||
case east:
|
||||
s.x += dist
|
||||
case south:
|
||||
s.y -= dist
|
||||
case west:
|
||||
s.x -= dist
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
var input string
|
||||
var readInp string
|
||||
travelLog := make(map[string]int)
|
||||
firstRepeat := false
|
||||
|
||||
currPos := pos{dir: north, x: 0, y: 0}
|
||||
travelLog[currPos.CoordsToString()]++
|
||||
for {
|
||||
_, err := fmt.Scan(&readInp)
|
||||
if err != nil {
|
||||
if err != io.EOF {
|
||||
log.Fatal(err)
|
||||
}
|
||||
break
|
||||
}
|
||||
input += readInp
|
||||
}
|
||||
|
||||
for _, k := range strings.Split(input, ",") {
|
||||
k = strings.Trim(k, " ")
|
||||
if k[0] == 'R' {
|
||||
currPos.TurnRight()
|
||||
} else {
|
||||
currPos.TurnLeft()
|
||||
}
|
||||
tDist := atoi(k[1:])
|
||||
for mvI := 0; mvI < tDist; mvI++ {
|
||||
currPos.Walk(1)
|
||||
if !firstRepeat && travelLog[currPos.CoordsToString()] > 0 {
|
||||
fmt.Println(" First Repeated Position: " + currPos.CoordsToString())
|
||||
fmt.Println(" Distance: ", currPos.DistanceTravelled())
|
||||
firstRepeat = true
|
||||
}
|
||||
travelLog[currPos.CoordsToString()]++
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("End Position: ", currPos.x, ",", currPos.y)
|
||||
fmt.Println(" Distance: ", currPos.DistanceTravelled())
|
||||
}
|
||||
|
||||
func atoi(inp string) int {
|
||||
var err error
|
||||
var i int
|
||||
if i, err = strconv.Atoi(inp); err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
return i
|
||||
}
|
57
2016/day01/problem
Normal file
57
2016/day01/problem
Normal file
@@ -0,0 +1,57 @@
|
||||
Advent of Code
|
||||
|
||||
--- 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?
|
||||
|
||||
Your puzzle answer was ___.
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
Then, you notice the instructions continue on the back of the Recruiting Document. Easter Bunny HQ is actually at the first location you visit twice.
|
||||
|
||||
For example, if your instructions are R8, R4, R4, R8, the first location you visit twice is 4 blocks away, due East.
|
||||
|
||||
How many blocks away is the first location you visit twice?
|
||||
|
||||
Your puzzle answer was ___.
|
||||
|
||||
If you still want to see it, you can get your puzzle input.
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. https://en.wikipedia.org/wiki/Taxicab_geometry
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/day/1/input
|
5
2016/day02/input
Normal file
5
2016/day02/input
Normal file
@@ -0,0 +1,5 @@
|
||||
DULUDRDDDRLUDURUUULRRRURDRDULRUDDUDRULUDDUDRLDULRRLRDRUDUUULUUDLRURDUDDDDRDLLLLULRDLDRDLRLULRUURDDUULUDLRURRDDRDDRDDLDRDLLUURDRUULRRURURRDLRLLLUDULULULULUDRLLRUDUURLDRLRLRDRRDRLLLDURRDULDURDDRLURRDURLRRRLDLLLDRUUURLRDLDLLLLRDURRLDLULRLDDLDLURLRRDDRUDDUULRURRUDLRDLDUURDDDDRLRURUDULUDLRRLLLLLRDRURLLDLDULUUDLUDDDRLLDRRUDLLURRUUDDRRLLRRLDDDURLDRDRLURRRRDRRRDDUDULULDURRUUURRRDULUUUDDRULDRLLRDLDURLURRLLRUUUULRDURLLDDRLLDLRLRULUUDRURUDLLURUDDRDURLRDRRRDURLDDRDRLRLLURULUUULUDDDULDLRDDDRDLLRRLDRDULLUUUDLDDLDDDLLLLLLLDUDURURDURDRUURRRDDRDUDLULDURDUDURDDDRULDURURURRLURLURLUURLULDLLRUULURDDRLRDDLRDLRRR
|
||||
LUURLRUDRRUDLLDLUDDURULURLUUDUUDDRLUULRDUDDUULDUUDRURDDRRDRLULLRDRDLRLLUURRUULRLDRULUDLDUUDDDRDDLRDLULDRLDUULDLRDLLLDLDLRDUULUDURRULLRLDUDRLLLULUUUULUUDUUURRRDULLUURUDRRLDURRUULDRDULDUDRDUUULUUDDRLUDRLDLDRUUURDLDUDRUDUURLLRRLRLLRRLDULDDULUDUUURULDDUDUDRURRDLULRUDDURDLDLLRRRLDRLULLLRUULDUDLUUDURRLLLRLUDURRDDLDRDDDLURDLDRRUDUDLUDULULRUUUDLUURLLRLDDLURULDURDLRRDDDDURLDDLLDDULLLRLDLDULDUUDDRLDUURDDLDLUUDULRRLRLUURURUURLRLURUURLDRUURLLRDDUUUDULUDDDRDRLDRDRRLRLDULLRRUDLURULULRDRURURLULDUDLRURLRDDRULDDLRD
|
||||
LUDRULUULRRDDDDRRDUURUDDRLDDLDRDURRURULRDLDLDUUDRRDUUDUDLLLRRLDUDDRLDDLRRLRDRLUDLULUDDUUDULDUUULUDLDDURLDURUDLDRUUDRLRRLDLDDULDUUDDLDDLLURDRLRUURDDRUDDUDLDRRLRUDRUULRRRLRULULURDLRRURDRLRULDDDRDUULLURUUUURUDDLRRRRRDURLULDLUULUDRRUDUDRRDDRURDURLRLUDDLDLRRULUDLDDRLDDLDDDLLLLRDLLUULDDLULDLDRDDUDLURUDLDLDDRRUUDDDLRLLLDRRDDDUURDUDURUURRDRLLDUDLDUULLDLDLLUULLRRULDLDRURLDULDRUURDURRURDLRDLLLDRRUDRUUDRURLUDDRURLDURRDLUUDLUUDULLLDDDDRRDLLLDLURULDDRDLUUURRDRRUUDDUL
|
||||
DUUULDUDDDURLLULDDLLUDURLLLURULULURUURDRURLRULLLLDRDDULRRDRRLLLRDDDUULLRRURRULLDDURRRLRDDLULDULLDUDLURRDLDDLURDLRLLDRURLLRLLRRRDRRRURURUUDDLLDDLDDDLRLURUUUULRDLUDDDURLLDDRLDRRLLUDUUULRLLDRRRLRUUDLDUULRLUDRULLLLDUDLLUUDDRUURLURUDRDDDLRURUDRLULLULUUDLDURDULRRDRLDURUULRDRRRDRDRRLRLRDDUULLRDLDURDDDULURRLULDDURDURDDUDURDLLUUULUDULRDDLDRDRUDLLUURDLRDURURULURULLDRLLRRULDLULULDLULRURLRRLUDLLLRLUDLURLULDULDRLLLDLDDDDRDRLRRLRDULUUDULDDLDURDLLLDDDDLLUURRDURLDLUDDLULRUUUDDRRLDLLLRDLLDRRRDDLULLURDDRRRRLDLRLLLRL
|
||||
LULLRRDURRLDUUDRRURLURURRRLRDRUULUULURLLURRDRULRDURDDDDUULLLLDUULDLULURDRLDLULULDRLLDLLRLRULURUDRUUDULRULLLUDRULUDRLLUDLDRRDRUUURURLRDURDRLRDDDURLURRDLRUUUDUURULULDLUULRDLRRRDRDRLLLDLRRDRLLDDULDRUDRRLULLRDLDUDDULRDDLULRURULRLLLULDLLLLRDLDRURUDUURURLDRLUULLDUDULUDDDULUDLRUDDUDLULLUULUUURULURRULRDDURDDLURLRRDRDLDULRLRDRRRULRDDDRLLDDDDRRRRDRDLULUURDURULDLRDULDUDLDURUDLUDLUDDDUDURDURDDURLLRUDUURRRUDRRRRULLLLDDDLUULLUULRRRULDLURDLULRULDRLR
|
111
2016/day02/main.go
Normal file
111
2016/day02/main.go
Normal file
@@ -0,0 +1,111 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
input := stdinToStringSlice()
|
||||
var press []rune
|
||||
keypad := initKeypad("diamond")
|
||||
pos := '5'
|
||||
for _, i := range input {
|
||||
for _, j := range i {
|
||||
pos = moveFinger(j, pos, keypad)
|
||||
}
|
||||
press = append(press, pos)
|
||||
}
|
||||
fmt.Println("Code: ", string(press))
|
||||
}
|
||||
|
||||
func moveFinger(dir rune, start rune, keypad map[string]rune) rune {
|
||||
// Find the starting button
|
||||
var startX, startY int
|
||||
for k, v := range keypad {
|
||||
if v == start {
|
||||
// Found it
|
||||
strCoords := strings.Split(k, ";")
|
||||
startY = atoi(strCoords[0])
|
||||
startX = atoi(strCoords[1])
|
||||
}
|
||||
}
|
||||
switch dir {
|
||||
case 'U':
|
||||
newY := startY - 1
|
||||
if keypad[itoa(newY)+";"+itoa(startX)] != 0 {
|
||||
return keypad[itoa(newY)+";"+itoa(startX)]
|
||||
}
|
||||
case 'R':
|
||||
newX := startX + 1
|
||||
if keypad[itoa(startY)+";"+itoa(newX)] != 0 {
|
||||
return keypad[itoa(startY)+";"+itoa(newX)]
|
||||
}
|
||||
case 'D':
|
||||
newY := startY + 1
|
||||
if keypad[itoa(newY)+";"+itoa(startX)] != 0 {
|
||||
return keypad[itoa(newY)+";"+itoa(startX)]
|
||||
}
|
||||
case 'L':
|
||||
newX := startX - 1
|
||||
if keypad[itoa(startY)+";"+itoa(newX)] != 0 {
|
||||
return keypad[itoa(startY)+";"+itoa(newX)]
|
||||
}
|
||||
}
|
||||
return start
|
||||
}
|
||||
|
||||
func initKeypad(tp string) map[string]rune {
|
||||
ret := make(map[string]rune)
|
||||
switch tp {
|
||||
case "diamond":
|
||||
ret["0;2"] = '1'
|
||||
ret["1;1"] = '2'
|
||||
ret["1;2"] = '3'
|
||||
ret["1;3"] = '4'
|
||||
ret["2;0"] = '5'
|
||||
ret["2;1"] = '6'
|
||||
ret["2;2"] = '7'
|
||||
ret["2;3"] = '8'
|
||||
ret["2;4"] = '9'
|
||||
ret["3;1"] = 'A'
|
||||
ret["3;2"] = 'B'
|
||||
ret["3;3"] = 'C'
|
||||
ret["4;2"] = 'D'
|
||||
case "square":
|
||||
currKey := 1
|
||||
for i := 0; i < 3; i++ {
|
||||
for j := 0; j < 3; j++ {
|
||||
ret[itoa(i)+";"+itoa(j)] = rune(currKey)
|
||||
currKey++
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func itoa(i int) string {
|
||||
return strconv.Itoa(i)
|
||||
}
|
||||
|
||||
func atoi(i string) int {
|
||||
var ret int
|
||||
var err error
|
||||
if ret, err = strconv.Atoi(i); err != nil {
|
||||
log.Fatal("Invalid Atoi")
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func stdinToStringSlice() []string {
|
||||
var input []string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input = append(input, scanner.Text())
|
||||
}
|
||||
return input
|
||||
}
|
91
2016/day02/problem
Normal file
91
2016/day02/problem
Normal file
@@ -0,0 +1,91 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 2: Bathroom Security ---
|
||||
|
||||
You arrive at Easter Bunny Headquarters under cover of darkness. However, you left in such a rush that you forgot to
|
||||
use the bathroom! Fancy office buildings like this one usually have keypad locks on their bathrooms, so you search the
|
||||
front desk for the code.
|
||||
|
||||
"In order to improve security," the document you find says, "bathroom codes will no longer be written down. Instead,
|
||||
please memorize and follow the procedure below to access the bathrooms."
|
||||
|
||||
The document goes on to explain that each button to be pressed can be found by starting on the previous button and
|
||||
moving to adjacent buttons on the keypad: U moves up, D moves down, L moves left, and R moves right. Each line of
|
||||
instructions corresponds to one button, starting at the previous button (or, for the first line, the "5" button); press
|
||||
whatever button you're on at the end of each line. If a move doesn't lead to a button, ignore it.
|
||||
|
||||
You can't hold it much longer, so you decide to figure out the code as you walk to the bathroom. You picture a keypad
|
||||
like this:
|
||||
|
||||
1 2 3
|
||||
4 5 6
|
||||
7 8 9
|
||||
|
||||
Suppose your instructions are:
|
||||
|
||||
ULL
|
||||
RRDDD
|
||||
LURDL
|
||||
UUUUD
|
||||
|
||||
• You start at "5" and move up (to "2"), left (to "1"), and left (you can't, and stay on "1"), so the first button is
|
||||
1.
|
||||
• Starting from the previous button ("1"), you move right twice (to "3") and then down three times (stopping at "9"
|
||||
after two moves and ignoring the third), ending up with 9.
|
||||
• Continuing from "9", you move left, up, right, down, and left, ending with 8.
|
||||
• Finally, you move up four times (stopping at "2"), then down once, ending with 5.
|
||||
|
||||
So, in this example, the bathroom code is 1985.
|
||||
|
||||
Your puzzle input is the instructions from the document you found at the front desk. What is the bathroom code?
|
||||
|
||||
Your puzzle answer was ______.
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
You finally arrive at the bathroom (it's a several minute walk from the lobby so visitors can behold the many fancy
|
||||
conference rooms and water coolers on this floor) and go to punch in the code. Much to your bladder's dismay, the
|
||||
keypad is not at all like you imagined it. Instead, you are confronted with the result of hundreds of man-hours of
|
||||
bathroom-keypad-design meetings:
|
||||
|
||||
1
|
||||
2 3 4
|
||||
5 6 7 8 9
|
||||
A B C
|
||||
D
|
||||
|
||||
You still start at "5" and stop when you're at an edge, but given the same instructions as above, the outcome is very
|
||||
different:
|
||||
|
||||
• You start at "5" and don't move at all (up and left are both edges), ending at 5.
|
||||
• Continuing from "5", you move right twice and down three times (through "6", "7", "B", "D", "D"), ending at D.
|
||||
• Then, from "D", you move five more times (through "D", "B", "C", "C", "B"), ending at B.
|
||||
• Finally, after five more moves, you end at 3.
|
||||
|
||||
So, given the actual keypad layout, the code would be 5DB3.
|
||||
|
||||
Using the same instructions in your puzzle input, what is the correct bathroom code?
|
||||
|
||||
Your puzzle answer was _____.
|
||||
|
||||
Both parts of this puzzle are complete! They provide two gold stars: **
|
||||
|
||||
If you still want to see it, you can get your puzzle input.
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/day/2/input
|
1599
2016/day03/input
Normal file
1599
2016/day03/input
Normal file
File diff suppressed because it is too large
Load Diff
88
2016/day03/main.go
Normal file
88
2016/day03/main.go
Normal file
@@ -0,0 +1,88 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
input := stdinToStringSlice()
|
||||
puzzleOne(input)
|
||||
puzzleTwo(input)
|
||||
}
|
||||
|
||||
func puzzleOne(input []string) {
|
||||
fmt.Println("=== Puzzle One ===")
|
||||
var numGood int
|
||||
var sides []int
|
||||
for i := range input {
|
||||
pts := strings.Fields(input[i])
|
||||
sides = []int{atoi(pts[0]), atoi(pts[1]), atoi(pts[2])}
|
||||
if isValidTriangle(sides) {
|
||||
numGood++
|
||||
}
|
||||
}
|
||||
fmt.Println("Found Good: ", numGood)
|
||||
}
|
||||
|
||||
func puzzleTwo(input []string) {
|
||||
fmt.Println("=== Puzzle Two ===")
|
||||
var numGood int
|
||||
var sides1, sides2, sides3 []int
|
||||
for i := range input {
|
||||
pts := strings.Fields(input[i])
|
||||
sides1 = append(sides1, atoi(pts[0]))
|
||||
sides2 = append(sides2, atoi(pts[1]))
|
||||
sides3 = append(sides3, atoi(pts[2]))
|
||||
if len(sides1) == 3 {
|
||||
if isValidTriangle(sides1) {
|
||||
numGood++
|
||||
}
|
||||
if isValidTriangle(sides2) {
|
||||
numGood++
|
||||
}
|
||||
if isValidTriangle(sides3) {
|
||||
numGood++
|
||||
}
|
||||
sides1 = []int{}
|
||||
sides2 = []int{}
|
||||
sides3 = []int{}
|
||||
}
|
||||
}
|
||||
fmt.Println("Found Good: ", numGood)
|
||||
}
|
||||
|
||||
func isValidTriangle(sides []int) bool {
|
||||
sort.Ints(sides)
|
||||
if sides[2] < (sides[1] + sides[0]) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func itoa(i int) string {
|
||||
return strconv.Itoa(i)
|
||||
}
|
||||
|
||||
func atoi(i string) int {
|
||||
var ret int
|
||||
var err error
|
||||
if ret, err = strconv.Atoi(i); err != nil {
|
||||
log.Fatal("Invalid Atoi")
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func stdinToStringSlice() []string {
|
||||
var input []string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input = append(input, scanner.Text())
|
||||
}
|
||||
return input
|
||||
}
|
59
2016/day03/problem
Normal file
59
2016/day03/problem
Normal file
@@ -0,0 +1,59 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 3: Squares With Three Sides ---
|
||||
|
||||
Now that you can think clearly, you move deeper into the labyrinth of hallways and office
|
||||
furniture that makes up this part of Easter Bunny HQ. This must be a graphic design
|
||||
department; the walls are covered in specifications for triangles.
|
||||
|
||||
Or are they?
|
||||
|
||||
The design document gives the side lengths of each triangle it describes, but... 5 10 25? Some
|
||||
of these aren't triangles. You can't help but mark the impossible ones.
|
||||
|
||||
In a valid triangle, the sum of any two sides must be larger than the remaining side. For
|
||||
example, the "triangle" given above is impossible, because 5 + 10 is not larger than 25.
|
||||
|
||||
In your puzzle input, how many of the listed triangles are possible?
|
||||
|
||||
Your puzzle answer was ___.
|
||||
|
||||
The first half of this puzzle is complete! It provides one gold star: *
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
Now that you've helpfully marked up their design documents, it occurs to you that triangles
|
||||
are specified in groups of three vertically. Each set of three numbers in a column specifies a
|
||||
triangle. Rows are unrelated.
|
||||
|
||||
For example, given the following specification, numbers with the same hundreds digit would be
|
||||
part of the same triangle:
|
||||
|
||||
101 301 501
|
||||
102 302 502
|
||||
103 303 503
|
||||
201 401 601
|
||||
202 402 602
|
||||
203 403 603
|
||||
|
||||
In your puzzle input, and instead reading by columns, how many of the listed triangles are
|
||||
possible?
|
||||
|
||||
Although it hasn't changed, you can still get your puzzle input.
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/day/3/input
|
953
2016/day04/input
Normal file
953
2016/day04/input
Normal file
@@ -0,0 +1,953 @@
|
||||
hqcfqwydw-fbqijys-whqii-huiuqhsx-660[qhiwf]
|
||||
oxjmxdfkd-pzxsbkdbo-erkq-ixyloxqlov-913[xodkb]
|
||||
bpvctixr-eaphixr-vgphh-gthtpgrw-947[smrkl]
|
||||
iwcjapey-lhwopey-cnwoo-wymqeoepekj-992[eowpy]
|
||||
mvhkvbdib-agjrzm-zibdizzmdib-317[bizdm]
|
||||
excdklvo-lkcuod-dbksxsxq-146[ztwya]
|
||||
ocipgvke-ejqeqncvg-octmgvkpi-908[prmku]
|
||||
ktwbhtvmbox-vetllbybxw-vtgwr-vhtmbgz-tvjnblbmbhg-579[uvnyc]
|
||||
dpmpsgvm-tdbwfohfs-ivou-tijqqjoh-389[emdac]
|
||||
forwcoqhwjs-pibbm-igsf-hsghwbu-532[bhswf]
|
||||
uzfqdzmfuazmx-nmewqf-ogefayqd-eqdhuoq-664[qfdem]
|
||||
fnjyxwrinm-yujbcrl-pajbb-uxprbcrlb-277[brjcl]
|
||||
aoubshwq-dzoghwq-ufogg-fsoqeiwgwhwcb-714[nkrmy]
|
||||
pbeebfvir-rtt-fnyrf-975[frbet]
|
||||
bnknqetk-qzaahs-trdq-sdrshmf-235[mtcqz]
|
||||
odiih-ljwmh-lxjcrwp-orwjwlrwp-927[wjlrh]
|
||||
sxdobxkdsyxkv-bkllsd-cobfsmoc-302[sbdko]
|
||||
gzefmnxq-omzpk-ymzmsqyqzf-352[saomt]
|
||||
tvsnigxmpi-gerhc-gsexmrk-qerekiqirx-854[eirgx]
|
||||
ktfitzbgz-vtgwr-ftgtzxfxgm-267[tgfzx]
|
||||
lxuxaodu-npp-orwjwlrwp-563[pwlor]
|
||||
oazegyqd-sdmpq-pkq-xmnadmfadk-352[damqk]
|
||||
wfruflnsl-gzssd-hzxytrjw-xjwanhj-177[bgxsp]
|
||||
pbybeshy-qlr-qrfvta-455[tmios]
|
||||
xmrrq-udskkaxawv-vqw-esfsywewfl-918[fdqsb]
|
||||
vhehkyne-vahvhetmx-ltexl-917[uvhmy]
|
||||
molgbzqfib-ciltbo-obzbfsfkd-393[htayl]
|
||||
veqtekmrk-jpsaiv-wlmttmrk-256[ewyhq]
|
||||
cvabijtm-lgm-apqxxqvo-512[dinjm]
|
||||
oaxadrgx-nmewqf-qzsuzqqduzs-456[oevtg]
|
||||
vehmsegxmzi-veffmx-wepiw-880[emfiv]
|
||||
fruurvlyh-fubrjhqlf-fdqgb-frdwlqj-ghvljq-413[cgkzy]
|
||||
otzkxtgzoutgr-inuiurgzk-sgxqkzotm-774[gtzko]
|
||||
hwbba-eqpuwogt-itcfg-tcddkv-ujkrrkpi-154[ktbcd]
|
||||
pynffvsvrq-cynfgvp-tenff-ynobengbel-377[fnevy]
|
||||
aoubshwq-qcbgiasf-ufors-qvcqczohs-hsqvbczcum-558[hypcz]
|
||||
kzeed-xhfajsljw-mzsy-knsfshnsl-281[nsmtd]
|
||||
hwdtljsnh-hfsid-htfynsl-ijufwyrjsy-177[hsfjy]
|
||||
excdklvo-zvkcdsm-qbkcc-psxkxmsxq-900[yznml]
|
||||
diozmivodjivg-xviyt-pnzm-oznodib-239[iodvz]
|
||||
nzcczdtgp-clmmte-lnbftdtetzy-743[tczde]
|
||||
ejpanjwpekjwh-bhksan-iwngapejc-264[mgyfj]
|
||||
ubhatstkwhnl-vhehkyne-xzz-wxiehrfxgm-917[hexkn]
|
||||
vhkkhlbox-vtgwr-vhtmbgz-vnlmhfxk-lxkobvx-163[vhkxb]
|
||||
irdgrxzex-tyftfcrkv-rthlzjzkzfe-373[rzfte]
|
||||
cvabijtm-rmttgjmiv-lmdmtwxumvb-564[mtvbi]
|
||||
hqfxxnknji-gfxpjy-xmnuunsl-151[brtjg]
|
||||
odkasqzuo-dmnnuf-xasuefuoe-690[zyejx]
|
||||
ixeumktoi-pkrrehkgt-sgtgmksktz-384[ktgei]
|
||||
atyzghrk-igtje-iugzotm-uvkxgzouty-358[rmnqz]
|
||||
ktwbhtvmbox-xzz-phkdlahi-865[nmsjb]
|
||||
nzydfxpc-rclop-ojp-lylwjdtd-951[dlpcj]
|
||||
vxupkizork-kmm-sgtgmksktz-280[yublv]
|
||||
cvabijtm-kivlg-kwibqvo-twoqabqka-408[pgush]
|
||||
hqcfqwydw-fbqijys-whqii-mehaixef-218[vzaur]
|
||||
bpvctixr-rpcsn-rdpixcv-ldgzhwde-271[cifnu]
|
||||
fnjyxwrinm-kjbtnc-lxwcjrwvnwc-199[nwcjr]
|
||||
kzeed-idj-xmnuunsl-593[uazmr]
|
||||
dsxxw-zyqicr-bcqgel-236[cqxbd]
|
||||
gpewwmjmih-jpsaiv-wivzmgiw-230[iwmgj]
|
||||
amjmpdsj-afmamjyrc-bcqgel-470[mszht]
|
||||
eqpuwogt-itcfg-tcorcikpi-hnqygt-ujkrrkpi-596[nywzt]
|
||||
pelbtravp-pnaql-erprvivat-533[parve]
|
||||
yhwooebeaz-bhksan-wymqeoepekj-758[eoabh]
|
||||
iruzfrtkzmv-upv-kirzezex-529[zpysg]
|
||||
lxaaxbren-lqxlxujcn-mnenuxyvnwc-953[nxlac]
|
||||
clxalrtyr-prr-nfdezxpc-dpcgtnp-457[prcdl]
|
||||
sorozgxe-mxgjk-kmm-vaxingyotm-228[ugkxd]
|
||||
vdzonmhydc-eknvdq-otqbgzrhmf-469[jnsrl]
|
||||
gsvvswmzi-gspsvjyp-nippcfier-hizipstqirx-802[mvkcd]
|
||||
xgvnndadzy-xviyt-xjvodib-yzkgjthzio-707[ncejo]
|
||||
emixwvqhml-akidmvomz-pcvb-uizsmbqvo-538[mvibo]
|
||||
dpotvnfs-hsbef-cbtlfu-usbjojoh-597[mnkij]
|
||||
amjmpdsj-pyzzgr-jyzmpyrmpw-522[rxsqz]
|
||||
fkqbokxqflkxi-yxphbq-ixyloxqlov-861[xjeyz]
|
||||
vehmsegxmzi-tpewxmg-kveww-xvemrmrk-256[emvwx]
|
||||
aietsrmdih-ikk-viwievgl-750[iekva]
|
||||
zekvierkzferc-gcrjkzt-xirjj-nfibjyfg-763[jlbrc]
|
||||
krxqjijamxdb-lqxlxujcn-lxwcjrwvnwc-537[opuqe]
|
||||
dsxxw-zsllw-jyzmpyrmpw-652[hgyae]
|
||||
mbiyqoxsm-mkxni-mykdsxq-kmaescsdsyx-770[otslp]
|
||||
oqnidbshkd-vdzonmhydc-idkkxadzm-qdzbpthrhshnm-573[dhkmn]
|
||||
jqwpihizlwca-moo-apqxxqvo-174[oqaip]
|
||||
ahngzyzqcntr-azrjds-qdrdzqbg-573[zdqra]
|
||||
bhksan-lqnydwoejc-472[gutvo]
|
||||
jvsvymbs-zjhclunly-obua-zlycpjlz-175[ljyzb]
|
||||
wrs-vhfuhw-hjj-ilqdqflqj-205[hjqfl]
|
||||
egdytrixat-eaphixr-vgphh-ldgzhwde-661[duchs]
|
||||
oxmeeuruqp-eomhqzsqd-tgzf-mocgueufuaz-196[uemoq]
|
||||
ahngzyzqcntr-cxd-ehmzmbhmf-677[dqulm]
|
||||
gspsvjyp-tpewxmg-kveww-wivzmgiw-568[ghntx]
|
||||
pualyuhapvuhs-jvuzbtly-nyhkl-wshzapj-nyhzz-thyrlapun-149[kibhn]
|
||||
nzcczdtgp-mfyyj-pyrtyppctyr-171[ypctr]
|
||||
guahyncw-nij-mywlyn-vohhs-jolwbumcha-760[hnwya]
|
||||
bgmxkgtmbhgte-xzz-vhgmtbgfxgm-397[gmbtx]
|
||||
zixppfcfba-gbiivybxk-zrpqljbo-pbosfzb-653[psocz]
|
||||
votubcmf-sbccju-nbslfujoh-935[bcufj]
|
||||
gsrwyqiv-kvehi-nippcfier-irkmriivmrk-204[irkve]
|
||||
jsvagsulanw-hdsklau-yjskk-ksdwk-632[ltnxs]
|
||||
irdgrxzex-srjbvk-uvgcfpdvek-503[rvdeg]
|
||||
krxqjijamxdb-ljwmh-bcxajpn-849[jxabm]
|
||||
ajmrxjlcren-ljwmh-vjwjpnvnwc-407[yemcd]
|
||||
ahngzyzqcntr-rbzudmfdq-gtms-btrsnldq-rdquhbd-755[dqrbn]
|
||||
rzvkjiduzy-ezggtwzvi-hvmfzodib-291[yuzaf]
|
||||
bwx-amkzmb-ntwemz-aitma-408[mabtw]
|
||||
wihmogyl-aluxy-vumeyn-mufym-812[wymtu]
|
||||
xjmmjndqz-nxvqzibzm-cpio-yzkgjthzio-889[mtsyf]
|
||||
xmtjbzidx-ytz-nojmvbz-525[hyzbw]
|
||||
bnmrtldq-fqzcd-tmrszakd-qzaahs-cdrhfm-131[wmcrn]
|
||||
ftzgxmbv-wrx-kxtvjnblbmbhg-293[bxgmt]
|
||||
gsvvswmzi-gerhc-wepiw-230[wegis]
|
||||
pdjqhwlf-fdqgb-uhfhlylqj-699[fhlqd]
|
||||
zsxyfgqj-kzeed-uqfxynh-lwfxx-ijuqtdrjsy-957[xfjqy]
|
||||
rnqnyfwd-lwfij-uqfxynh-lwfxx-knsfshnsl-359[zbtyx]
|
||||
wrs-vhfuhw-gbh-whfkqrorjb-231[hrwbf]
|
||||
iuxxuyobk-hatte-rumoyzoiy-280[ouyit]
|
||||
oqnidbshkd-bgnbnkzsd-nodqzshnmr-287[xnmzi]
|
||||
atyzghrk-jek-jkyomt-540[anzom]
|
||||
ibghopzs-pogysh-rsdofhasbh-818[hsobg]
|
||||
wbhsfbohwcboz-foppwh-rsjszcdasbh-532[njpay]
|
||||
excdklvo-mrymyvkdo-ecob-docdsxq-484[docek]
|
||||
xgsvgmotm-yigbktmkx-natz-yzuxgmk-722[zwckh]
|
||||
ajyqqgdgcb-afmamjyrc-qfgnngle-964[pzowt]
|
||||
ugdgjxmd-jsttal-kzahhafy-138[cyirg]
|
||||
irgyyolokj-iuxxuyobk-inuiurgzk-rumoyzoiy-982[sgadc]
|
||||
qcbgiasf-ufors-gqojsbusf-vibh-qcbhowbasbh-870[njidq]
|
||||
bkwzkqsxq-mrymyvkdo-wkxkqowoxd-146[hfdmy]
|
||||
mybbycsfo-mrymyvkdo-bokmaescsdsyx-120[mlnky]
|
||||
zuv-ykixkz-jek-ktmotkkxotm-852[mebdc]
|
||||
dkqjcbctfqwu-lgnnadgcp-fgrctvogpv-648[cgdfn]
|
||||
vehmsegxmzi-ikk-xvemrmrk-724[byndz]
|
||||
upq-tfdsfu-cvooz-nbobhfnfou-155[xyskn]
|
||||
gpewwmjmih-wgezirkiv-lyrx-hitevxqirx-360[ierwx]
|
||||
rdggdhxkt-ytaanqtpc-bpcpvtbtci-817[mnjpk]
|
||||
xlrypetn-clmmte-zapcletzyd-405[eltcm]
|
||||
oxjmxdfkd-oxyyfq-abmxoqjbkq-861[nmhlv]
|
||||
xjinphzm-bmvyz-kgvnodx-bmvnn-gjbdnodxn-395[nbdmv]
|
||||
tpspahyf-nyhkl-jhukf-zopwwpun-799[phfkn]
|
||||
jsvagsulanw-usfvq-mkwj-lwklafy-684[alswf]
|
||||
ipvohghykvbz-kfl-ylhjxbpzpapvu-877[vmizu]
|
||||
fydelmwp-awldetn-rcldd-afcnsldtyr-405[dlace]
|
||||
gpbepvxcv-tvv-steadnbtci-609[vtbce]
|
||||
tipfxvezt-upv-rthlzjzkzfe-581[ztefp]
|
||||
bknsykmdsfo-oqq-vyqscdsmc-796[sqcdk]
|
||||
ejpanjwpekjwh-zua-odellejc-914[ejalp]
|
||||
ytu-xjhwjy-uqfxynh-lwfxx-jslnsjjwnsl-775[jxlns]
|
||||
tinnm-aoubshwq-tzcksf-zopcfohcfm-376[cfohm]
|
||||
xjgjmapg-ezggtwzvi-xpnojhzm-nzmqdxz-811[zgjmx]
|
||||
tvsnigxmpi-fewoix-hiwmkr-386[tpuvk]
|
||||
udglrdfwlyh-udeelw-vhuylfhv-829[ldhue]
|
||||
luxciuwncpy-wbiwifuny-mniluay-786[iunwy]
|
||||
ftzgxmbv-ktuubm-inkvatlbgz-865[btgkm]
|
||||
xzwrmkbqtm-zijjqb-twoqabqka-486[erqyp]
|
||||
diozmivodjivg-zbb-ncdkkdib-499[dibko]
|
||||
kwvacumz-ozilm-kivlg-lmxizbumvb-980[milvz]
|
||||
hwbba-dwppa-tgugctej-648[abgpt]
|
||||
myxcewob-qbkno-bkllsd-cdybkqo-120[atghd]
|
||||
zekvierkzferc-irsszk-uvjzxe-477[snqzi]
|
||||
wlsiayhcw-dyffsvyuh-guleyncha-526[yhacf]
|
||||
clotzlnetgp-ojp-opdtry-249[optlc]
|
||||
dmybmsuzs-vqxxknqmz-eqdhuoqe-560[qmdes]
|
||||
mtzslklcozfd-clmmte-dstaatyr-275[rtnyq]
|
||||
cxy-bnlanc-lqxlxujcn-vjwjpnvnwc-823[ncjlx]
|
||||
jshzzpmplk-zjhclunly-obua-bzly-alzapun-929[vcuxs]
|
||||
yuxufmdk-sdmpq-ngzzk-oazfmuzyqzf-508[kghlv]
|
||||
otzkxtgzoutgr-kmm-sgtgmksktz-722[tgkmz]
|
||||
xgvnndadzy-xviyt-hvmfzodib-941[qbwmr]
|
||||
qekrixmg-fyrrc-ywiv-xiwxmrk-230[ikjwl]
|
||||
dpssptjwf-dpmpsgvm-qmbtujd-hsbtt-bobmztjt-337[tbmps]
|
||||
tcfkqcevkxg-rncuvke-itcuu-ujkrrkpi-388[tabmn]
|
||||
hjgbwuladw-tskcwl-xafsfuafy-528[afwls]
|
||||
ygcrqpkbgf-ecpfa-gpikpggtkpi-154[gpkcf]
|
||||
hqcfqwydw-sxesebqju-qdqboiyi-608[qbdei]
|
||||
iehepwnu-cnwza-ydkykhwpa-iwngapejc-706[waenp]
|
||||
jchipqat-ytaanqtpc-htgkxrth-115[mfnly]
|
||||
pinovwgz-ezggtwzvi-xpnojhzm-nzmqdxz-967[yzosw]
|
||||
yhwooebeaz-oywrajcan-dqjp-owhao-628[oaweh]
|
||||
fhezusjybu-tou-skijecuh-iuhlysu-270[uhsei]
|
||||
tcrjjzwzvu-upv-kirzezex-659[bdnty]
|
||||
npmhcargjc-aylbw-amyrgle-qcptgacq-626[tkmzs]
|
||||
ejpanjwpekjwh-ywjzu-ykwpejc-pnwejejc-160[lnqkc]
|
||||
cybyjqho-whqtu-ryexqpqhteki-uww-tuiywd-946[qwyht]
|
||||
cqwdujys-uww-bewyijysi-218[wyijs]
|
||||
xekdwvwnzkqo-acc-pnwejejc-342[cewjk]
|
||||
encuukhkgf-uecxgpigt-jwpv-ugtxkegu-440[kwmxr]
|
||||
mbiyqoxsm-tovvilokx-cobfsmoc-224[doavb]
|
||||
jvuzbtly-nyhkl-jhukf-zlycpjlz-591[jwxzi]
|
||||
ncjzrpytn-clmmte-lylwjdtd-691[ltcdj]
|
||||
enqvbnpgvir-enoovg-erprvivat-117[venrg]
|
||||
gzefmnxq-ngzzk-ymdwqfuzs-612[zfgmn]
|
||||
gokzyxsjon-cmkfoxqob-rexd-psxkxmsxq-302[zylnb]
|
||||
aflwjfslagfsd-xdgowj-xafsfuafy-554[rgqmz]
|
||||
ugdgjxmd-ujqgywfau-hdsklau-yjskk-kzahhafy-294[daelo]
|
||||
mvkccspson-mrymyvkdo-nozkbdwoxd-718[odkmc]
|
||||
egdytrixat-rwdrdapit-stepgibtci-817[ampoz]
|
||||
qfmcusbwq-pogysh-fsgsofqv-194[gcthj]
|
||||
wifilzof-qyujihctyx-luvvcn-qilembij-344[ilcfj]
|
||||
gpbepvxcv-snt-apqdgpidgn-323[dnmyh]
|
||||
kpvgtpcvkqpcn-gii-gpikpggtkpi-180[vyxnb]
|
||||
ziuxioqvo-moo-mvoqvmmzqvo-512[omvqi]
|
||||
fbebmtkr-zktwx-vtgwr-vhtmbgz-wxitkmfxgm-631[zilsp]
|
||||
wihmogyl-aluxy-luvvcn-wihnuchgyhn-240[hlnuy]
|
||||
eqnqthwn-lgnnadgcp-rwtejcukpi-726[jwvun]
|
||||
hdgdovmt-bmvyz-ytz-yzqzgjkhzio-369[zydgh]
|
||||
aflwjfslagfsd-usfvq-ugslafy-hmjuzskafy-138[vjmnt]
|
||||
froruixo-iorzhu-uhdftxlvlwlrq-205[eslfx]
|
||||
xekdwvwnzkqo-zua-skngodkl-368[kdnow]
|
||||
xtwtelcj-rclop-clmmte-dpcgtnpd-353[jowtx]
|
||||
lhkhszqx-fqzcd-cxd-nodqzshnmr-911[dhqzc]
|
||||
fodvvlilhg-fdqgb-xvhu-whvwlqj-725[syfpw]
|
||||
mtzslklcozfd-dnlgpyrpc-sfye-cpdplcns-873[zngtm]
|
||||
rwcnawjcrxwju-yujbcrl-pajbb-jwjuhbrb-459[jbrwc]
|
||||
hcd-gsqfsh-awzwhofm-ufors-suu-twbobqwbu-948[reunt]
|
||||
pwcvonofrcig-pibbm-obozmgwg-688[zgthm]
|
||||
vhehkyne-lvtoxgzxk-angm-wxiehrfxgm-345[xeghk]
|
||||
ucynmlgxcb-njyqrga-epyqq-qrmpyec-938[mgnpj]
|
||||
fruurvlyh-fdqgb-frdwlqj-uhvhdufk-699[fudhr]
|
||||
hqfxxnknji-gzssd-yjhmstqtld-697[sdhjn]
|
||||
qzoggwtwsr-rms-rsdofhasbh-402[gtlom]
|
||||
gzefmnxq-ngzzk-dqeqmdot-638[yatsz]
|
||||
rmn-qcapcr-njyqrga-epyqq-pcqcypaf-834[mpqie]
|
||||
yknnkoera-ywjzu-zarahkliajp-186[yozsd]
|
||||
clxalrtyr-eza-dpncpe-mldvpe-epnsyzwzrj-483[eplrz]
|
||||
vkrhzxgbv-cxeeruxtg-vhgmtbgfxgm-137[fsxoz]
|
||||
ymszqfuo-bxmefuo-sdmee-mzmxkeue-898[ndgcf]
|
||||
dmbttjgjfe-sbccju-bdrvjtjujpo-649[vkijs]
|
||||
wifilzof-wbiwifuny-guleyncha-136[ifwln]
|
||||
oxmeeuruqp-vqxxknqmz-abqdmfuaze-196[baztd]
|
||||
tinnm-qfmcusbwq-pogysh-gvwddwbu-636[aryhp]
|
||||
lxaaxbren-ouxfna-bnaerlnb-693[anbxe]
|
||||
nglmtuex-xzz-mktbgbgz-397[zqyrt]
|
||||
xlrypetn-mfyyj-pyrtyppctyr-223[yprtc]
|
||||
fodvvlilhg-fdqgb-vklsslqj-127[lvdfg]
|
||||
ikhcxvmbex-lvtoxgzxk-angm-ehzblmbvl-761[xblmv]
|
||||
fkqbokxqflkxi-ciltbo-qoxfkfkd-211[kfoqx]
|
||||
lujbbrornm-bljenwpna-qdwc-fxatbqxy-589[bnajl]
|
||||
eqpuwogt-itcfg-tcddkv-vgejpqnqia-258[besga]
|
||||
lnkfaypeha-ydkykhwpa-zaoecj-108[zamyw]
|
||||
lhkhszqx-fqzcd-atmmx-lzqjdshmf-859[hmqzd]
|
||||
aflwjfslagfsd-tskcwl-vwhsjlewfl-190[xevmq]
|
||||
pbafhzre-tenqr-wryylorna-fuvccvat-507[racef]
|
||||
jvsvymbs-ibuuf-yljlpcpun-773[ubjlp]
|
||||
fab-eqodqf-rxaiqd-etubbuzs-612[bqade]
|
||||
cxy-bnlanc-ljwmh-nwprwnnarwp-251[nwacl]
|
||||
hdgdovmt-bmvyz-pinovwgz-ytz-omvdidib-239[qfmcj]
|
||||
wsvsdkbi-qbkno-mkxni-mykdsxq-bokmaescsdsyx-328[skbdm]
|
||||
njmjubsz-hsbef-gmpxfs-tijqqjoh-727[ykelf]
|
||||
foadouwbu-qobrm-oqeiwgwhwcb-142[owbqu]
|
||||
cvabijtm-kivlg-ewzsapwx-538[posuz]
|
||||
xgsvgmotm-igtje-gtgreyoy-696[gtemo]
|
||||
oaddaeuhq-ngzzk-efadmsq-612[adeqz]
|
||||
zgmfyxypbmsq-pyzzgr-yaosgqgrgml-470[efsgy]
|
||||
wihmogyl-aluxy-vumeyn-zchuhwcha-110[eisnw]
|
||||
hafgnoyr-fpniratre-uhag-phfgbzre-freivpr-663[rfaeg]
|
||||
jqwpihizlwca-zijjqb-ewzsapwx-174[ognyv]
|
||||
uwtojhynqj-hfsid-htfynsl-ijajqturjsy-619[jhsty]
|
||||
hqfxxnknji-kqtbjw-wjhjnansl-177[ctzqd]
|
||||
upq-tfdsfu-dboez-dpbujoh-mphjtujdt-103[dujpt]
|
||||
tfiifjzmv-jtrmvexvi-ylek-wzeretzex-919[kuzli]
|
||||
ugjjgkanw-hdsklau-yjskk-vwkayf-840[omzwl]
|
||||
ugdgjxmd-kusnwfywj-zmfl-ogjckzgh-840[gjdfk]
|
||||
vehmsegxmzi-fewoix-hitevxqirx-308[eixhm]
|
||||
yflexwxoalrp-bdd-absbilmjbkq-419[esuky]
|
||||
kwzzwaqdm-rmttgjmiv-lmxizbumvb-330[mzbit]
|
||||
htqtwkzq-hfsid-yjhmstqtld-593[thqds]
|
||||
tinnm-qobrm-qcohwbu-difqvogwbu-740[boqim]
|
||||
tipfxvezt-jtrmvexvi-ylek-nfibjyfg-659[fqnis]
|
||||
lzfmdshb-atmmx-qdzbpthrhshnm-859[hmbds]
|
||||
nij-mywlyn-mwupyhayl-bohn-qilembij-292[vwady]
|
||||
jchipqat-hrpktcvtg-wjci-gthtpgrw-999[tcghp]
|
||||
dyz-combod-oqq-mecdywob-cobfsmo-250[obcdm]
|
||||
dkqjcbctfqwu-ecpfa-vgejpqnqia-310[crelp]
|
||||
gsrwyqiv-kvehi-gerhc-stivexmsrw-646[slxzf]
|
||||
hmsdqmzshnmzk-bgnbnkzsd-cdozqsldms-261[sdmzn]
|
||||
tfejldvi-xiruv-srjbvk-uvmvcfgdvek-217[kfcmn]
|
||||
wrs-vhfuhw-exqqb-dqdobvlv-751[qvbdh]
|
||||
willimcpy-jfumncw-alumm-mufym-682[dsbwk]
|
||||
etaqigpke-lgnnadgcp-ceswkukvkqp-856[fnltm]
|
||||
diozmivodjivg-nxvqzibzm-cpio-gvwjmvojmt-603[vywzn]
|
||||
oxjmxdfkd-oxyyfq-absbilmjbkq-809[bxdfj]
|
||||
uqtqbizg-ozilm-moo-wxmzibqwva-564[indml]
|
||||
rdchjbtg-vgpst-uadltg-gtprfjxhxixdc-323[czknl]
|
||||
pybgmyargtc-amjmpdsj-njyqrga-epyqq-mncpyrgmlq-808[rzoqv]
|
||||
sbqiiyvyut-sxesebqju-huiuqhsx-582[suiqb]
|
||||
clxalrtyr-dnlgpyrpc-sfye-epnsyzwzrj-873[rylpc]
|
||||
amlqskcp-epybc-cee-bcqgel-756[ceblp]
|
||||
jrncbavmrq-pnaql-pbngvat-qrirybczrag-377[rabnq]
|
||||
cebwrpgvyr-onfxrg-qrcnegzrag-221[rgcen]
|
||||
forwcoqhwjs-tzcksf-rsjszcdasbh-792[scfhj]
|
||||
ckgvutofkj-pkrrehkgt-jkvgxzsktz-696[wxbfz]
|
||||
kzeed-uqfxynh-lwfxx-qtlnxynhx-255[xnefh]
|
||||
vhkkhlbox-vtgwr-hixktmbhgl-683[hkbgl]
|
||||
mrxivrexmsrep-hci-viwievgl-464[msqei]
|
||||
nsyjwsfyntsfq-idj-htsyfnsrjsy-931[syfjn]
|
||||
awzwhofm-ufors-qobrm-qcohwbu-aofyshwbu-272[owbfh]
|
||||
ahngzyzqcntr-bzmcx-cdoknxldms-651[cnzdm]
|
||||
nsyjwsfyntsfq-hfsid-wjfhvznxnynts-671[dqrws]
|
||||
krxqjijamxdb-npp-uxprbcrlb-589[vutpy]
|
||||
ahngzyzqcntr-azrjds-knfhrshbr-209[qnogp]
|
||||
pejji-bkllsd-crszzsxq-458[xlhso]
|
||||
qcffcgwjs-gqojsbusf-vibh-zcuwghwqg-480[njzmp]
|
||||
ziuxioqvo-moo-amzdqkma-174[zeuba]
|
||||
ujqgywfau-aflwjfslagfsd-vqw-kwjnauwk-398[wafju]
|
||||
elrkdcdugrxv-fdqgb-orjlvwlfv-101[mhsyz]
|
||||
kpvgtpcvkqpcn-tcddkv-qrgtcvkqpu-700[ptqjs]
|
||||
jfifqxov-doxab-avb-xkxivpfp-107[xfvab]
|
||||
lsyrkjkbnyec-mkxni-mykdsxq-kmaescsdsyx-978[mbynk]
|
||||
ocipgvke-lgnnadgcp-wugt-vguvkpi-206[hugza]
|
||||
hcd-gsqfsh-qvcqczohs-rsgwub-142[dhpmf]
|
||||
lsyrkjkbnyec-oqq-ckvoc-822[ckoqy]
|
||||
vhkkhlbox-utldxm-vnlmhfxk-lxkobvx-787[xklhv]
|
||||
vkppo-cqwdujys-vbemuh-qdqboiyi-504[qbdio]
|
||||
qjopwxha-ywjzu-zaoecj-654[jaowz]
|
||||
njmjubsz-hsbef-dipdpmbuf-efqbsunfou-311[bfusd]
|
||||
ktiaaqnqml-jiasmb-lmdmtwxumvb-694[yxlgt]
|
||||
vrurcjah-pajmn-lqxlxujcn-fxatbqxy-511[ztgdk]
|
||||
vagreangvbany-qlr-znexrgvat-325[yblnw]
|
||||
lgh-kwujwl-wyy-jwsuimakalagf-996[gsubl]
|
||||
apuut-xgvnndadzy-ezggtwzvi-zibdizzmdib-343[qlykv]
|
||||
pxtihgbsxw-utldxm-kxlxtkva-787[xtkla]
|
||||
mfklstdw-esyfwlau-usfvq-vwkayf-762[kljiy]
|
||||
eqpuwogt-itcfg-hwbba-fag-fgrnqaogpv-232[gafbo]
|
||||
qzoggwtwsr-rms-rsdzcmasbh-688[srgmw]
|
||||
yhkpvhjapcl-ibuuf-jbzavtly-zlycpjl-955[skwvb]
|
||||
gpewwmjmih-hci-gywxsqiv-wivzmgi-620[txcfj]
|
||||
lahxpnwrl-npp-vjatncrwp-537[aisyo]
|
||||
ckgvutofkj-hatte-aykx-zkyzotm-436[ntzbr]
|
||||
iehepwnu-cnwza-lhwopey-cnwoo-ykjpwejiajp-628[wepjn]
|
||||
fkqbokxqflkxi-yxphbq-obpbxoze-471[napmi]
|
||||
etyyx-cxd-lzqjdshmf-261[inzys]
|
||||
ftzgxmbv-utldxm-ftkdxmbgz-267[wqkjm]
|
||||
jyfvnlupj-jhukf-jvhapun-klwsvftlua-903[yrgnq]
|
||||
zsxyfgqj-jll-qfgtwfytwd-489[sazdc]
|
||||
oxjmxdfkd-zxkav-zlxqfkd-rpbo-qbpqfkd-263[vauwt]
|
||||
dsxxw-cee-bcnyprkclr-470[ghzni]
|
||||
enzcntvat-fpniratre-uhag-jbexfubc-533[aentb]
|
||||
froruixo-mhoobehdq-dqdobvlv-803[odbhq]
|
||||
raphhxuxts-qphzti-bpcpvtbtci-115[pthbc]
|
||||
jvsvymbs-jhukf-jvhapun-shivyhavyf-955[yabwx]
|
||||
ykhknbqh-ywjzu-odellejc-498[ehjkl]
|
||||
avw-zljyla-ihzrla-zlycpjlz-201[uvdxz]
|
||||
wdjcvuvmyjpn-nxvqzibzm-cpio-hvivbzhzio-967[vizbc]
|
||||
xgjougizobk-pkrrehkgt-ktmotkkxotm-150[gnkzc]
|
||||
kyelcrga-aylbw-rcaflmjmew-808[wsmtg]
|
||||
laffe-atyzghrk-igtje-jkyomt-462[taefg]
|
||||
hqtyeqsjylu-uww-ijehqwu-608[quweh]
|
||||
kzgwomvqk-kivlg-kcabwumz-amzdqkm-200[cdavq]
|
||||
avw-zljyla-jhukf-shivyhavyf-305[ahvyf]
|
||||
guahyncw-vumeyn-xypyfijgyhn-370[ynghu]
|
||||
kwtwznct-jiasmb-zmikycqaqbqwv-564[wbjnt]
|
||||
sorozgxe-mxgjk-hatte-vaxingyotm-228[enmvq]
|
||||
hqtyeqsjylu-sxesebqju-bqrehqjeho-348[nxucm]
|
||||
qzoggwtwsr-awzwhofm-ufors-tzcksf-rsdofhasbh-948[sfowh]
|
||||
jfifqxov-doxab-mixpqfz-doxpp-qbzeklildv-185[rydoa]
|
||||
gsvvswmzi-vehmsegxmzi-fyrrc-irkmriivmrk-204[imrvs]
|
||||
dlhwvupglk-qlssfilhu-ylzlhyjo-721[lhsuy]
|
||||
crwwv-zxkav-absbilmjbkq-679[bakvw]
|
||||
xzwrmkbqtm-lgm-zmkmqdqvo-720[mqkzb]
|
||||
eqnqthwn-ecpfa-eqcvkpi-qrgtcvkqpu-570[qcepk]
|
||||
ftzgxmbv-utldxm-nlxk-mxlmbgz-891[mxlbg]
|
||||
xqvwdeoh-gbh-ghyhorsphqw-387[hgoqw]
|
||||
rdchjbtg-vgpst-uadltg-pcpanhxh-141[mtvxn]
|
||||
sebehvkb-vbemuh-udwyduuhydw-140[ubdeh]
|
||||
gpsxdprixkt-qphzti-stktadebtci-921[tipdk]
|
||||
nij-mywlyn-dyffsvyuh-omyl-nymncha-214[obtqu]
|
||||
rdggdhxkt-rpcsn-rdpixcv-bpgztixcv-843[cdgpr]
|
||||
pdjqhwlf-iorzhu-uhdftxlvlwlrq-803[rtwsz]
|
||||
tinnm-dzoghwq-ufogg-twbobqwbu-428[bgown]
|
||||
etyyx-qzaahs-lzmzfdldms-781[cmnek]
|
||||
willimcpy-dyffsvyuh-fuvilunils-448[sjytb]
|
||||
dpotvnfs-hsbef-qmbtujd-hsbtt-ufdiopmphz-831[zmvga]
|
||||
hdgdovmt-bmvyz-ytz-xpnojhzm-nzmqdxz-109[hzpfs]
|
||||
ksodcbwnsr-qobrm-aobousasbh-324[bosar]
|
||||
myvybpev-tovvilokx-kmaescsdsyx-380[vsyek]
|
||||
nbhofujd-cbtlfu-tbmft-571[mkltr]
|
||||
sedikcuh-whqtu-uww-jusxdebewo-764[uwedh]
|
||||
jvsvymbs-jhukf-klclsvwtlua-825[jxhaq]
|
||||
crwwv-mixpqfz-doxpp-jxohbqfkd-575[serbn]
|
||||
fmsledevhsyw-hci-xiglrspskc-646[scehi]
|
||||
xekdwvwnzkqo-ywjzu-oanreyao-576[dwrqm]
|
||||
gzefmnxq-vqxxknqmz-pqbmdfyqzf-352[xuyzs]
|
||||
bqvvu-zua-hkceopeyo-706[eouva]
|
||||
ytu-xjhwjy-gfxpjy-btwpxmtu-151[bynhm]
|
||||
npmhcargjc-hcjjwzcyl-bctcjmnkclr-886[cjhlm]
|
||||
xlrypetn-dnlgpyrpc-sfye-dlwpd-119[znfjd]
|
||||
ejpanjwpekjwh-ydkykhwpa-hkceopeyo-758[patzv]
|
||||
lhkhszqx-fqzcd-eknvdq-rsnqzfd-287[qdzfh]
|
||||
froruixo-fdqgb-orjlvwlfv-179[optcg]
|
||||
jvsvymbs-jovjvshal-jbzavtly-zlycpjl-253[zcnfy]
|
||||
avw-zljyla-ibuuf-ylzlhyjo-149[xtcfz]
|
||||
bnmrtldq-fqzcd-bzmcx-bnzshmf-cdudknoldms-157[whdus]
|
||||
sno-rdbqds-idkkxadzm-rsnqzfd-703[dsknq]
|
||||
vkppo-sxesebqju-tuiywd-504[epsub]
|
||||
ryexqpqhteki-zubboruqd-husuylydw-790[nimls]
|
||||
vetllbybxw-lvtoxgzxk-angm-kxvxbobgz-995[xbglv]
|
||||
rdchjbtg-vgpst-qphzti-gtrtxkxcv-817[mayne]
|
||||
dzczkrip-xiruv-irdgrxzex-vxx-rthlzjzkzfe-503[xwhmg]
|
||||
qcbgiasf-ufors-pogysh-sbuwbssfwbu-454[nshbt]
|
||||
qcbgiasf-ufors-qobrm-qcohwbu-igsf-hsghwbu-142[bsfgh]
|
||||
zgmfyxypbmsq-pyzzgr-amlryglkclr-392[yglmr]
|
||||
myxcewob-qbkno-cmkfoxqob-rexd-vklybkdybi-146[wxnuy]
|
||||
amlqskcp-epybc-afmamjyrc-pcacgtgle-418[campe]
|
||||
muqfedyput-isqludwuh-xkdj-huqsgkyiyjyed-660[nbtda]
|
||||
vkppo-sqdto-vydqdsydw-114[pzbiy]
|
||||
ziuxioqvo-jcvvg-lmxtwgumvb-668[fnbjv]
|
||||
rdchjbtg-vgpst-rwdrdapit-stepgibtci-271[tdgip]
|
||||
zbytomdsvo-zvkcdsm-qbkcc-zebmrkcsxq-614[nwmol]
|
||||
sbnqbhjoh-fhh-efqbsunfou-103[hjxvu]
|
||||
vagreangvbany-ohaal-nanylfvf-273[zfytn]
|
||||
wihmogyl-aluxy-dyffsvyuh-lyuwkocmcncih-760[efwrt]
|
||||
irgyyolokj-inuiurgzk-ykxboiky-332[ikyog]
|
||||
gntmfefwitzx-xhfajsljw-mzsy-fhvznxnynts-437[mkuja]
|
||||
tpspahyf-nyhkl-yhiipa-zhslz-539[yzmib]
|
||||
encuukhkgf-rncuvke-itcuu-nqikuvkeu-700[ukcen]
|
||||
mybbycsfo-mkxni-oxqsxoobsxq-198[oxbsm]
|
||||
kyelcrga-zsllw-kypicrgle-730[nvjmt]
|
||||
rdggdhxkt-uadltg-stktadebtci-713[btson]
|
||||
dpssptjwf-qmbtujd-hsbtt-usbjojoh-623[miqos]
|
||||
tcfkqcevkxg-dcumgv-vgejpqnqia-336[cgqve]
|
||||
fodvvlilhg-gbh-orjlvwlfv-699[eykml]
|
||||
bxaxipgn-vgpst-eaphixr-vgphh-ejgrwphxcv-817[rsizj]
|
||||
pualyuhapvuhs-ibuuf-jvuahputlua-305[hlzmu]
|
||||
qekrixmg-nippcfier-gsrxemrqirx-646[xhnfm]
|
||||
pdjqhwlf-plolwdub-judgh-fdqgb-ghsorbphqw-543[aiewf]
|
||||
fruurvlyh-vfdyhqjhu-kxqw-fxvwrphu-vhuylfh-647[hufvr]
|
||||
ftzgxmbv-utldxm-ftgtzxfxgm-891[txfgm]
|
||||
htsxzrjw-lwfij-gfxpjy-btwpxmtu-359[jtwxf]
|
||||
gpewwmjmih-jyddc-hci-vigimzmrk-932[imcdg]
|
||||
yuxufmdk-sdmpq-qss-oazfmuzyqzf-378[fmqsu]
|
||||
oxmeeuruqp-eomhqzsqd-tgzf-efadmsq-508[oxhfu]
|
||||
qzoggwtwsr-xszzmpsob-hsqvbczcum-610[scyrz]
|
||||
avw-zljyla-ibuuf-ayhpupun-981[ualpy]
|
||||
zloolpfsb-oxyyfq-bkdfkbbofkd-471[untjs]
|
||||
tvsnigxmpi-jpsaiv-erepcwmw-308[nwfcx]
|
||||
jvuzbtly-nyhkl-qlssfilhu-mpuhujpun-929[ulhjn]
|
||||
yknnkoera-ydkykhwpa-pnwejejc-290[setqd]
|
||||
tcrjjzwzvu-gcrjkzt-xirjj-ljvi-kvjkzex-659[jzkrv]
|
||||
gntmfefwitzx-hmthtqfyj-xytwflj-307[tsebr]
|
||||
gspsvjyp-wgezirkiv-lyrx-pefsvexsvc-412[svepg]
|
||||
ugfkmewj-yjsvw-xdgowj-jwuwanafy-944[hysdk]
|
||||
sbnqbhjoh-qmbtujd-hsbtt-tijqqjoh-597[bzawy]
|
||||
vetllbybxw-unggr-tgterlbl-631[mfwxo]
|
||||
tipfxvezt-avccpsvre-tljkfdvi-jvimztv-139[vtice]
|
||||
hvbizodx-wpiit-yzkvmohzio-603[ytsvn]
|
||||
sno-rdbqds-eknvdq-nodqzshnmr-209[dnqso]
|
||||
rtqlgevkng-dcumgv-rwtejcukpi-960[yhfsz]
|
||||
ugjjgkanw-tmffq-ksdwk-606[bqdtn]
|
||||
jyfvnlupj-jhukf-jvhapun-ylhjxbpzpapvu-981[ygxts]
|
||||
kzeed-gzssd-ijufwyrjsy-203[sdejy]
|
||||
chnylhuncihuf-jfumncw-alumm-uwkocmcncih-864[btkms]
|
||||
qfmcusbwq-suu-ghcfous-922[btras]
|
||||
bgmxkgtmbhgte-ietlmbv-zktll-xgzbgxxkbgz-215[isyml]
|
||||
pwcvonofrcig-xszzmpsob-zopcfohcfm-506[avfiu]
|
||||
iruzfrtkzmv-dzczkrip-xiruv-treup-tfrkzex-fgvirkzfej-633[rzfik]
|
||||
mrxivrexmsrep-nippcfier-qerekiqirx-776[ombwt]
|
||||
iwcjapey-ywjzu-ykwpejc-ykjpwejiajp-420[ztgqm]
|
||||
joufsobujpobm-qmbtujd-hsbtt-sfbdrvjtjujpo-467[jbotu]
|
||||
xst-wigvix-yrwxefpi-gerhc-hiwmkr-230[mylsd]
|
||||
ytu-xjhwjy-ojqqdgjfs-xmnuunsl-931[mvbrl]
|
||||
zovldbkfz-avb-jxkxdbjbkq-159[bkdjv]
|
||||
qvbmzvibqwvit-ntwemz-amzdqkma-226[mqvza]
|
||||
eadalsjq-yjsvw-xdgowj-ljsafafy-840[nqijl]
|
||||
dszphfojd-tdbwfohfs-ivou-bdrvjtjujpo-233[ximod]
|
||||
gsvvswmzi-tpewxmg-kveww-erepcwmw-308[wizmq]
|
||||
ktwbhtvmbox-ktuubm-hixktmbhgl-657[hynsw]
|
||||
iuruxlar-vrgyzoi-mxgyy-sgtgmksktz-488[ufytd]
|
||||
nzydfxpc-rclop-awldetn-rcldd-nzyeltyxpye-379[pusht]
|
||||
iehepwnu-cnwza-ynukcajey-lhwopey-cnwoo-pnwejejc-212[enwcj]
|
||||
vcibutulxiom-jfumncw-alumm-ijyluncihm-214[muicl]
|
||||
pyknyegle-aylbw-qyjcq-392[hzumy]
|
||||
atyzghrk-xghhoz-cuxqynuv-436[cmdsl]
|
||||
vcibutulxiom-jfumncw-alumm-jolwbumcha-682[dgfeu]
|
||||
cybyjqho-whqtu-isqludwuh-xkdj-cqdqwucudj-946[qudch]
|
||||
lejkrscv-jtrmvexvi-ylek-uvgrikdvek-893[vekri]
|
||||
nvrgfezqvu-upv-jkfirxv-789[vfrue]
|
||||
fnjyxwrinm-ljwmh-lxjcrwp-bjunb-173[ljyap]
|
||||
gsrwyqiv-kvehi-qekrixmg-fyrrc-wepiw-360[tnixb]
|
||||
gsvvswmzi-fyrrc-hitevxqirx-308[irvsx]
|
||||
nglmtuex-ynssr-vahvhetmx-wxlbzg-267[xeghl]
|
||||
qjopwxha-acc-ykjpwejiajp-524[gjqhn]
|
||||
wrs-vhfuhw-mhoobehdq-dqdobvlv-803[pdlvm]
|
||||
otzkxtgzoutgr-inuiurgzk-uvkxgzouty-878[modya]
|
||||
gvcskirmg-fyrrc-xvemrmrk-568[rmcgk]
|
||||
xqvwdeoh-hjj-ghsduwphqw-231[hwdjq]
|
||||
sbejpbdujwf-cvooz-nbslfujoh-441[nwsha]
|
||||
zixppfcfba-oxyyfq-ixyloxqlov-315[xfoyi]
|
||||
bdavqofuxq-rxaiqd-pqhqxabyqzf-846[yzpfi]
|
||||
vhglnfxk-zktwx-vetllbybxw-ktuubm-hixktmbhgl-501[bkltx]
|
||||
tinnm-qobrm-qcohwbu-zcuwghwqg-584[ejnps]
|
||||
rmn-qcapcr-kyelcrga-cee-bcqgel-730[cerag]
|
||||
apwmeclga-djmucp-ylyjwqgq-756[acgjl]
|
||||
pybgmyargtc-amlqskcp-epybc-zsllw-pcacgtgle-392[cglpa]
|
||||
jxdkbqfz-avb-tlohpelm-783[blade]
|
||||
npmhcargjc-bwc-pcqcypaf-808[phjds]
|
||||
rdchjbtg-vgpst-qphzti-itrwcdadvn-843[zueyn]
|
||||
votubcmf-qmbtujd-hsbtt-sfdfjwjoh-259[tbfjd]
|
||||
ujoon-gpqqxi-advxhixrh-661[mlyen]
|
||||
ykjoqian-cnwza-lhwopey-cnwoo-iwjwcaiajp-576[waoci]
|
||||
gpewwmjmih-wgezirkiv-lyrx-xvemrmrk-386[mreiw]
|
||||
gzefmnxq-ngzzk-pqhqxabyqzf-352[drqzm]
|
||||
nwilwcejc-nwxxep-oanreyao-394[lqxwm]
|
||||
hdgdovmt-bmvyz-zbb-gjbdnodxn-785[bdgmn]
|
||||
gsrwyqiv-kvehi-aietsrmdih-gerhc-gsexmrk-viwievgl-672[bsytl]
|
||||
rdchjbtg-vgpst-tvv-rdcipxcbtci-999[ctvbd]
|
||||
joufsobujpobm-fhh-tbmft-389[mnyql]
|
||||
fnjyxwrinm-mhn-anbnjalq-147[nmbzl]
|
||||
wfummczcyx-yaa-guhuaygyhn-578[yaucg]
|
||||
qfkkj-mfyyj-dpcgtnpd-457[dfjkp]
|
||||
ncjzrpytn-mfyyj-wzrtdetnd-509[qnwdl]
|
||||
sno-rdbqds-bnknqetk-idkkxadzm-bnmszhmldms-365[dkmns]
|
||||
wkqxodsm-cmkfoxqob-rexd-vyqscdsmc-380[cdmoq]
|
||||
dpssptjwf-tdbwfohfs-ivou-tbmft-233[lbdah]
|
||||
dpssptjwf-dipdpmbuf-xpsltipq-285[pdsfi]
|
||||
qyujihctyx-wuhxs-wiuncha-jolwbumcha-214[zlbuy]
|
||||
oxmeeuruqp-pkq-iadwetab-716[eapqu]
|
||||
wfummczcyx-ohmnuvfy-xsy-womnigyl-mylpcwy-214[ymcwf]
|
||||
xmtjbzidx-ytz-ncdkkdib-525[wmfvr]
|
||||
qekrixmg-jpsaiv-xiglrspskc-204[dwvst]
|
||||
kwtwznct-zijjqb-mvoqvmmzqvo-356[qmnjk]
|
||||
ltpedcxots-ytaanqtpc-rdcipxcbtci-999[lkmsv]
|
||||
zovldbkfz-yrkkv-abmxoqjbkq-913[kboqv]
|
||||
yhkpvhjapcl-wshzapj-nyhzz-jvuahputlua-279[cnmzy]
|
||||
pdjqhwlf-edvnhw-whfkqrorjb-257[unmsk]
|
||||
rgllk-bdavqofuxq-rxaiqd-iadwetab-664[mkeil]
|
||||
wdjcvuvmyjpn-nxvqzibzm-cpio-nzmqdxzn-343[nzmvc]
|
||||
xzwrmkbqtm-kpwkwtibm-nqvivkqvo-486[dcwog]
|
||||
rdchjbtg-vgpst-rpcsn-rdpixcv-hidgpvt-765[stnfw]
|
||||
buzahisl-lnn-thuhnltlua-955[oschg]
|
||||
enzcntvat-ohaal-bcrengvbaf-793[anbce]
|
||||
eqpuwogt-itcfg-uecxgpigt-jwpv-hkpcpekpi-362[pgcei]
|
||||
avw-zljyla-qlssfilhu-dvyrzovw-175[lvasw]
|
||||
iuruxlar-xgsvgmotm-inuiurgzk-zxgototm-982[mlnut]
|
||||
tyepcyletzylw-prr-opalcexpye-925[boymz]
|
||||
hqcfqwydw-rqiauj-huiuqhsx-556[abndo]
|
||||
tcrjjzwzvu-vxx-kirzezex-841[zxejr]
|
||||
qspkfdujmf-sbccju-sfdfjwjoh-285[ktqja]
|
||||
vcibutulxiom-wbiwifuny-guleyncha-682[uzxms]
|
||||
ejpanjwpekjwh-bqvvu-ywjzu-nayaerejc-628[jeawn]
|
||||
kwvacumz-ozilm-kivlg-lmdmtwxumvb-330[mlvik]
|
||||
kzgwomvqk-kwvacumz-ozilm-zijjqb-bziqvqvo-460[zqvik]
|
||||
wfintfhynaj-wfggny-qfgtwfytwd-775[fwgnt]
|
||||
tcfkqcevkxg-hnqygt-vgejpqnqia-622[qgcek]
|
||||
yrwxefpi-nippcfier-wepiw-386[ipewf]
|
||||
xjinphzm-bmvyz-zbb-omvdidib-109[bimzd]
|
||||
qlm-pbzobq-ciltbo-abmilvjbkq-107[jvsxc]
|
||||
tfcfiwlc-gcrjkzt-xirjj-tfekrzedvek-295[wjhqa]
|
||||
nchhg-moo-lmdmtwxumvb-382[mhobc]
|
||||
bknsykmdsfo-lkcuod-myxdksxwoxd-692[azknp]
|
||||
jxdkbqfz-yrkkv-qoxfkfkd-211[kfdqx]
|
||||
jlidywncfy-dyffsvyuh-lyuwkocmcncih-344[ycfdh]
|
||||
iuruxlar-igtje-iugzotm-lotgtiotm-358[tigou]
|
||||
foadouwbu-gqojsbusf-vibh-qighcasf-gsfjwqs-116[sfbgo]
|
||||
ucynmlgxcb-aylbw-nspafyqgle-288[fswap]
|
||||
amppmqgtc-aylbw-qfgnngle-808[galmn]
|
||||
kfg-jvtivk-irsszk-jrcvj-659[jkvir]
|
||||
xjinphzm-bmvyz-ytz-yzqzgjkhzio-681[ubzyj]
|
||||
plolwdub-judgh-fdqgb-ilqdqflqj-491[dlqbf]
|
||||
crwwv-yrkkv-bkdfkbbofkd-783[inhxy]
|
||||
nuatmlmdpage-otaoaxmfq-pqhqxabyqzf-612[qvdxy]
|
||||
pualyuhapvuhs-ibuuf-jbzavtly-zlycpjl-435[znegj]
|
||||
eza-dpncpe-clmmte-lylwjdtd-509[delcm]
|
||||
tfejldvi-xiruv-irsszk-uvgcfpdvek-659[rvaql]
|
||||
pybgmyargtc-aylbw-qcptgacq-600[oscut]
|
||||
kdijqrbu-vbemuh-qdqboiyi-972[biqdu]
|
||||
irgyyolokj-vrgyzoi-mxgyy-jkvruesktz-644[ygkor]
|
||||
rgllk-uzfqdzmfuazmx-otaoaxmfq-oazfmuzyqzf-560[zfamo]
|
||||
iqmbazulqp-eomhqzsqd-tgzf-fqotzaxask-378[qmsxo]
|
||||
oqnidbshkd-atmmx-kzanqzsnqx-703[vztcl]
|
||||
vjpwncrl-lqxlxujcn-mnyjacvnwc-615[cnjlv]
|
||||
bkzrrhehdc-cxd-bnmszhmldms-807[dhmbc]
|
||||
kgjgrypw-epybc-zyqicr-bcnyprkclr-704[mzsty]
|
||||
apuut-ezggtwzvi-yzqzgjkhzio-265[pmlri]
|
||||
rflsjynh-hfsid-htfynsl-qtlnxynhx-567[cqbst]
|
||||
zilqwikbqdm-lgm-nqvivkqvo-330[wmxzv]
|
||||
lahxpnwrl-ouxfna-anlnrerwp-355[nzkvm]
|
||||
veqtekmrk-ikk-tyvglewmrk-386[kemrt]
|
||||
sgmtkzoi-pkrrehkgt-rumoyzoiy-514[zytsw]
|
||||
yflexwxoalrp-oxyyfq-mrozexpfkd-341[xfoye]
|
||||
bwx-amkzmb-kivlg-kwibqvo-xczkpiaqvo-434[lkqrz]
|
||||
clxalrtyr-nsznzwlep-opdtry-145[nczlj]
|
||||
bjfutsneji-jll-wjhjnansl-125[szrni]
|
||||
bcfhvdczs-cpxsqh-ghcfous-324[chsfb]
|
||||
aflwjfslagfsd-kusnwfywj-zmfl-ugflsafewfl-216[flswa]
|
||||
gcfcnuls-aluxy-wuhxs-jolwbumcha-578[uclah]
|
||||
pyknyegle-pybgmyargtc-aylbw-qfgnngle-470[gyeln]
|
||||
oazegyqd-sdmpq-gzefmnxq-qss-geqd-fqefuzs-508[qesdf]
|
||||
xjmmjndqz-mvwwdo-yzkvmohzio-551[ypzog]
|
||||
zekvierkzferc-treup-uvgcfpdvek-789[stzno]
|
||||
ejpanjwpekjwh-xqjju-odellejc-576[enmtc]
|
||||
ltpedcxots-tvv-sthxvc-115[skptq]
|
||||
jshzzpmplk-yhiipa-zavyhnl-981[tluns]
|
||||
mvhkvbdib-agjrzm-yzqzgjkhzio-629[wcyms]
|
||||
yhwooebeaz-acc-paydjkhkcu-316[acehk]
|
||||
gzefmnxq-otaoaxmfq-emxqe-326[emqxa]
|
||||
frqvxphu-judgh-udeelw-pdqdjhphqw-335[orhsy]
|
||||
frqvxphu-judgh-gbh-uhfhlylqj-153[hufgj]
|
||||
cjpibabsepvt-cvooz-fohjoffsjoh-623[emnjh]
|
||||
yflexwxoalrp-zxkav-zlxqfkd-xkxivpfp-783[xfklp]
|
||||
froruixo-hjj-zrunvkrs-777[synml]
|
||||
jvuzbtly-nyhkl-jhukf-jvhapun-jvuahputlua-929[ndjmy]
|
||||
kwzzwaqdm-kivlg-kwibqvo-nqvivkqvo-460[yzmsr]
|
||||
ktiaaqnqml-zijjqb-apqxxqvo-798[qaijx]
|
||||
hqfxxnknji-hfsid-wjhjnansl-931[nhjfi]
|
||||
xjmmjndqz-wpiit-vxlpdndodji-941[dijmn]
|
||||
ksodcbwnsr-rms-cdsfohwcbg-896[xvuol]
|
||||
eza-dpncpe-tyepcyletzylw-nsznzwlep-nzyeltyxpye-847[xydvf]
|
||||
emixwvqhml-jiasmb-ivitgaqa-928[iamqv]
|
||||
etyyx-idkkxadzm-ehmzmbhmf-313[josnm]
|
||||
lhkhszqx-fqzcd-bgnbnkzsd-qdzbpthrhshnm-911[bqzra]
|
||||
dzczkrip-xiruv-upv-wzeretzex-945[icynm]
|
||||
wihmogyl-aluxy-mwupyhayl-bohn-lymyulwb-266[nuraz]
|
||||
kmjezxodgz-xcjxjgvoz-zibdizzmdib-239[yzkgs]
|
||||
hqfxxnknji-wfggny-hzxytrjw-xjwanhj-593[jnxhw]
|
||||
oknkvcta-itcfg-eqpuwogt-itcfg-ecpfa-eqcvkpi-ucngu-986[cgtef]
|
||||
ykhknbqh-oywrajcan-dqjp-qoan-paopejc-810[ondma]
|
||||
nwilwcejc-ywjzu-ykwpejc-naoawnyd-238[zjwsh]
|
||||
dzczkrip-xiruv-sleep-rercpjzj-451[wykfr]
|
||||
gpewwmjmih-nippcfier-qerekiqirx-178[ieprm]
|
||||
bqvvu-oywrajcan-dqjp-wjwhuoeo-420[jowaq]
|
||||
kzgwomvqk-xtiabqk-oziaa-bziqvqvo-148[qaiko]
|
||||
fab-eqodqf-eomhqzsqd-tgzf-fdmuzuzs-820[fqzde]
|
||||
lzfmdshb-dff-sqzhmhmf-755[fhmds]
|
||||
bpvctixr-gpqqxi-sthxvc-297[xcipq]
|
||||
xjgjmapg-kmjezxodgz-xcjxjgvoz-vivgtndn-915[jhigl]
|
||||
pbybeshy-qlr-bcrengvbaf-715[jwrxz]
|
||||
uqtqbizg-ozilm-kivlg-tijwzibwzg-902[lrepd]
|
||||
excdklvo-zbytomdsvo-zvkcdsm-qbkcc-crszzsxq-614[rpnqm]
|
||||
ucynmlgxcb-njyqrga-epyqq-kylyeckclr-418[yclqe]
|
||||
hqtyeqsjylu-sxesebqju-mehaixef-556[eqshj]
|
||||
chnylhuncihuf-wifilzof-jfumncw-alumm-uwkocmcncih-734[cufhi]
|
||||
wyvqljapsl-ihzrla-zhslz-669[ncmjb]
|
||||
jlidywncfy-wifilzof-vohhs-omyl-nymncha-578[yfhil]
|
||||
jfifqxov-doxab-bdd-abpfdk-913[dbfao]
|
||||
xjgjmapg-wpiit-gjbdnodxn-551[zvmhq]
|
||||
dkqjcbctfqwu-tcfkqcevkxg-ecpfa-eqcvkpi-tgegkxkpi-414[ckeqf]
|
||||
tmrszakd-idkkxadzm-lzmzfdldms-365[hwgsv]
|
||||
nglmtuex-vtgwr-vhtmbgz-mxvaghehzr-215[tsfmz]
|
||||
uiovmbqk-rmttgjmiv-bziqvqvo-252[vimqb]
|
||||
iehepwnu-cnwza-fahhuxawj-oanreyao-680[mavot]
|
||||
tvsnigxmpi-glsgspexi-gsrxemrqirx-100[xwqld]
|
||||
qcbgiasf-ufors-rms-aobousasbh-818[sabof]
|
||||
sgmtkzoi-hatte-xkykgxin-722[ktgix]
|
||||
nglmtuex-xzz-tvjnblbmbhg-787[kopjm]
|
||||
ikhcxvmbex-vtgwr-xgzbgxxkbgz-683[ncalt]
|
||||
tbxmlkfwba-molgbzqfib-zxkav-pbosfzbp-419[bfzak]
|
||||
gspsvjyp-fmsledevhsyw-tpewxmg-kveww-eguymwmxmsr-568[nihyt]
|
||||
gvcskirmg-gerhc-jmrergmrk-672[lrzta]
|
||||
xmrrq-uzgugdslw-jwsuimakalagf-502[agulm]
|
||||
shoewudys-hqrryj-tulubefcudj-530[ixkdy]
|
||||
mrxivrexmsrep-hci-wxsveki-230[miwqn]
|
||||
tmrszakd-bgnbnkzsd-otqbgzrhmf-599[qjfny]
|
||||
rwcnawjcrxwju-kdwwh-fxatbqxy-355[jezwy]
|
||||
hjgbwuladw-tmffq-ogjckzgh-528[gnlzr]
|
||||
lxuxaodu-lxwbdvna-pajmn-ajkkrc-dbna-cnbcrwp-511[umnsy]
|
||||
nsyjwsfyntsfq-idj-jslnsjjwnsl-619[ywpco]
|
||||
ubhatstkwhnl-ktuubm-mktbgbgz-761[btkug]
|
||||
lhkhszqx-fqzcd-bgnbnkzsd-dmfhmddqhmf-781[bdnsk]
|
||||
vehmsegxmzi-ikk-vieguymwmxmsr-854[pnkle]
|
||||
udskkaxawv-jsttal-esfsywewfl-528[sawef]
|
||||
jxdkbqfz-avb-cfkxkzfkd-887[kfbdx]
|
||||
jyddc-jpsaiv-gsrxemrqirx-386[rdijs]
|
||||
tagzsrsjvgmk-wyy-umklgewj-kwjnauw-606[wgjka]
|
||||
wyvqljapsl-ihzrla-huhsfzpz-409[znhcm]
|
||||
jvuzbtly-nyhkl-zjhclunly-obua-jbzavtly-zlycpjl-331[lyjzb]
|
||||
gvaaz-sbejpbdujwf-gmpxfs-vtfs-uftujoh-467[tsogk]
|
||||
aczupnetwp-nsznzwlep-cplnbftdtetzy-535[nptze]
|
||||
gifavtkzcv-vxx-jrcvj-815[vcjxa]
|
||||
ytu-xjhwjy-uqfxynh-lwfxx-uzwhmfxnsl-255[yzalu]
|
||||
eqttqukxg-ecpfa-eqcvkpi-cpcnauku-440[zotsy]
|
||||
ncjzrpytn-nlyoj-nzletyr-nzyeltyxpye-639[zhytj]
|
||||
bgmxkgtmbhgte-lvtoxgzxk-angm-phkdlahi-605[nyzfq]
|
||||
ytu-xjhwjy-xhfajsljw-mzsy-qfgtwfytwd-801[rewpl]
|
||||
gpsxdprixkt-rwdrdapit-prfjxhxixdc-349[qrskt]
|
||||
ojk-nzxmzo-kgvnodx-bmvnn-hvivbzhzio-629[cvkyu]
|
||||
ktwbhtvmbox-unggr-ybgtgvbgz-267[nbjvs]
|
||||
wdjcvuvmyjpn-nxvqzibzm-cpio-kpmxcvndib-109[tndsr]
|
||||
froruixo-gbh-zrunvkrs-439[roubf]
|
||||
oazegyqd-sdmpq-otaoaxmfq-fdmuzuzs-352[admoq]
|
||||
fruurvlyh-fdqgb-sxufkdvlqj-699[mynfj]
|
||||
votubcmf-qmbtujd-hsbtt-efqmpznfou-441[wznfd]
|
||||
emixwvqhml-akidmvomz-pcvb-abwziom-928[gwxum]
|
||||
qcbgiasf-ufors-foppwh-sbuwbssfwbu-506[sbfuw]
|
||||
mrxivrexmsrep-fyrrc-pskmwxmgw-100[pmxwc]
|
||||
nsyjwsfyntsfq-uqfxynh-lwfxx-uzwhmfxnsl-125[bwtze]
|
||||
kwtwznct-kpwkwtibm-nqvivkqvo-928[kwtvi]
|
||||
lahxpnwrl-ouxfna-vjwjpnvnwc-953[nwajl]
|
||||
ydjuhdqjyedqb-hqrryj-ixyffydw-114[cwzyi]
|
||||
rgndvtcxr-snt-igpxcxcv-661[uqvtr]
|
||||
bgmxkgtmbhgte-pxtihgbsxw-vahvhetmx-tvjnblbmbhg-371[bghtm]
|
||||
pwcvonofrcig-tzcksf-fsoqeiwgwhwcb-428[swzyd]
|
||||
yaxsnlcrun-ajkkrc-bqryyrwp-641[ycnxl]
|
||||
jef-iushuj-hqrryj-bqrehqjeho-738[zaytn]
|
||||
bdavqofuxq-bxmefuo-sdmee-xmnadmfadk-352[dmaef]
|
||||
qcffcgwjs-qobrm-rsdzcmasbh-350[mezyn]
|
||||
jxdkbqfz-yxphbq-tlohpelm-289[wfvbo]
|
||||
hdgdovmt-bmvyz-wvnfzo-yzndbi-915[dvzbm]
|
||||
hqcfqwydw-sxesebqju-vydqdsydw-712[smhbn]
|
||||
qfmcusbwq-qobrm-qcohwbu-zcuwghwqg-636[qwbcu]
|
||||
jvsvymbs-msvdly-jvuahputlua-955[vsuaj]
|
||||
hqcfqwydw-rkddo-huiuqhsx-218[dhquw]
|
||||
shoewudys-uww-jhqydydw-816[jysaf]
|
||||
dyz-combod-zvkcdsm-qbkcc-dbksxsxq-562[cdbks]
|
||||
tcrjjzwzvu-treup-tfrkzex-rercpjzj-217[fewxh]
|
||||
pynffvsvrq-cynfgvp-tenff-grpuabybtl-481[fnpvy]
|
||||
yhtwhnpun-jyfvnlupj-wshzapj-nyhzz-huhsfzpz-773[zyogh]
|
||||
bnqqnrhud-bzmcx-lzqjdshmf-443[jmvdf]
|
||||
yrwxefpi-glsgspexi-hitevxqirx-282[bzvyj]
|
||||
iuxxuyobk-hgyqkz-zkinturume-540[ukixy]
|
||||
gpsxdprixkt-rpcsn-prfjxhxixdc-271[ewstq]
|
||||
vrurcjah-pajmn-ouxfna-anlnrerwp-615[qsfhg]
|
||||
mrxivrexmsrep-tpewxmg-kveww-hiwmkr-854[votlz]
|
||||
irgyyolokj-ixeumktoi-jek-rghuxgzuxe-904[egiko]
|
||||
dsxxw-zyqicr-pcacgtgle-912[swjtv]
|
||||
yhkpvhjapcl-kfl-ylhjxbpzpapvu-955[phlaj]
|
||||
gsrwyqiv-kvehi-tpewxmg-kveww-hitevxqirx-724[mnsyt]
|
||||
muqfedyput-rkddo-vydqdsydw-998[mlqhr]
|
||||
ykhknbqh-ywjzu-iwngapejc-628[hjknw]
|
||||
uwtojhynqj-gzssd-ywfnsnsl-619[snjwy]
|
||||
emixwvqhml-kpwkwtibm-zmkmqdqvo-148[mkqwi]
|
||||
upv-uvjzxe-347[uvejp]
|
||||
cqwdujys-ryexqpqhteki-rkddo-skijecuh-iuhlysu-738[uyvln]
|
||||
fydelmwp-nsznzwlep-dezclrp-379[elpzd]
|
||||
yknnkoera-fahhuxawj-wymqeoepekj-914[kwucf]
|
||||
hwbba-vqr-ugetgv-lgnnadgcp-ugtxkegu-908[guabe]
|
||||
xqvwdeoh-ixccb-udeelw-fxvwrphu-vhuylfh-803[heuvw]
|
||||
xekdwvwnzkqo-acc-iwjwcaiajp-784[mswzt]
|
||||
rdchjbtg-vgpst-qphzti-jhtg-ithixcv-609[thgic]
|
||||
cqwdujys-vbemuh-iqbui-608[ubiqc]
|
||||
htsxzrjw-lwfij-gfxpjy-rfsfljrjsy-489[jfrsl]
|
||||
rtqlgevkng-dcumgv-wugt-vguvkpi-362[gvukt]
|
||||
oxaflxzqfsb-mixpqfz-doxpp-zrpqljbo-pbosfzb-185[pbfox]
|
||||
lqwhuqdwlrqdo-hjj-sxufkdvlqj-569[qdjlh]
|
||||
wihmogyl-aluxy-wuhxs-wiuncha-nywbhifias-994[ztysn]
|
||||
hwbba-oknkvcta-itcfg-dwppa-tgugctej-492[tacgb]
|
||||
mybbycsfo-oqq-wkxkqowoxd-120[oqbkw]
|
||||
tyepcyletzylw-dnlgpyrpc-sfye-xlcvpetyr-249[xawqz]
|
||||
hjgbwuladw-tmffq-ugflsafewfl-684[flwag]
|
||||
sbnqbhjoh-kfmmzcfbo-bobmztjt-493[jnism]
|
||||
ykjoqian-cnwza-lhwopey-cnwoo-zarahkliajp-602[ihrlb]
|
||||
pynffvsvrq-fpniratre-uhag-erfrnepu-585[kwurl]
|
||||
vetllbybxw-utldxm-mxvaghehzr-787[lxbeh]
|
||||
ktfitzbgz-lvtoxgzxk-angm-nlxk-mxlmbgz-787[gxzkl]
|
||||
emixwvqhml-rmttgjmiv-tijwzibwzg-876[tszyl]
|
||||
esyfwlau-udskkaxawv-hdsklau-yjskk-ksdwk-658[ksadu]
|
||||
jsvagsulanw-tskcwl-jwuwanafy-216[oklsn]
|
||||
wfummczcyx-mwupyhayl-bohn-xymcah-552[xcazi]
|
||||
tbxmlkfwba-oxyyfq-xkxivpfp-705[xfbkp]
|
||||
ytu-xjhwjy-rflsjynh-uqfxynh-lwfxx-ijuqtdrjsy-853[ztoub]
|
||||
cvabijtm-jiasmb-tijwzibwzg-564[qatln]
|
||||
jef-iushuj-uww-ixyffydw-816[ptbea]
|
||||
zntargvp-fpniratre-uhag-svanapvat-715[dnmgz]
|
||||
mvydjvxodqz-zbb-jkzmvodjin-343[fxmnr]
|
||||
xlrypetn-nlyoj-dlwpd-873[ldnpy]
|
||||
jrncbavmrq-pnaql-pbngvat-ybtvfgvpf-117[hgwjo]
|
||||
guahyncw-dyffsvyuh-uhufsmcm-786[ufhyc]
|
||||
ide-htrgti-rpcsn-rdpixcv-igpxcxcv-115[ciprx]
|
||||
nwilwcejc-ydkykhwpa-qoan-paopejc-628[acpwe]
|
||||
udpsdjlqj-sodvwlf-judvv-oderudwrub-673[dujvl]
|
||||
xekdwvwnzkqo-lhwopey-cnwoo-zarahkliajp-966[zdklq]
|
||||
ixccb-iorzhu-xvhu-whvwlqj-803[emzxn]
|
||||
gpbepvxcv-gpqqxi-prfjxhxixdc-297[utzsx]
|
||||
zntargvp-wryylorna-fuvccvat-871[dxepl]
|
||||
jvyyvzpcl-ipvohghykvbz-yhiipa-yljlpcpun-149[aupdo]
|
||||
lzfmdshb-okzrshb-fqzrr-lzmzfdldms-651[ndpcm]
|
||||
krxqjijamxdb-bljenwpna-qdwc-mnyuxhvnwc-381[njwxa]
|
||||
apuut-xviyt-yzkvmohzio-395[iotuv]
|
||||
rzvkjiduzy-kgvnodx-bmvnn-mzxzdqdib-187[tayqb]
|
||||
pkl-oaynap-xwogap-owhao-888[zlbay]
|
||||
ynukcajey-nwxxep-paydjkhkcu-394[kyace]
|
||||
fnjyxwrinm-ouxfna-mnbrpw-771[nfmrw]
|
||||
lejkrscv-tfcfiwlc-irsszk-nfibjyfg-399[fcisj]
|
||||
dwbcjkun-ljwmh-anlnrerwp-589[nwjlr]
|
||||
hdgdovmt-bmvyz-ojk-nzxmzo-wpiit-omvdidib-291[nmqdz]
|
||||
nwzekwypera-xwogap-hwxknwpknu-810[wknpa]
|
||||
htwwtxnaj-ojqqdgjfs-wjxjfwhm-567[jwfhq]
|
||||
ynukcajey-zua-lqnydwoejc-420[xqrgw]
|
||||
pelbtravp-cynfgvp-tenff-npdhvfvgvba-559[vfpna]
|
||||
ibghopzs-foppwh-aobousasbh-142[ranfu]
|
||||
qxdwpopgsdjh-tvv-rdcipxcbtci-713[wscpi]
|
||||
vkppo-sbqiiyvyut-vbemuh-husuylydw-452[uyvbh]
|
||||
lqwhuqdwlrqdo-vfdyhqjhu-kxqw-orjlvwlfv-699[qlwdh]
|
||||
tcrjjzwzvu-gcrjkzt-xirjj-vexzevvizex-113[gusom]
|
||||
wsvsdkbi-qbkno-lexxi-kmaescsdsyx-614[mnoyt]
|
||||
kmjezxodgz-xviyt-xjvodib-jkzmvodjin-681[jdiov]
|
||||
kgjgrypw-epybc-kyelcrga-njyqrga-epyqq-asqrmkcp-qcptgac-990[cgpqy]
|
||||
tagzsrsjvgmk-hdsklau-yjskk-xafsfuafy-736[sakfg]
|
||||
iwcjapey-xqjju-wymqeoepekj-472[wshmz]
|
||||
ckgvutofkj-xghhoz-zxgototm-618[dapcq]
|
||||
excdklvo-bkllsd-zebmrkcsxq-692[sdyzv]
|
||||
ugdgjxmd-jsttal-ogjckzgh-320[nxksp]
|
||||
dmbttjgjfe-gmpxfs-fohjoffsjoh-675[emswj]
|
||||
esyfwlau-wyy-kwjnauwk-762[zfkst]
|
||||
htsxzrjw-lwfij-gzssd-xytwflj-359[jswfl]
|
||||
bnmrtldq-fqzcd-bzmcx-bnzshmf-cdozqsldms-157[rchap]
|
||||
enqvbnpgvir-wryylorna-hfre-grfgvat-247[rgnva]
|
||||
rzvkjiduzy-mvwwdo-hvivbzhzio-629[vzidh]
|
||||
rgllk-omzpk-ymzmsqyqzf-742[ytshk]
|
||||
wyvqljapsl-kfl-shivyhavyf-175[lvyaf]
|
||||
zloolpfsb-molgbzqfib-oxyyfq-absbilmjbkq-731[rdypn]
|
||||
wlqqp-srjbvk-glityrjzex-399[jlqrb]
|
||||
foadouwbu-qvcqczohs-hsqvbczcum-402[coqub]
|
||||
gsrwyqiv-kvehi-wgezirkiv-lyrx-wlmttmrk-334[dxqri]
|
||||
apwmeclga-afmamjyrc-amlryglkclr-470[dvjwq]
|
||||
amjmpdsj-aylbw-amyrgle-bcqgel-756[fmsjn]
|
||||
pbybeshy-sybjre-ynobengbel-507[beyns]
|
||||
jchipqat-rpcsn-hwxeexcv-505[yozns]
|
||||
excdklvo-nio-bomosfsxq-458[bhmlt]
|
||||
oaxadrgx-ngzzk-ymzmsqyqzf-534[eqjfa]
|
||||
ajyqqgdgcb-zsllw-umpiqfmn-262[sdmlk]
|
||||
wkqxodsm-lexxi-cobfsmoc-510[tpnbi]
|
||||
tcfkqcevkxg-ecpfa-eqcvkpi-octmgvkpi-986[ckepv]
|
||||
pbybeshy-onfxrg-qrcyblzrag-845[bryga]
|
||||
rdggdhxkt-hrpktcvtg-wjci-gtrtxkxcv-479[tgckr]
|
||||
willimcpy-jfumncw-alumm-lywycpcha-500[utskn]
|
||||
qyujihctyx-luxciuwncpy-yaa-mbcjjcha-942[tzusp]
|
||||
pelbtravp-pnaql-fgbentr-585[pabel]
|
||||
jef-iushuj-vbemuh-tuiywd-140[jvndh]
|
||||
rwcnawjcrxwju-kjbtnc-mnyuxhvnwc-355[cnwjr]
|
||||
dszphfojd-tdbwfohfs-ivou-ufdiopmphz-285[dfohp]
|
||||
uqtqbizg-ozilm-kivlg-kwibqvo-ewzsapwx-538[iqwzb]
|
||||
njmjubsz-hsbef-cbtlfu-bobmztjt-649[dtsjy]
|
||||
zlilocri-zxkav-zlxqfkd-pefmmfkd-887[zijtp]
|
||||
iwcjapey-ydkykhwpa-oanreyao-576[jfnpy]
|
||||
pybgmyargtc-zgmfyxypbmsq-zyqicr-mncpyrgmlq-600[gzfir]
|
||||
houngfgxjuay-yigbktmkx-natz-ygrky-228[gykan]
|
||||
lnkfaypeha-zua-odellejc-680[gmnlj]
|
||||
vhglnfxk-zktwx-cxeeruxtg-kxlxtkva-319[xkteg]
|
||||
wfintfhynaj-gzssd-qfgtwfytwd-541[mztfn]
|
||||
amlqskcp-epybc-aylbw-nspafyqgle-886[alpyb]
|
||||
iuruxlar-pkrrehkgt-ygrky-774[tsflj]
|
||||
xtwtelcj-rclop-clmmte-opgpwzaxpye-145[tskxr]
|
||||
bqvvu-ywjzu-ykwpejc-hwxknwpknu-862[wkujn]
|
||||
enqvbnpgvir-zntargvp-cynfgvp-tenff-ybtvfgvpf-585[vfngp]
|
||||
rzvkjiduzy-xviyt-xjvodib-xjiovdihzio-967[pjzrk]
|
||||
njmjubsz-hsbef-sbnqbhjoh-cvooz-pqfsbujpot-623[bjosh]
|
||||
zixppfcfba-mixpqfz-doxpp-zlkqxfkjbkq-653[pfxkq]
|
||||
hdgdovmt-bmvyz-kgvnodx-bmvnn-rjmfncjk-239[rpovu]
|
||||
hdgdovmt-bmvyz-xviyt-yzndbi-109[pdslu]
|
||||
xjinphzm-bmvyz-kgvnodx-bmvnn-vivgtndn-525[nvmbd]
|
||||
eqnqthwn-eqttqukxg-hnqygt-rwtejcukpi-544[qteng]
|
||||
zvyvgnel-tenqr-sybjre-grpuabybtl-793[lyfvq]
|
||||
tcorcikpi-ecpfa-eqcvkpi-ugtxkegu-596[teibn]
|
||||
nwzekwypera-fahhuxawj-lqnydwoejc-810[mszph]
|
||||
mhi-lxvkxm-cxeeruxtg-kxvxbobgz-605[palbn]
|
||||
wfummczcyx-jlidywncfy-vumeyn-mylpcwym-838[ijqrb]
|
||||
fhezusjybu-zubboruqd-cqdqwucudj-374[ubdqc]
|
||||
kgjgrypw-epybc-aylbw-amyrgle-qcptgacq-314[mjlic]
|
||||
tcfkqcevkxg-dwppa-ucngu-362[trzmu]
|
||||
oazegyqd-sdmpq-gzefmnxq-eomhqzsqd-tgzf-qzsuzqqduzs-560[dmrkq]
|
||||
jlidywncfy-vohhs-xypyfijgyhn-110[yhfij]
|
||||
ftzgxmbv-lvtoxgzxk-angm-hixktmbhgl-163[gxmtb]
|
||||
xgjougizobk-vrgyzoi-mxgyy-cuxqynuv-644[yntxg]
|
||||
yknnkoera-lhwopey-cnwoo-odellejc-524[qypjt]
|
||||
eza-dpncpe-upwwjmply-zapcletzyd-769[pezac]
|
||||
cvabijtm-ntwemz-zmikycqaqbqwv-564[mqabc]
|
||||
irgyyolokj-kmm-rghuxgzuxe-410[gkmor]
|
||||
ahngzyzqcntr-idkkxadzm-sdbgmnknfx-807[ndkza]
|
||||
surmhfwloh-fkrfrodwh-pdqdjhphqw-829[myflz]
|
||||
elrkdcdugrxv-edvnhw-xvhu-whvwlqj-387[mhtue]
|
||||
sbejpbdujwf-xfbqpojafe-ezf-mphjtujdt-155[tqslv]
|
||||
shoewudys-rkddo-tuiywd-686[sntpq]
|
||||
qcffcgwjs-dzoghwq-ufogg-igsf-hsghwbu-350[psevy]
|
||||
ibghopzs-qobrm-qcohwbu-zopcfohcfm-740[obchf]
|
||||
atyzghrk-vrgyzoi-mxgyy-sgtgmksktz-150[tjpiv]
|
||||
luxciuwncpy-dyffsvyuh-nluchcha-994[cuhyf]
|
||||
vcibutulxiom-xsy-uwkocmcncih-214[ciumo]
|
||||
vkppo-rkddo-cqdqwucudj-140[dckop]
|
||||
ftzgxmbv-vtgwr-kxlxtkva-163[tvxgk]
|
||||
jlidywncfy-vumeyn-womnigyl-mylpcwy-682[ylmnw]
|
||||
mtzslklcozfd-nlyoj-nzletyr-qtylyntyr-639[xswlz]
|
||||
ixccb-fkrfrodwh-fxvwrphu-vhuylfh-283[fhrcu]
|
||||
ykjoqian-cnwza-oywrajcan-dqjp-qoan-paopejc-212[tsrfk]
|
||||
yhkpvhjapcl-yhiipa-jbzavtly-zlycpjl-617[ftaes]
|
||||
qmpmxevc-kvehi-wgezirkiv-lyrx-xvemrmrk-516[emrvi]
|
||||
fmsledevhsyw-veffmx-wivzmgiw-204[efmvw]
|
||||
zlkprjbo-doxab-zxkav-zlxqfkd-obxznrfpfqflk-237[rqgnd]
|
||||
ksodcbwnsr-qobrm-qcohwbu-aobousasbh-142[bosac]
|
||||
yrwxefpi-glsgspexi-qevoixmrk-828[atyoc]
|
||||
dlhwvupglk-wshzapj-nyhzz-klzpnu-877[fbewu]
|
||||
bjfutsneji-idj-hzxytrjw-xjwanhj-359[wyrxt]
|
||||
zsxyfgqj-bjfutsneji-hfsid-htfynsl-zxjw-yjxynsl-229[jsfyn]
|
||||
pualyuhapvuhs-ibuuf-klwsvftlua-643[ualfh]
|
||||
yknnkoera-ydkykhwpa-klanwpekjo-420[kanye]
|
||||
iehepwnu-cnwza-ydkykhwpa-zaoecj-420[pozyv]
|
||||
ftzgxmbv-ktuubm-mxvaghehzr-605[mbght]
|
||||
gntmfefwitzx-xhfajsljw-mzsy-ywfnsnsl-983[woefn]
|
||||
xmtjbzidx-wpiit-ncdkkdib-863[idbkt]
|
||||
ktiaaqnqml-uqtqbizg-ozilm-kpwkwtibm-ivitgaqa-850[ywdzl]
|
||||
dyz-combod-sxdobxkdsyxkv-mkxni-wkxkqowoxd-224[isamh]
|
||||
nsyjwsfyntsfq-rnqnyfwd-lwfij-kqtbjw-uzwhmfxnsl-151[roxtn]
|
||||
ykjoqian-cnwza-xqjju-nayaerejc-524[yvwax]
|
||||
ixccb-iorzhu-ilqdqflqj-569[fcjsy]
|
||||
ovbunmneqbhf-ohaal-qrfvta-819[abfhn]
|
||||
glrcplyrgmlyj-zyqicr-pcyaosgqgrgml-626[glryc]
|
||||
ajyqqgdgcb-bwc-ylyjwqgq-262[qgybc]
|
||||
fhezusjybu-rkddo-bewyijysi-608[ybdei]
|
||||
aflwjfslagfsd-kusnwfywj-zmfl-xafsfuafy-632[wltdc]
|
||||
iuxxuyobk-lruckx-vaxingyotm-644[xuiko]
|
||||
jyfvnlupj-kfl-thyrlapun-773[lfjnp]
|
||||
eqpuwogt-itcfg-tcfkqcevkxg-dcumgv-qrgtcvkqpu-934[ionzm]
|
||||
hqcfqwydw-sqdto-seqjydw-bqrehqjeho-998[qdehw]
|
||||
xst-wigvix-ikk-wivzmgiw-724[rtszg]
|
||||
tinnm-pibbm-zcuwghwqg-766[mfgbn]
|
||||
vkppo-rqiauj-cqdqwucudj-348[qucdj]
|
||||
bnmrtldq-fqzcd-ahngzyzqcntr-atmmx-dmfhmddqhmf-989[mdqfh]
|
||||
vkrhzxgbv-unggr-tgterlbl-319[tsrkm]
|
||||
wihmogyl-aluxy-wuhxs-uhufsmcm-526[uhmls]
|
||||
nzydfxpc-rclop-awldetn-rcldd-pyrtyppctyr-951[pcdry]
|
||||
egdytrixat-eaphixr-vgphh-pcpanhxh-921[hpaxe]
|
||||
nwzekwypera-lhwopey-cnwoo-hkceopeyo-654[eowpy]
|
||||
zovldbkfz-zlkprjbo-doxab-zxkav-ixyloxqlov-367[olxzb]
|
||||
lgh-kwujwl-xmrrq-kusnwfywj-zmfl-hmjuzskafy-372[gmait]
|
||||
ipvohghykvbz-jhukf-ylzlhyjo-357[awkcb]
|
||||
dmybmsuzs-otaoaxmfq-dqmocgueufuaz-976[muaod]
|
||||
zbytomdsvo-bkllsd-cdybkqo-796[eufzt]
|
||||
sbqiiyvyut-fbqijys-whqii-iqbui-998[ebfqa]
|
||||
qyujihctyx-wbiwifuny-guleyncha-838[ejitg]
|
||||
ikhcxvmbex-unggr-kxvxbobgz-683[ejuzo]
|
||||
hafgnoyr-ohaal-jbexfubc-923[bjmzn]
|
||||
shmml-wryylorna-genvavat-455[almnr]
|
||||
yknnkoera-xqjju-klanwpekjo-420[empdo]
|
||||
upq-tfdsfu-kfmmzcfbo-efwfmpqnfou-415[nmfed]
|
||||
xcitgcpixdcpa-rdchjbtg-vgpst-hrpktcvtg-wjci-stepgibtci-557[ctgip]
|
||||
fydelmwp-nsznzwlep-opgpwzaxpye-769[pewzl]
|
||||
glrcplyrgmlyj-cee-pcqcypaf-548[ymzlj]
|
||||
xmtjbzidx-wpiit-xjiovdihzio-265[ztyda]
|
||||
rwcnawjcrxwju-ljwmh-mnbrpw-901[wjrcm]
|
||||
wlqqp-tyftfcrkv-ivtvzmzex-841[tvfqz]
|
||||
thnulapj-wshzapj-nyhzz-zopwwpun-669[pzhnw]
|
||||
bpvctixr-rdggdhxkt-hrpktcvtg-wjci-pcpanhxh-401[chptg]
|
||||
eza-dpncpe-awldetn-rcldd-dlwpd-743[delpa]
|
||||
pbybeshy-sybjre-npdhvfvgvba-299[bvyeh]
|
||||
qmpmxevc-kvehi-jpsaiv-viwievgl-802[viemp]
|
||||
jrncbavmrq-pnaql-pbngvat-qrcyblzrag-715[arbnq]
|
||||
ugjjgkanw-wyy-kzahhafy-736[clxvm]
|
||||
mwupyhayl-bohn-nluchcha-682[hacln]
|
||||
qjopwxha-xwogap-ykjpwejiajp-108[jpawo]
|
||||
avw-zljyla-jhukf-huhsfzpz-175[hzafj]
|
||||
lzfmdshb-okzrshb-fqzrr-cdoknxldms-573[olwsf]
|
||||
cqwdujys-sbqiiyvyut-uww-iuhlysui-426[cwfuy]
|
||||
yaxsnlcrun-ljwmh-bqryyrwp-901[rylnw]
|
||||
cebwrpgvyr-pelbtravp-enoovg-znantrzrag-455[raegn]
|
||||
nbhofujd-qmbtujd-hsbtt-efwfmpqnfou-389[fbtud]
|
||||
pynffvsvrq-pnaql-pbngvat-ynobengbel-507[nmyvz]
|
||||
ltpedcxots-gpqqxi-ldgzhwde-739[bkapm]
|
||||
nglmtuex-vahvhetmx-wxiehrfxgm-527[zwksp]
|
||||
kgjgrypw-epybc-aylbw-amyrgle-qyjcq-626[ygabc]
|
||||
yflexwxoalrp-avb-abmilvjbkq-445[siqmz]
|
||||
jshzzpmplk-kfl-klclsvwtlua-331[lkpsz]
|
||||
ujoon-eaphixr-vgphh-prfjxhxixdc-193[hyzjx]
|
||||
dfcxsqhwzs-qobrm-zcuwghwqg-168[qwcgh]
|
||||
bqvvu-ydkykhwpa-klanwpekjo-966[kapvw]
|
||||
aoubshwq-pibbm-kcfygvcd-740[wnucy]
|
108
2016/day04/main.go
Normal file
108
2016/day04/main.go
Normal file
@@ -0,0 +1,108 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const (
|
||||
locChecksum = iota
|
||||
locSector
|
||||
locName
|
||||
)
|
||||
|
||||
func main() {
|
||||
input := stdinToStringSlice()
|
||||
var sectorTotal int
|
||||
for _, h := range input {
|
||||
var chksum, sector, name string
|
||||
var loc int
|
||||
freq := make(map[rune]int)
|
||||
for i := len(h) - 1; i >= 0; i-- {
|
||||
switch h[i] {
|
||||
case ']': // start reading checksum
|
||||
loc = locChecksum
|
||||
case '[': // start reading sector
|
||||
loc = locSector
|
||||
case '-':
|
||||
if loc == locSector { // done with sector
|
||||
loc = locName
|
||||
}
|
||||
default:
|
||||
switch loc {
|
||||
case locChecksum:
|
||||
chksum = string(h[i]) + chksum
|
||||
case locSector:
|
||||
sector = string(h[i]) + sector
|
||||
case locName:
|
||||
name = string(h[i]) + name
|
||||
freq[rune(h[i])]++
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt.Println(decryptName(name, atoi(sector)), " :: ", sector)
|
||||
var top rune
|
||||
var realChecksum string
|
||||
for i := 0; i < 5; i++ {
|
||||
top, freq = findTop(freq)
|
||||
realChecksum = realChecksum + string(top)
|
||||
}
|
||||
if realChecksum == chksum {
|
||||
sectorTotal += atoi(sector)
|
||||
}
|
||||
}
|
||||
fmt.Println("Sector Total: " + itoa(sectorTotal))
|
||||
|
||||
}
|
||||
|
||||
func decryptName(name string, rot int) string {
|
||||
var decName string
|
||||
for _, v := range name {
|
||||
for k := 0; k < rot; k++ {
|
||||
v++
|
||||
if v == ('z' + 1) {
|
||||
v = 'a'
|
||||
}
|
||||
}
|
||||
decName = decName + string(v)
|
||||
}
|
||||
return decName
|
||||
}
|
||||
|
||||
func findTop(inp map[rune]int) (rune, map[rune]int) {
|
||||
var topCnt int
|
||||
var topVal rune
|
||||
for k, v := range inp {
|
||||
if v > topCnt || (v == topCnt && k < topVal) {
|
||||
topCnt = v
|
||||
topVal = k
|
||||
}
|
||||
}
|
||||
delete(inp, topVal)
|
||||
return topVal, inp
|
||||
}
|
||||
|
||||
func stdinToStringSlice() []string {
|
||||
var input []string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input = append(input, scanner.Text())
|
||||
}
|
||||
return input
|
||||
}
|
||||
|
||||
func itoa(i int) string {
|
||||
return strconv.Itoa(i)
|
||||
}
|
||||
|
||||
func atoi(i string) int {
|
||||
var ret int
|
||||
var err error
|
||||
if ret, err = strconv.Atoi(i); err != nil {
|
||||
log.Fatal("Invalid Atoi")
|
||||
}
|
||||
return ret
|
||||
}
|
69
2016/day04/problem
Normal file
69
2016/day04/problem
Normal file
@@ -0,0 +1,69 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 4: Security Through Obscurity ---
|
||||
|
||||
Finally, you come across an information kiosk with a list of rooms. Of course, the list is
|
||||
encrypted and full of decoy data, but the instructions to decode the list are barely hidden
|
||||
nearby. Better remove the decoy data first.
|
||||
|
||||
Each room consists of an encrypted name (lowercase letters separated by dashes) followed by a
|
||||
dash, a sector ID, and a checksum in square brackets.
|
||||
|
||||
A room is real (not a decoy) if the checksum is the five most common letters in the encrypted
|
||||
name, in order, with ties broken by alphabetization. For example:
|
||||
|
||||
• aaaaa-bbb-z-y-x-123[abxyz] is a real room because the most common letters are a (5), b
|
||||
(3), and then a tie between x, y, and z, which are listed alphabetically.
|
||||
• a-b-c-d-e-f-g-h-987[abcde] is a real room because although the letters are all tied (1 of
|
||||
each), the first five are listed alphabetically.
|
||||
• not-a-real-room-404[oarel] is a real room.
|
||||
• totally-real-room-200[decoy] is not.
|
||||
|
||||
Of the real rooms from the list above, the sum of their sector IDs is 1514.
|
||||
|
||||
What is the sum of the sector IDs of the real rooms?
|
||||
|
||||
Your puzzle answer was ___________.
|
||||
|
||||
The first half of this puzzle is complete! It provides one gold star: *
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
With all the decoy data out of the way, it's time to decrypt this list and get moving.
|
||||
|
||||
The room names are encrypted by a state-of-the-art shift cipher, which is nearly unbreakable
|
||||
without the right software. However, the information kiosk designers at Easter Bunny HQ were
|
||||
not expecting to deal with a master cryptographer like yourself.
|
||||
|
||||
To decrypt a room name, rotate each letter forward through the alphabet a number of times
|
||||
equal to the room's sector ID. A becomes B, B becomes C, Z becomes A, and so on. Dashes become
|
||||
spaces.
|
||||
|
||||
For example, the real name for qzmt-zixmtkozy-ivhz-343 is very encrypted name.
|
||||
|
||||
What is the sector ID of the room where North Pole objects are stored?
|
||||
|
||||
Although it hasn't changed, you can still get your puzzle input.
|
||||
|
||||
Answer: _____________________ [ [Submit] ]
|
||||
|
||||
You can also [Shareon Twitter Google+ Reddit] this puzzle.
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://www.novetta.com/careers/#opportunities
|
||||
. https://en.wikipedia.org/wiki/Caesar_cipher
|
||||
. http://adventofcode.com/2016/day/4/input
|
1
2016/day05/input
Normal file
1
2016/day05/input
Normal file
@@ -0,0 +1 @@
|
||||
ojvtpuvg
|
118
2016/day05/main.go
Normal file
118
2016/day05/main.go
Normal file
@@ -0,0 +1,118 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
input := stdinToString()
|
||||
partOne(input)
|
||||
partTwo(input)
|
||||
}
|
||||
|
||||
func partOne(input string) {
|
||||
complete := false
|
||||
idx := 1
|
||||
password := ""
|
||||
for !complete {
|
||||
if idx%1000000 == 0 {
|
||||
fmt.Print("O")
|
||||
} else if idx%100000 == 0 {
|
||||
fmt.Print(".")
|
||||
}
|
||||
sum := fmt.Sprintf("%x", md5.Sum([]byte(input+itoa(idx))))
|
||||
if strings.HasPrefix(sum, "00000") {
|
||||
fmt.Println("d")
|
||||
fmt.Println(itoa(idx))
|
||||
password += string(sum[5])
|
||||
}
|
||||
idx++
|
||||
if len(password) == 8 {
|
||||
complete = true
|
||||
}
|
||||
}
|
||||
fmt.Println("")
|
||||
fmt.Println(password)
|
||||
}
|
||||
|
||||
func partTwo(input string) {
|
||||
fmt.Println("Cracking the Password, hold on to your butts: ")
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
complete := false
|
||||
idx := 1469580
|
||||
password := []byte{0, 0, 0, 0, 0, 0, 0, 0}
|
||||
printPassword(password)
|
||||
fnd := 0
|
||||
for !complete {
|
||||
sum := fmt.Sprintf("%x", md5.Sum([]byte(input+itoa(idx))))
|
||||
if strings.HasPrefix(sum, "00000") {
|
||||
pos, err := strconv.Atoi(string(sum[5]))
|
||||
if err == nil && pos < 8 && password[pos] == 0 {
|
||||
password[pos] = sum[6]
|
||||
fnd++
|
||||
if fnd == 8 {
|
||||
complete = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if idx%100000 == 0 {
|
||||
clearPassword()
|
||||
printPassword(password)
|
||||
}
|
||||
idx++
|
||||
}
|
||||
clearPassword()
|
||||
printPassword(password)
|
||||
fmt.Println("")
|
||||
fmt.Println("!~CRACK'D~!")
|
||||
}
|
||||
|
||||
func clearPassword() {
|
||||
fmt.Print("")
|
||||
}
|
||||
|
||||
func printPassword(pw []byte) {
|
||||
for i := 0; i < len(pw); i++ {
|
||||
if pw[i] == 0 {
|
||||
// Print random char
|
||||
rndBt := byte(97 + rand.Intn(122-97))
|
||||
if rndBt%3 == 0 {
|
||||
fmt.Print(itoa(int(rndBt % 10)))
|
||||
} else {
|
||||
fmt.Print(string(byte(97 + rand.Intn(122-97))))
|
||||
}
|
||||
} else {
|
||||
fmt.Print(string(pw[i]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func stdinToString() string {
|
||||
var input string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input = input + scanner.Text()
|
||||
}
|
||||
return input
|
||||
}
|
||||
|
||||
func itoa(i int) string {
|
||||
return strconv.Itoa(i)
|
||||
}
|
||||
|
||||
func atoi(i string) int {
|
||||
var ret int
|
||||
var err error
|
||||
if ret, err = strconv.Atoi(i); err != nil {
|
||||
log.Fatal("Invalid Atoi")
|
||||
}
|
||||
return ret
|
||||
}
|
71
2016/day05/problem
Normal file
71
2016/day05/problem
Normal file
@@ -0,0 +1,71 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 5: How About a Nice Game of Chess? ---
|
||||
|
||||
You are faced with a security door designed by Easter Bunny engineers that seem to have acquired most of their security knowledge by watching hacking movies.
|
||||
|
||||
The eight-character password for the door is generated one character at a time by finding the MD5 hash of some Door ID (your puzzle input) and an increasing integer
|
||||
index (starting with 0).
|
||||
|
||||
A hash indicates the next character in the password if its hexadecimal representation starts with five zeroes. If it does, the sixth character in the hash is the next
|
||||
character of the password.
|
||||
|
||||
For example, if the Door ID is abc:
|
||||
|
||||
• The first index which produces a hash that starts with five zeroes is 3231929, which we find by hashing abc3231929; the sixth character of the hash, and thus the
|
||||
first character of the password, is 1.
|
||||
• 5017308 produces the next interesting hash, which starts with 000008f82..., so the second character of the password is 8.
|
||||
• The third time a hash starts with five zeroes is for abc5278568, discovering the character f.
|
||||
|
||||
In this example, after continuing this search a total of eight times, the password is 18f47a30.
|
||||
|
||||
Given the actual Door ID, what is the password?
|
||||
|
||||
Your puzzle answer was ________.
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
As the door slides open, you are presented with a second door that uses a slightly more inspired security mechanism. Clearly unimpressed by the last version (in what
|
||||
movie is the password decrypted in order?!), the Easter Bunny engineers have worked out a better solution.
|
||||
|
||||
Instead of simply filling in the password from left to right, the hash now also indicates the position within the password to fill. You still look for hashes that begin
|
||||
with five zeroes; however, now, the sixth character represents the position (0-7), and the seventh character is the character to put in that position.
|
||||
|
||||
A hash result of 000001f means that f is the second character in the password. Use only the first result for each position, and ignore invalid positions.
|
||||
|
||||
For example, if the Door ID is abc:
|
||||
|
||||
• The first interesting hash is from abc3231929, which produces 0000015...; so, 5 goes in position 1: _5______.
|
||||
• In the previous method, 5017308 produced an interesting hash; however, it is ignored, because it specifies an invalid position (8).
|
||||
• The second interesting hash is at index 5357525, which produces 000004e...; so, e goes in position 4: _5__e___.
|
||||
|
||||
You almost choke on your popcorn as the final character falls into place, producing the password 05ace8e3.
|
||||
|
||||
Given the actual Door ID and this new method, what is the password? Be extra proud of your solution if it uses a cinematic "decrypting" animation.
|
||||
|
||||
Your puzzle answer was ________.
|
||||
|
||||
Your puzzle input was ojvtpuvg.
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. https://www.detroitlabs.com/careers
|
||||
. https://en.wikipedia.org/wiki/Hackers_(film)
|
||||
. https://en.wikipedia.org/wiki/WarGames
|
||||
. https://en.wikipedia.org/wiki/MD5
|
||||
. https://en.wikipedia.org/wiki/Hexadecimal
|
||||
. https://www.youtube.com/watch?v=NHWjlCaIrQo&t=25
|
||||
. http://adventofcode.com/2016
|
650
2016/day06/input
Normal file
650
2016/day06/input
Normal file
@@ -0,0 +1,650 @@
|
||||
vlmbsivg
|
||||
wjskjzff
|
||||
hmcodblh
|
||||
nvohhghm
|
||||
xainmzpz
|
||||
frkckyrg
|
||||
zqdmvmee
|
||||
sbsqzlju
|
||||
eqdnsvqi
|
||||
xdmyqmxk
|
||||
gchzzkci
|
||||
unjukwld
|
||||
fmnpwrnf
|
||||
huvyqxkt
|
||||
uxekmktg
|
||||
pdzxhbfa
|
||||
khlkjqhk
|
||||
ravznzpy
|
||||
btpqmfzt
|
||||
tcnpghzn
|
||||
yuplhxzr
|
||||
ablaihve
|
||||
gjdehjcu
|
||||
dvmkpskx
|
||||
lukbiacr
|
||||
ttrzcksg
|
||||
ecfehhzq
|
||||
octwtlsc
|
||||
colisfrx
|
||||
svtipfzv
|
||||
kaffxell
|
||||
rsmdpuic
|
||||
viaidaip
|
||||
drbezwvb
|
||||
tyhnjseu
|
||||
weuopaqc
|
||||
igmqdwiz
|
||||
gerzveig
|
||||
bnqltmlo
|
||||
jgwcxybe
|
||||
iaabqazu
|
||||
bgflkfyt
|
||||
boznsgas
|
||||
agiyktkz
|
||||
ivvnbvuv
|
||||
tospvglb
|
||||
vxfhcvkz
|
||||
kshbpxws
|
||||
uejxthhb
|
||||
vyffdirv
|
||||
ibfywjob
|
||||
cpzlamql
|
||||
pyzsyqvq
|
||||
yrqdolxy
|
||||
svyihgcn
|
||||
vupxjagi
|
||||
cncrrcuv
|
||||
ydmvwcje
|
||||
yrpqbwhn
|
||||
jrgsqtpl
|
||||
axzbhwaw
|
||||
ggsjjmvb
|
||||
qtdsykjo
|
||||
cnjmerzo
|
||||
lzqwtxms
|
||||
yhhodrpp
|
||||
ryiwahsd
|
||||
kggpmwvl
|
||||
lextjotq
|
||||
tlxjbxef
|
||||
fygwhizi
|
||||
moomppou
|
||||
ezavglhp
|
||||
omylulyf
|
||||
ahbasrtz
|
||||
ccbblybl
|
||||
ueyudhva
|
||||
blrewxyn
|
||||
ytdwdavt
|
||||
rgpakvlz
|
||||
bmlycpbm
|
||||
ewbvxsrm
|
||||
hcukzfwq
|
||||
rkkixnbu
|
||||
masthktz
|
||||
soolsxwh
|
||||
zwszloqc
|
||||
wjizzawg
|
||||
ojcfqylq
|
||||
nnzmlcyh
|
||||
pvpmbtxx
|
||||
assogumc
|
||||
quorbsbu
|
||||
uywftned
|
||||
jneaeojp
|
||||
mdvwycom
|
||||
cpoqljak
|
||||
dgxinijd
|
||||
oknnyivd
|
||||
uclfujcu
|
||||
tglfuqym
|
||||
xixpvogp
|
||||
ywpxxlzu
|
||||
tzaooymi
|
||||
srjmonav
|
||||
pnfugqmd
|
||||
lryrknay
|
||||
ijyxsjyr
|
||||
nscjqibj
|
||||
xfbyavdq
|
||||
qoqcxyek
|
||||
txscvcir
|
||||
rbbpybgj
|
||||
tkhqbyup
|
||||
gmqcfvgi
|
||||
itftwfkt
|
||||
uzjbjwgw
|
||||
rmfoqkvx
|
||||
qtnlthgs
|
||||
szdpoddo
|
||||
qunqnglj
|
||||
vpyzxigu
|
||||
yvgaspgn
|
||||
ugzomjyi
|
||||
xehwrqqa
|
||||
gerohqzw
|
||||
svumyqwg
|
||||
mqyztgha
|
||||
kxaoylrd
|
||||
qlrivitr
|
||||
mqyqiewf
|
||||
jbmnazei
|
||||
mxlxbhwt
|
||||
blwoptvb
|
||||
psdatjoo
|
||||
ygetkaoq
|
||||
wygpqzdo
|
||||
hlclzfmf
|
||||
jpbvivrw
|
||||
pmukraot
|
||||
swbpgume
|
||||
dvkkfjph
|
||||
vrodfocs
|
||||
zufhfmqm
|
||||
djwpfova
|
||||
fkmbbzho
|
||||
wecxogkb
|
||||
nhkrcpkp
|
||||
vjeqcaaf
|
||||
xrqarugv
|
||||
fwmcwuok
|
||||
epbkndfk
|
||||
zwpgujke
|
||||
modqokkj
|
||||
ikewchsd
|
||||
jwrhzjlb
|
||||
smlbnbef
|
||||
mxbbtgqb
|
||||
viwdgsdx
|
||||
goqsuvzj
|
||||
rbroiwxp
|
||||
zdiptzal
|
||||
ybfdenoy
|
||||
oszdisbg
|
||||
nvfjluan
|
||||
lqsbzkzw
|
||||
psuefwbt
|
||||
yallonfl
|
||||
ijiwdpgh
|
||||
gglvyutq
|
||||
vqoydnjd
|
||||
qcryrkrs
|
||||
aivepbza
|
||||
ylhvocnp
|
||||
itvgswxy
|
||||
bztkautf
|
||||
ptrfhgug
|
||||
jxrrgihp
|
||||
pemkoxua
|
||||
gisyyymp
|
||||
lojsmpxa
|
||||
eqfowfiy
|
||||
fjgiccrd
|
||||
hbxkngmy
|
||||
drqthobt
|
||||
ikyiobsj
|
||||
cfwzjnns
|
||||
krhtlqjb
|
||||
ypahmuqg
|
||||
cckkvsls
|
||||
cvtpertw
|
||||
lokmfmqj
|
||||
eicgeaew
|
||||
cuenpdcs
|
||||
dztpufap
|
||||
qrwculkl
|
||||
ynzjrfps
|
||||
mucvocas
|
||||
dhorhvqw
|
||||
ldidkudb
|
||||
xxpbrirx
|
||||
ksudlgat
|
||||
giljlkxr
|
||||
jhyqnccn
|
||||
pmcscebv
|
||||
cwidmjza
|
||||
rqqirtgy
|
||||
zioenwys
|
||||
xbjruyyl
|
||||
asptiznh
|
||||
jqpjaenx
|
||||
lugmurst
|
||||
kmerqmnn
|
||||
dxyndveo
|
||||
uuqchrez
|
||||
upcfeanl
|
||||
sercqwtv
|
||||
gbyfvzic
|
||||
zlozeixc
|
||||
cqtrvust
|
||||
qdjntgwm
|
||||
xiqmxxpw
|
||||
gksowkih
|
||||
pltnircb
|
||||
pvoulbsn
|
||||
hjxqhgjg
|
||||
tcewvoyn
|
||||
apjfkhzx
|
||||
mfnuzwxz
|
||||
ovchtwej
|
||||
efqrkewr
|
||||
jwgxupik
|
||||
gcwelfie
|
||||
ammaagcn
|
||||
nyhkwztj
|
||||
zakrmiqp
|
||||
jjrdohih
|
||||
rnwxdbge
|
||||
zeobprqj
|
||||
zwwtpnsx
|
||||
mdnygzxh
|
||||
nkfluipm
|
||||
efwgmsfk
|
||||
jlnztudt
|
||||
medtzrwv
|
||||
wclfyxbb
|
||||
jjetrasx
|
||||
wmwuhaar
|
||||
ijwzhaoh
|
||||
xdlfrrnn
|
||||
dvxecbjt
|
||||
vwihvqzh
|
||||
kgpagxiw
|
||||
jvixdjuc
|
||||
gfiweyxg
|
||||
xejknscb
|
||||
hxheizpd
|
||||
dubgkfgr
|
||||
wkxidfgc
|
||||
tzxylcho
|
||||
qvububkp
|
||||
erlnhqov
|
||||
weomsswt
|
||||
rfpoxknw
|
||||
itnvsxdi
|
||||
cbnocofl
|
||||
ldadkmsf
|
||||
pwhhklgc
|
||||
itudhryg
|
||||
vlvtoljp
|
||||
hjggmitm
|
||||
mmzawuak
|
||||
quigzvkq
|
||||
rsmiptim
|
||||
tsqytvda
|
||||
pmprbqfm
|
||||
eppsdefz
|
||||
adcqcsvc
|
||||
lwiyaddu
|
||||
wwqpjubg
|
||||
jilsipuz
|
||||
wzrxuskh
|
||||
laraxaqd
|
||||
epuyflmt
|
||||
mdclmqun
|
||||
hkjrdlxu
|
||||
tcilebni
|
||||
rkrekccq
|
||||
aazdcsnc
|
||||
ngijyoqs
|
||||
bymuwqsv
|
||||
lsanabvd
|
||||
ylnektqm
|
||||
fthtunja
|
||||
vvfmqqbe
|
||||
shbajllw
|
||||
xgdgwmdc
|
||||
hrzmxpif
|
||||
nskrdynl
|
||||
ineiworp
|
||||
nlgfboek
|
||||
yrsztmql
|
||||
dnrewurn
|
||||
uwtdmpru
|
||||
eygvelve
|
||||
tfitkluc
|
||||
iqpxtxpw
|
||||
hztyqkrl
|
||||
xastoukn
|
||||
djbllswj
|
||||
kcnpmzsu
|
||||
kepgfdit
|
||||
okvnsjlp
|
||||
fhjqkxxt
|
||||
cnoewgjm
|
||||
uhyjofee
|
||||
knpdrbij
|
||||
rreiagox
|
||||
hxkhodce
|
||||
zmaxocze
|
||||
wtpaqndq
|
||||
jvcagcvr
|
||||
uhkmigmp
|
||||
xadnxjhe
|
||||
uiaplibp
|
||||
otkxrzix
|
||||
yzedogvy
|
||||
ekfnffhq
|
||||
fakkmnxr
|
||||
bztnaqpo
|
||||
tmyttvbn
|
||||
univukhd
|
||||
caujacsj
|
||||
flblfclw
|
||||
czfogrtr
|
||||
inxubopi
|
||||
afwfgcpb
|
||||
mycsrthv
|
||||
kdwsxnay
|
||||
koujdeqg
|
||||
hirhfotk
|
||||
wkxxvthj
|
||||
xsosgzwi
|
||||
bxilicsn
|
||||
hniuyqyz
|
||||
lwbgmzwc
|
||||
sncerhsu
|
||||
fuhbmtfk
|
||||
kaftqhuy
|
||||
pqvglqfj
|
||||
bghwspjz
|
||||
twijseky
|
||||
dpfmjhis
|
||||
narvsefe
|
||||
eraymofq
|
||||
qiopspmb
|
||||
taehddxo
|
||||
zttknqxx
|
||||
thgkqpfz
|
||||
dgufruwc
|
||||
bunvatbf
|
||||
xonactvk
|
||||
axjukwjn
|
||||
opbjnbxx
|
||||
fwvipkwm
|
||||
etxwpjaj
|
||||
hqdclxoq
|
||||
fsnugidt
|
||||
zmbpypye
|
||||
hoqsimwa
|
||||
waghzrcr
|
||||
njymehaz
|
||||
zknxntkj
|
||||
ntjtbato
|
||||
rqhupkqa
|
||||
jnjxdtdf
|
||||
eubzelni
|
||||
astkohuv
|
||||
ptfvacsg
|
||||
bzjhupen
|
||||
ijeukuux
|
||||
abiyvjke
|
||||
psbjwvcf
|
||||
sucqapsu
|
||||
axbjujok
|
||||
oxvdokyb
|
||||
olsyowug
|
||||
nitvqkcl
|
||||
njswglrr
|
||||
ovheurur
|
||||
ayedpsqo
|
||||
vvclemhs
|
||||
wjrfsvyk
|
||||
fdhcqdru
|
||||
qrkvvfay
|
||||
kuhlridl
|
||||
yxnrykeh
|
||||
ctkznbzx
|
||||
pfaojeww
|
||||
lobsvohy
|
||||
wutlpeak
|
||||
nhppjsax
|
||||
yihmsdmd
|
||||
iszriptf
|
||||
qdnhytkn
|
||||
vooshrhs
|
||||
wzogjdin
|
||||
tkseeclg
|
||||
jxzgiyxq
|
||||
osefrqid
|
||||
ixgfrbhq
|
||||
zkggjudf
|
||||
dyxgeond
|
||||
rpwplncj
|
||||
ndpxtrgc
|
||||
ubuheera
|
||||
migvasdi
|
||||
acgygdxb
|
||||
ccxcimgx
|
||||
lvdpvhdr
|
||||
ghvhyfmz
|
||||
dqtheasu
|
||||
ebjozdgp
|
||||
tluznvkr
|
||||
qhvzqrzm
|
||||
qbjpiipl
|
||||
bplqnbti
|
||||
kizmxvno
|
||||
uobfxakf
|
||||
syllmscz
|
||||
gghcqygd
|
||||
snkwjojf
|
||||
vdcvdpno
|
||||
qussueej
|
||||
zmlxuulr
|
||||
htqbwjve
|
||||
ixynqepo
|
||||
ovaelpay
|
||||
eywkbzsc
|
||||
qwoqmtig
|
||||
prkxadem
|
||||
jfsscvhm
|
||||
hqslphpy
|
||||
bfiiyruu
|
||||
fmkizdns
|
||||
vpsisoaf
|
||||
couzrtsv
|
||||
wycwxxlh
|
||||
upvcymri
|
||||
hqlqfvbm
|
||||
wzaeftmu
|
||||
boxdzesc
|
||||
lmcuplex
|
||||
xyuifcev
|
||||
fqgvggmq
|
||||
seykzeql
|
||||
fewgnzoq
|
||||
qjmsxyto
|
||||
ebckyjih
|
||||
jzrbwgjj
|
||||
vwojkmpc
|
||||
sqdqaffc
|
||||
yukfwymc
|
||||
yjptcsmz
|
||||
tencuncy
|
||||
rbtxxpuv
|
||||
yiffiway
|
||||
eefyzfqb
|
||||
moxjnvoq
|
||||
wijspyho
|
||||
fdtsjins
|
||||
rxqcbsgd
|
||||
oamredol
|
||||
baeulkgv
|
||||
rggwhexz
|
||||
qfkkitpv
|
||||
uexaisra
|
||||
cqwjlwxi
|
||||
tjavidpj
|
||||
efbavnsa
|
||||
uxnnkruo
|
||||
wriebzoz
|
||||
wexcdrht
|
||||
hzmyocox
|
||||
qseogxfr
|
||||
fflfanfi
|
||||
vpaiudnq
|
||||
olvuxneh
|
||||
fcbsytua
|
||||
sfudzkhx
|
||||
xghrupyg
|
||||
aeclhwom
|
||||
byobwacz
|
||||
rsditwjr
|
||||
lvvqfcup
|
||||
lflatigg
|
||||
kuojuttb
|
||||
aouuzdnw
|
||||
klbwzjlw
|
||||
zkambbfg
|
||||
xdevxqbr
|
||||
zqdlejop
|
||||
vfhbkyik
|
||||
zeyujeql
|
||||
skvhtden
|
||||
ddwgfxck
|
||||
lnrqrbkk
|
||||
rtnzbizt
|
||||
uaxpghyx
|
||||
asybsmyx
|
||||
djdcnnpx
|
||||
ykwhiyjk
|
||||
zhvodxrh
|
||||
bmzhumtw
|
||||
aoutwtdv
|
||||
mjadhrvo
|
||||
tkugwiep
|
||||
ystjfami
|
||||
bfqqcmtb
|
||||
bbvmzwdo
|
||||
hgufdhpb
|
||||
hhmamhwy
|
||||
gpasfwju
|
||||
zhpxvhjf
|
||||
vzqggwtj
|
||||
kbjrhlrm
|
||||
inhayugt
|
||||
fvspcluq
|
||||
grxbmozt
|
||||
muohwoyd
|
||||
nigtpaty
|
||||
ozzvzejw
|
||||
nyyngjme
|
||||
jmtoeyly
|
||||
qyxhdpaq
|
||||
iowatjzd
|
||||
iszcablv
|
||||
ocgavedu
|
||||
xbnzrfqv
|
||||
swzzzzwu
|
||||
stqfxgoo
|
||||
xpmubjxr
|
||||
katkezfz
|
||||
pudaitbg
|
||||
ybarabzd
|
||||
mpvqbzsr
|
||||
rhinjfpm
|
||||
snevfkqk
|
||||
pwwccyyu
|
||||
ocljrwko
|
||||
dxdryyvq
|
||||
rpqgkeol
|
||||
wvqbnkwc
|
||||
hgnwlgua
|
||||
mcqmblme
|
||||
fhzgsdch
|
||||
kdxugdug
|
||||
oltmtill
|
||||
sbduaius
|
||||
cqauyawa
|
||||
xfznpmvh
|
||||
dmivepyp
|
||||
dgsngwbw
|
||||
mbgsryyh
|
||||
aojpsuvb
|
||||
igvrbclq
|
||||
lduxmyiy
|
||||
dhomqxlb
|
||||
myszbzrf
|
||||
kbadlpoy
|
||||
ftnumgci
|
||||
xwzbhyfz
|
||||
lzutwqtv
|
||||
gimhovca
|
||||
zfudpuny
|
||||
nqkrsatc
|
||||
uldebzzq
|
||||
olzoesdw
|
||||
nchgfvll
|
||||
oopwvqlh
|
||||
jhsbnnjw
|
||||
siyclmze
|
||||
frhzjbnv
|
||||
nanvvjht
|
||||
wtucekgs
|
||||
xiyyglkr
|
||||
zkakjomw
|
||||
fdeeoopf
|
||||
tlctovbh
|
||||
cnqwlmkh
|
||||
zreoslve
|
||||
lcexflbp
|
||||
erkaxhyf
|
||||
uflifmci
|
||||
byfovhfn
|
||||
pmlsjebs
|
||||
rmdncvno
|
||||
jzxsteml
|
||||
ehromnts
|
||||
wwrgqdmv
|
||||
gydqxmbb
|
||||
kjjnrsyf
|
||||
okzknoil
|
||||
pqmjbnhz
|
||||
rbgydndw
|
||||
jfmclxjm
|
||||
bfotvtud
|
||||
mftuqeei
|
||||
lhchcrja
|
||||
czperrwe
|
||||
hyymnbfh
|
||||
gtmctpcn
|
||||
ooteayaj
|
||||
ipxmxdrg
|
||||
lxljcbmk
|
||||
kexfnhaz
|
||||
zwvwqxwd
|
||||
ccriznpe
|
||||
gadlykes
|
||||
nuagvrrv
|
||||
xgvdaxfk
|
||||
gnkzxirj
|
||||
vdmrccgf
|
||||
vhgjcski
|
||||
qpdhafox
|
||||
oijrjuwm
|
||||
qxtyktrs
|
||||
mkyalzfa
|
||||
tnmunnod
|
||||
ukjvbgjs
|
||||
cywsgmfc
|
||||
uqkzjgbn
|
||||
ppjifbhj
|
||||
gpwlnflu
|
||||
alabzvvi
|
||||
vtygcqph
|
||||
ezxtvdqo
|
||||
hzeejxxe
|
||||
aavwflnw
|
||||
nrfqefxa
|
||||
dsgysuua
|
||||
pikwyfym
|
||||
nesdcxdi
|
||||
ghqlicny
|
||||
jcvekqdr
|
||||
cyeiicma
|
||||
slfxqsdt
|
||||
dcrcwoek
|
||||
qdmtpdxr
|
||||
vlzjoqfm
|
55
2016/day06/main.go
Normal file
55
2016/day06/main.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
input := stdinToStringSlice()
|
||||
var partOne, partTwo string
|
||||
for j := range input[0] {
|
||||
freq := make(map[byte]int)
|
||||
for i := range input {
|
||||
freq[input[i][j]]++
|
||||
}
|
||||
partOne += getTopByte(freq)
|
||||
partTwo += getBottomByte(freq)
|
||||
}
|
||||
fmt.Println("Answer to Part 1: " + partOne)
|
||||
fmt.Println("Answer to Part 2: " + partTwo)
|
||||
}
|
||||
|
||||
func getTopByte(f map[byte]int) string {
|
||||
var topByte byte
|
||||
var topByteCnt int
|
||||
for k, v := range f {
|
||||
if v > topByteCnt {
|
||||
topByteCnt = v
|
||||
topByte = k
|
||||
}
|
||||
}
|
||||
return string(topByte)
|
||||
}
|
||||
|
||||
func getBottomByte(f map[byte]int) string {
|
||||
var botByte byte
|
||||
var botByteCnt int
|
||||
for k, v := range f {
|
||||
if v < botByteCnt || botByte == 0 {
|
||||
botByteCnt = v
|
||||
botByte = k
|
||||
}
|
||||
}
|
||||
return string(botByte)
|
||||
}
|
||||
|
||||
func stdinToStringSlice() []string {
|
||||
var input []string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input = append(input, scanner.Text())
|
||||
}
|
||||
return input
|
||||
}
|
69
2016/day06/problem
Normal file
69
2016/day06/problem
Normal file
@@ -0,0 +1,69 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 6: Signals and Noise ---
|
||||
|
||||
Something is jamming your communications with Santa. Fortunately, your signal is only partially jammed, and protocol in situations like this is to switch to
|
||||
a simple repetition code to get the message through.
|
||||
|
||||
In this model, the same message is sent repeatedly. You've recorded the repeating message signal (your puzzle input), but the data seems quite corrupted -
|
||||
almost too badly to recover. Almost.
|
||||
|
||||
All you need to do is figure out which character is most frequent for each position. For example, suppose you had recorded the following messages:
|
||||
|
||||
eedadn
|
||||
drvtee
|
||||
eandsr
|
||||
raavrd
|
||||
atevrs
|
||||
tsrnev
|
||||
sdttsa
|
||||
rasrtv
|
||||
nssdts
|
||||
ntnada
|
||||
svetve
|
||||
tesnvt
|
||||
vntsnd
|
||||
vrdear
|
||||
dvrsen
|
||||
enarar
|
||||
|
||||
The most common character in the first column is e; in the second, a; in the third, s, and so on. Combining these characters returns the error-corrected
|
||||
message, easter.
|
||||
|
||||
Given the recording in your puzzle input, what is the error-corrected version of the message being sent?
|
||||
|
||||
Your puzzle answer was ________.
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
Of course, that would be the message - if you hadn't agreed to use a modified repetition code instead.
|
||||
|
||||
In this modified code, the sender instead transmits what looks like random data, but for each character, the character they actually want to send is
|
||||
slightly less likely than the others. Even after signal-jamming noise, you can look at the letter distributions in each column and choose the least common
|
||||
letter to reconstruct the original message.
|
||||
|
||||
In the above example, the least common character in the first column is a; in the second, d, and so on. Repeating this process for the remaining characters
|
||||
produces the original message, advent.
|
||||
|
||||
Given the recording in your puzzle input and this new decoding methodology, what is the original message that Santa is trying to send?
|
||||
|
||||
Your puzzle answer was ________.
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. https://en.wikipedia.org/wiki/Repetition_code
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/day/6/input
|
2000
2016/day07/input
Normal file
2000
2016/day07/input
Normal file
File diff suppressed because it is too large
Load Diff
95
2016/day07/main.go
Normal file
95
2016/day07/main.go
Normal file
@@ -0,0 +1,95 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ips := stdinToStringSlice()
|
||||
var allowTLS []string
|
||||
var allowSSL []string
|
||||
for _, ip := range ips {
|
||||
if hasTLS(ip) {
|
||||
allowTLS = append(allowTLS, ip)
|
||||
}
|
||||
if hasSSL(ip) {
|
||||
allowSSL = append(allowSSL, ip)
|
||||
}
|
||||
}
|
||||
fmt.Println("IPs supporting TLS: ", len(allowTLS))
|
||||
fmt.Println("IPs supporting SSL: ", len(allowSSL))
|
||||
}
|
||||
|
||||
func hasTLS(ip string) bool {
|
||||
bad := false
|
||||
hprSq := getHypernetSqns(ip)
|
||||
for _, hpr := range hprSq {
|
||||
if hasABBA(hpr) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if !bad && hasABBA(ip) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func hasSSL(ip string) bool {
|
||||
hprSq := getHypernetSqns(ip)
|
||||
rest := cutHypernetSqns(ip, hprSq)
|
||||
for i := range rest {
|
||||
if len(rest) > i+2 {
|
||||
if rest[i] == rest[i+2] && rest[i] != rest[i+1] {
|
||||
bab := string(rest[i+1]) + string(rest[i]) + string(rest[i+1])
|
||||
for j := range hprSq {
|
||||
if strings.Contains(hprSq[j], bab) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func getHypernetSqns(ip string) []string {
|
||||
var ret []string
|
||||
re := regexp.MustCompile(`\[[^\[]*\]`)
|
||||
s := re.FindAll([]byte(ip), -1)
|
||||
|
||||
for i := range s {
|
||||
ret = append(ret, string(s[i][1:len(s[i])-1]))
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func cutHypernetSqns(ip string, hpn []string) string {
|
||||
for i := range hpn {
|
||||
ip = strings.Replace(ip, hpn[i], "", -1)
|
||||
}
|
||||
return ip
|
||||
}
|
||||
|
||||
func hasABBA(ip string) bool {
|
||||
for j := range ip {
|
||||
if len(ip) > j+3 {
|
||||
if ip[j] == ip[j+3] && ip[j+1] == ip[j+2] && ip[j] != ip[j+1] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func stdinToStringSlice() []string {
|
||||
var input []string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input = append(input, scanner.Text())
|
||||
}
|
||||
return input
|
||||
}
|
62
2016/day07/problem
Normal file
62
2016/day07/problem
Normal file
@@ -0,0 +1,62 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 7: Internet Protocol Version 7 ---
|
||||
|
||||
While snooping around the local network of EBHQ, you compile a list of IP addresses (they're IPv7, of course; IPv6 is much too limited).
|
||||
You'd like to figure out which IPs support TLS (transport-layer snooping).
|
||||
|
||||
An IP supports TLS if it has an Autonomous Bridge Bypass Annotation, or ABBA. An ABBA is any four-character sequence which consists of a
|
||||
pair of two different characters followed by the reverse of that pair, such as xyyx or abba. However, the IP also must not have an ABBA
|
||||
within any hypernet sequences, which are contained by square brackets.
|
||||
|
||||
For example:
|
||||
|
||||
• abba[mnop]qrst supports TLS (abba outside square brackets).
|
||||
• abcd[bddb]xyyx does not support TLS (bddb is within square brackets, even though xyyx is outside square brackets).
|
||||
• aaaa[qwer]tyui does not support TLS (aaaa is invalid; the interior characters must be different).
|
||||
• ioxxoj[asdfgh]zxcvbn supports TLS (oxxo is outside square brackets, even though it's within a larger string).
|
||||
|
||||
How many IPs in your puzzle input support TLS?
|
||||
|
||||
Your puzzle answer was _____.
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
You would also like to know which IPs support SSL (super-secret listening).
|
||||
|
||||
An IP supports SSL if it has an Area-Broadcast Accessor, or ABA, anywhere in the supernet sequences (outside any square bracketed sections),
|
||||
and a corresponding Byte Allocation Block, or BAB, anywhere in the hypernet sequences. An ABA is any three-character sequence which consists
|
||||
of the same character twice with a different character between them, such as xyx or aba. A corresponding BAB is the same characters but in
|
||||
reversed positions: yxy and bab, respectively.
|
||||
|
||||
For example:
|
||||
|
||||
• aba[bab]xyz supports SSL (aba outside square brackets with corresponding bab within square brackets).
|
||||
• xyx[xyx]xyx does not support SSL (xyx, but no corresponding yxy).
|
||||
• aaa[kek]eke supports SSL (eke in supernet with corresponding kek in hypernet; the aaa sequence is not related, because the interior
|
||||
character must be different).
|
||||
• zazbz[bzb]cdb supports SSL (zaz has no corresponding aza, but zbz has a corresponding bzb, even though zaz and zbz overlap).
|
||||
|
||||
How many IPs in your puzzle input support SSL?
|
||||
|
||||
Your puzzle answer was _______.
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. https://en.wikipedia.org/wiki/IP_address
|
||||
. https://en.wikipedia.org/wiki/IPv6
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/day/7/input
|
658
2016/day08-add/main.go
Normal file
658
2016/day08-add/main.go
Normal file
@@ -0,0 +1,658 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
/* This program generates instructions to display words
|
||||
* on the screen from day 8
|
||||
* It assumes the screen size is 50x6
|
||||
*/
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Println("Expected argument with word to convert.")
|
||||
os.Exit(1)
|
||||
}
|
||||
wrd := strings.ToUpper(os.Args[1])
|
||||
for i := len(wrd) - 1; i >= 0; i-- {
|
||||
printInst(runeToInst(rune(wrd[i])))
|
||||
if i > 0 {
|
||||
printInst(shiftCols(2))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func printInst(i []string) {
|
||||
for j := range i {
|
||||
fmt.Println(i[j])
|
||||
}
|
||||
}
|
||||
|
||||
func runeToInst(r rune) []string {
|
||||
var ret []string
|
||||
switch r {
|
||||
case 'A':
|
||||
/*
|
||||
##
|
||||
# #
|
||||
# #
|
||||
####
|
||||
# #
|
||||
# #
|
||||
*/
|
||||
ret = append(ret, "rect 1x5")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x5")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
case 'B':
|
||||
/*
|
||||
###
|
||||
# #
|
||||
###
|
||||
# #
|
||||
# #
|
||||
###
|
||||
*/
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x6")
|
||||
case 'C':
|
||||
/*
|
||||
##
|
||||
# #
|
||||
#
|
||||
#
|
||||
# #
|
||||
##
|
||||
*/
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x4")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
case 'D':
|
||||
/*
|
||||
###
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
###
|
||||
*/
|
||||
ret = append(ret, "rect 1x4")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x6")
|
||||
case 'E':
|
||||
/*
|
||||
####
|
||||
#
|
||||
###
|
||||
#
|
||||
#
|
||||
####
|
||||
*/
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x6")
|
||||
case 'F':
|
||||
/*
|
||||
####
|
||||
#
|
||||
###
|
||||
#
|
||||
#
|
||||
#
|
||||
*/
|
||||
ret = append(ret, shiftCols(5)...)
|
||||
ret = append(ret, "rect 3x1")
|
||||
ret = append(ret, "rotate column x=2 by 2")
|
||||
ret = append(ret, "rotate column x=1 by 2")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 4x1")
|
||||
ret = append(ret, "rect 1x6")
|
||||
case 'G':
|
||||
/*
|
||||
###
|
||||
#
|
||||
# ##
|
||||
# #
|
||||
# #
|
||||
##
|
||||
*/
|
||||
ret = append(ret, "rect 1x3")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x4")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
case 'H':
|
||||
/*
|
||||
# #
|
||||
# #
|
||||
####
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
*/
|
||||
ret = append(ret, "rect 1x6")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x6")
|
||||
case 'I':
|
||||
/*
|
||||
###
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
###
|
||||
*/
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x6")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, "rect 1x1")
|
||||
case 'J':
|
||||
/*
|
||||
#
|
||||
#
|
||||
#
|
||||
# #
|
||||
# #
|
||||
##
|
||||
*/
|
||||
ret = append(ret, "rect 1x5")
|
||||
ret = append(ret, shiftCols(2)...)
|
||||
|
||||
ret = append(ret, "rect 2x1")
|
||||
ret = append(ret, "rotate column x=1 by 5")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
case 'K':
|
||||
/*
|
||||
# #
|
||||
# #
|
||||
##
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
*/
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 4")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x6")
|
||||
case 'L':
|
||||
/*
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
####
|
||||
*/
|
||||
ret = append(ret, shiftCols(3)...)
|
||||
ret = append(ret, "rect 4x1")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, "rotate column x=1 by 5")
|
||||
ret = append(ret, "rotate column x=2 by 5")
|
||||
ret = append(ret, "rotate column x=3 by 5")
|
||||
ret = append(ret, "rect 1x6")
|
||||
case 'M':
|
||||
/*
|
||||
# #
|
||||
####
|
||||
####
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
*/
|
||||
ret = append(ret, "rect 1x6")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x6")
|
||||
case 'N':
|
||||
/*
|
||||
# #
|
||||
## #
|
||||
# ##
|
||||
# ##
|
||||
# #
|
||||
# #
|
||||
*/
|
||||
ret = append(ret, "rect 1x6")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x6")
|
||||
|
||||
case 'O':
|
||||
/*
|
||||
##
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
##
|
||||
*/
|
||||
ret = append(ret, "rect 1x4")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
ret = append(ret, shiftCols(2)...)
|
||||
ret = append(ret, "rect 2x1")
|
||||
ret = append(ret, "rotate column x=1 by 5")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, "rect 2x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x4")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
|
||||
case 'P':
|
||||
/*
|
||||
###
|
||||
# #
|
||||
###
|
||||
#
|
||||
#
|
||||
#
|
||||
*/
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
ret = append(ret, shiftCols(2)...)
|
||||
|
||||
ret = append(ret, "rect 2x1")
|
||||
ret = append(ret, "rotate column x=1 by 2")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 2x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x6")
|
||||
|
||||
case 'Q':
|
||||
/*
|
||||
##
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# ##
|
||||
###
|
||||
*/
|
||||
ret = append(ret, "rect 1x5")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 4")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x4")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
|
||||
case 'R':
|
||||
/*
|
||||
###
|
||||
# #
|
||||
# #
|
||||
###
|
||||
# #
|
||||
# #
|
||||
*/
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
ret = append(ret, shiftCols(2)...)
|
||||
|
||||
ret = append(ret, "rect 2x1")
|
||||
ret = append(ret, "rotate column x=1 by 3")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 2x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x6")
|
||||
|
||||
case 'S':
|
||||
/*
|
||||
###
|
||||
#
|
||||
#
|
||||
##
|
||||
#
|
||||
###
|
||||
*/
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 4")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 1")
|
||||
|
||||
case 'T':
|
||||
/*
|
||||
####
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
*/
|
||||
ret = append(ret, shiftCols(2)...)
|
||||
ret = append(ret, "rect 3x1")
|
||||
ret = append(ret, "rect 1x6")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x1")
|
||||
|
||||
case 'U':
|
||||
/*
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
##
|
||||
*/
|
||||
ret = append(ret, "rect 1x5")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 5")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x5")
|
||||
|
||||
case 'V':
|
||||
/*
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
##
|
||||
##
|
||||
##
|
||||
*/
|
||||
ret = append(ret, "rect 1x3")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x3")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x3")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x3")
|
||||
|
||||
case 'W':
|
||||
/*
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
####
|
||||
####
|
||||
# #
|
||||
*/
|
||||
ret = append(ret, "rect 1x6")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x6")
|
||||
|
||||
case 'X':
|
||||
/*
|
||||
# #
|
||||
# #
|
||||
##
|
||||
##
|
||||
# #
|
||||
# #
|
||||
*/
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 4")
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 4")
|
||||
ret = append(ret, "rect 1x2")
|
||||
|
||||
case 'Y':
|
||||
/*
|
||||
# #
|
||||
# #
|
||||
###
|
||||
#
|
||||
#
|
||||
##
|
||||
*/
|
||||
ret = append(ret, "rect 1x5")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x2")
|
||||
|
||||
case 'Z':
|
||||
/*
|
||||
####
|
||||
# #
|
||||
#
|
||||
#
|
||||
# #
|
||||
####
|
||||
*/
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 4")
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, "rotate column x=0 by 3")
|
||||
ret = append(ret, "rect 1x1")
|
||||
ret = append(ret, shiftCols(1)...)
|
||||
ret = append(ret, "rect 1x2")
|
||||
ret = append(ret, "rotate column x=0 by 4")
|
||||
ret = append(ret, "rect 1x2")
|
||||
case ' ':
|
||||
ret = append(ret, shiftCols(4)...)
|
||||
default:
|
||||
ret = append(ret, shiftCols(4)...)
|
||||
ret = append(ret, "rect 4x1")
|
||||
ret = append(ret, "rotate column x=3 by 2")
|
||||
ret = append(ret, "rotate column x=2 by 2")
|
||||
ret = append(ret, "rotate column x=1 by 2")
|
||||
ret = append(ret, "rotate column x=0 by 2")
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func shiftCols(dist int) []string {
|
||||
var ret []string
|
||||
for i := 0; i < 6; i++ {
|
||||
ret = append(ret, "rotate row y="+itoa(i)+" by "+itoa(dist))
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func shiftRows(dist int) []string {
|
||||
var ret []string
|
||||
for i := 0; i < 50; i++ {
|
||||
ret = append(ret, "rotate col x="+itoa(i)+" by "+itoa(dist))
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func itoa(i int) string {
|
||||
return strconv.Itoa(i)
|
||||
}
|
193
2016/day08/input
Normal file
193
2016/day08/input
Normal file
@@ -0,0 +1,193 @@
|
||||
rect 1x1
|
||||
rotate row y=0 by 5
|
||||
rect 1x1
|
||||
rotate row y=0 by 5
|
||||
rect 1x1
|
||||
rotate row y=0 by 5
|
||||
rect 1x1
|
||||
rotate row y=0 by 5
|
||||
rect 1x1
|
||||
rotate row y=0 by 2
|
||||
rect 1x1
|
||||
rotate row y=0 by 2
|
||||
rect 1x1
|
||||
rotate row y=0 by 3
|
||||
rect 1x1
|
||||
rotate row y=0 by 3
|
||||
rect 2x1
|
||||
rotate row y=0 by 2
|
||||
rect 1x1
|
||||
rotate row y=0 by 3
|
||||
rect 2x1
|
||||
rotate row y=0 by 2
|
||||
rect 1x1
|
||||
rotate row y=0 by 3
|
||||
rect 2x1
|
||||
rotate row y=0 by 5
|
||||
rect 4x1
|
||||
rotate row y=0 by 5
|
||||
rotate column x=0 by 1
|
||||
rect 4x1
|
||||
rotate row y=0 by 10
|
||||
rotate column x=5 by 2
|
||||
rotate column x=0 by 1
|
||||
rect 9x1
|
||||
rotate row y=2 by 5
|
||||
rotate row y=0 by 5
|
||||
rotate column x=0 by 1
|
||||
rect 4x1
|
||||
rotate row y=2 by 5
|
||||
rotate row y=0 by 5
|
||||
rotate column x=0 by 1
|
||||
rect 4x1
|
||||
rotate column x=40 by 1
|
||||
rotate column x=27 by 1
|
||||
rotate column x=22 by 1
|
||||
rotate column x=17 by 1
|
||||
rotate column x=12 by 1
|
||||
rotate column x=7 by 1
|
||||
rotate column x=2 by 1
|
||||
rotate row y=2 by 5
|
||||
rotate row y=1 by 3
|
||||
rotate row y=0 by 5
|
||||
rect 1x3
|
||||
rotate row y=2 by 10
|
||||
rotate row y=1 by 7
|
||||
rotate row y=0 by 2
|
||||
rotate column x=3 by 2
|
||||
rotate column x=2 by 1
|
||||
rotate column x=0 by 1
|
||||
rect 4x1
|
||||
rotate row y=2 by 5
|
||||
rotate row y=1 by 3
|
||||
rotate row y=0 by 3
|
||||
rect 1x3
|
||||
rotate column x=45 by 1
|
||||
rotate row y=2 by 7
|
||||
rotate row y=1 by 10
|
||||
rotate row y=0 by 2
|
||||
rotate column x=3 by 1
|
||||
rotate column x=2 by 2
|
||||
rotate column x=0 by 1
|
||||
rect 4x1
|
||||
rotate row y=2 by 13
|
||||
rotate row y=0 by 5
|
||||
rotate column x=3 by 1
|
||||
rotate column x=0 by 1
|
||||
rect 4x1
|
||||
rotate row y=3 by 10
|
||||
rotate row y=2 by 10
|
||||
rotate row y=0 by 5
|
||||
rotate column x=3 by 1
|
||||
rotate column x=2 by 1
|
||||
rotate column x=0 by 1
|
||||
rect 4x1
|
||||
rotate row y=3 by 8
|
||||
rotate row y=0 by 5
|
||||
rotate column x=3 by 1
|
||||
rotate column x=2 by 1
|
||||
rotate column x=0 by 1
|
||||
rect 4x1
|
||||
rotate row y=3 by 17
|
||||
rotate row y=2 by 20
|
||||
rotate row y=0 by 15
|
||||
rotate column x=13 by 1
|
||||
rotate column x=12 by 3
|
||||
rotate column x=10 by 1
|
||||
rotate column x=8 by 1
|
||||
rotate column x=7 by 2
|
||||
rotate column x=6 by 1
|
||||
rotate column x=5 by 1
|
||||
rotate column x=3 by 1
|
||||
rotate column x=2 by 2
|
||||
rotate column x=0 by 1
|
||||
rect 14x1
|
||||
rotate row y=1 by 47
|
||||
rotate column x=9 by 1
|
||||
rotate column x=4 by 1
|
||||
rotate row y=3 by 3
|
||||
rotate row y=2 by 10
|
||||
rotate row y=1 by 8
|
||||
rotate row y=0 by 5
|
||||
rotate column x=2 by 2
|
||||
rotate column x=0 by 2
|
||||
rect 3x2
|
||||
rotate row y=3 by 12
|
||||
rotate row y=2 by 10
|
||||
rotate row y=0 by 10
|
||||
rotate column x=8 by 1
|
||||
rotate column x=7 by 3
|
||||
rotate column x=5 by 1
|
||||
rotate column x=3 by 1
|
||||
rotate column x=2 by 1
|
||||
rotate column x=1 by 1
|
||||
rotate column x=0 by 1
|
||||
rect 9x1
|
||||
rotate row y=0 by 20
|
||||
rotate column x=46 by 1
|
||||
rotate row y=4 by 17
|
||||
rotate row y=3 by 10
|
||||
rotate row y=2 by 10
|
||||
rotate row y=1 by 5
|
||||
rotate column x=8 by 1
|
||||
rotate column x=7 by 1
|
||||
rotate column x=6 by 1
|
||||
rotate column x=5 by 1
|
||||
rotate column x=3 by 1
|
||||
rotate column x=2 by 2
|
||||
rotate column x=1 by 1
|
||||
rotate column x=0 by 1
|
||||
rect 9x1
|
||||
rotate column x=32 by 4
|
||||
rotate row y=4 by 33
|
||||
rotate row y=3 by 5
|
||||
rotate row y=2 by 15
|
||||
rotate row y=0 by 15
|
||||
rotate column x=13 by 1
|
||||
rotate column x=12 by 3
|
||||
rotate column x=10 by 1
|
||||
rotate column x=8 by 1
|
||||
rotate column x=7 by 2
|
||||
rotate column x=6 by 1
|
||||
rotate column x=5 by 1
|
||||
rotate column x=3 by 1
|
||||
rotate column x=2 by 1
|
||||
rotate column x=1 by 1
|
||||
rotate column x=0 by 1
|
||||
rect 14x1
|
||||
rotate column x=39 by 3
|
||||
rotate column x=35 by 4
|
||||
rotate column x=20 by 4
|
||||
rotate column x=19 by 3
|
||||
rotate column x=10 by 4
|
||||
rotate column x=9 by 3
|
||||
rotate column x=8 by 3
|
||||
rotate column x=5 by 4
|
||||
rotate column x=4 by 3
|
||||
rotate row y=5 by 5
|
||||
rotate row y=4 by 5
|
||||
rotate row y=3 by 33
|
||||
rotate row y=1 by 30
|
||||
rotate column x=48 by 1
|
||||
rotate column x=47 by 5
|
||||
rotate column x=46 by 5
|
||||
rotate column x=45 by 1
|
||||
rotate column x=43 by 1
|
||||
rotate column x=38 by 3
|
||||
rotate column x=37 by 3
|
||||
rotate column x=36 by 5
|
||||
rotate column x=35 by 1
|
||||
rotate column x=33 by 1
|
||||
rotate column x=32 by 5
|
||||
rotate column x=31 by 5
|
||||
rotate column x=30 by 1
|
||||
rotate column x=23 by 4
|
||||
rotate column x=22 by 3
|
||||
rotate column x=21 by 3
|
||||
rotate column x=20 by 1
|
||||
rotate column x=12 by 2
|
||||
rotate column x=11 by 2
|
||||
rotate column x=3 by 5
|
||||
rotate column x=2 by 5
|
||||
rotate column x=1 by 3
|
||||
rotate column x=0 by 4
|
208
2016/day08/main.go
Normal file
208
2016/day08/main.go
Normal file
@@ -0,0 +1,208 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
width := 50
|
||||
height := 6
|
||||
if len(os.Args) >= 2 {
|
||||
width = atoi(os.Args[1])
|
||||
}
|
||||
if len(os.Args) >= 3 {
|
||||
height = atoi(os.Args[2])
|
||||
}
|
||||
input := stdinToStringSlice()
|
||||
|
||||
d := CreateDisplay(width, height)
|
||||
for idx, ins := range input {
|
||||
fmt.Println(idx, ins)
|
||||
d.ClearScreen()
|
||||
d.ProcInstruction(ins)
|
||||
d.PrintScreen()
|
||||
time.Sleep(time.Millisecond * 25)
|
||||
}
|
||||
fmt.Println("Voltage Used: ", d.GetVoltage())
|
||||
}
|
||||
|
||||
type Display struct {
|
||||
Width int
|
||||
Height int
|
||||
Screen [][]bool
|
||||
}
|
||||
|
||||
func CreateDisplay(w, h int) *Display {
|
||||
d := Display{Width: w, Height: h}
|
||||
for i := 0; i < h; i++ {
|
||||
var row []bool
|
||||
for j := 0; j < w; j++ {
|
||||
row = append(row, false)
|
||||
}
|
||||
d.Screen = append(d.Screen, row)
|
||||
}
|
||||
return &d
|
||||
}
|
||||
|
||||
func (d *Display) ClearScreen() {
|
||||
fmt.Print("\033[H\033[2J")
|
||||
}
|
||||
|
||||
func (d *Display) PrintScreen() {
|
||||
fmt.Print("\u250C")
|
||||
for i := 0; i < d.Width; i++ {
|
||||
fmt.Print("\u2500")
|
||||
}
|
||||
fmt.Println("\u2510")
|
||||
for y := range d.Screen {
|
||||
fmt.Print("\u2502")
|
||||
for x := range d.Screen[y] {
|
||||
if d.Screen[y][x] {
|
||||
fmt.Print("\u2588")
|
||||
} else {
|
||||
fmt.Print(" ")
|
||||
}
|
||||
}
|
||||
fmt.Println("\u2502")
|
||||
}
|
||||
fmt.Print("\u2514")
|
||||
for i := 0; i < d.Width; i++ {
|
||||
fmt.Print("\u2500")
|
||||
}
|
||||
fmt.Println("\u2518")
|
||||
}
|
||||
|
||||
func (d *Display) SetWidth(w int) {
|
||||
d.Width = w
|
||||
}
|
||||
|
||||
func (d *Display) SetHeight(h int) {
|
||||
d.Height = h
|
||||
}
|
||||
|
||||
func (d *Display) ProcInstruction(ins string) {
|
||||
pts := strings.Fields(ins)
|
||||
switch pts[0] {
|
||||
case "rect":
|
||||
if len(pts) < 2 {
|
||||
return
|
||||
}
|
||||
dim := strings.Split(pts[1], "x")
|
||||
bldX := atoi(dim[0])
|
||||
bldY := atoi(dim[1])
|
||||
d.CreateRect(bldX, bldY)
|
||||
case "rotate":
|
||||
if len(pts) < 5 {
|
||||
return
|
||||
}
|
||||
args := strings.Split(pts[2], "=")
|
||||
switch pts[1] {
|
||||
case "row":
|
||||
if args[0] != "y" {
|
||||
return
|
||||
}
|
||||
d.RotateRow(atoi(args[1]), atoi(pts[4]))
|
||||
case "column":
|
||||
if args[0] != "x" {
|
||||
return
|
||||
}
|
||||
d.RotateCol(atoi(args[1]), atoi(pts[4]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Display) CreateRect(x, y int) {
|
||||
if y >= d.Height && x >= d.Width {
|
||||
fmt.Println(" Error creating rect", x, y)
|
||||
return
|
||||
}
|
||||
for i := 0; i < y; i++ {
|
||||
for j := 0; j < x; j++ {
|
||||
d.Screen[i][j] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Display) RotateRow(y, dist int) {
|
||||
orig, err := d.GetRow(y)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(1)
|
||||
return
|
||||
}
|
||||
for i := range orig {
|
||||
d.Screen[y][(i+dist)%d.Width] = orig[i]
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Display) RotateCol(x, dist int) {
|
||||
orig, err := d.GetCol(x)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(1)
|
||||
return
|
||||
}
|
||||
|
||||
for i := range orig {
|
||||
d.Screen[(i+dist)%d.Height][x] = orig[i]
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Display) GetRow(y int) ([]bool, error) {
|
||||
var ret []bool
|
||||
if d.Height <= y {
|
||||
return ret, errors.New("Invalid Row Requested")
|
||||
}
|
||||
for i := 0; i < d.Width; i++ {
|
||||
ret = append(ret, d.Screen[y][i])
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (d *Display) GetCol(x int) ([]bool, error) {
|
||||
var ret []bool
|
||||
if d.Width <= x {
|
||||
return ret, errors.New("Invalid Column Requested")
|
||||
}
|
||||
for i := 0; i < d.Height; i++ {
|
||||
ret = append(ret, d.Screen[i][x])
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (d *Display) GetVoltage() int {
|
||||
var ret int
|
||||
for i := range d.Screen {
|
||||
for j := range d.Screen[i] {
|
||||
if d.Screen[i][j] {
|
||||
ret++
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func stdinToStringSlice() []string {
|
||||
var input []string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input = append(input, scanner.Text())
|
||||
}
|
||||
return input
|
||||
}
|
||||
|
||||
func atoi(i string) int {
|
||||
var ret int
|
||||
var err error
|
||||
if ret, err = strconv.Atoi(i); err != nil {
|
||||
log.Fatal("Invalid Atoi")
|
||||
}
|
||||
return ret
|
||||
}
|
89
2016/day08/problem
Normal file
89
2016/day08/problem
Normal file
@@ -0,0 +1,89 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 8: Two-Factor Authentication ---
|
||||
|
||||
You come across a door implementing what you can only assume is an implementation of two-factor authentication
|
||||
after a long game of requirements telephone.
|
||||
|
||||
To get past the door, you first swipe a keycard (no problem; there was one on a nearby desk). Then, it displays a
|
||||
code on a little screen, and you type that code on a keypad. Then, presumably, the door unlocks.
|
||||
|
||||
Unfortunately, the screen has been smashed. After a few minutes, you've taken everything apart and figured out how
|
||||
it works. Now you just have to work out what the screen would have displayed.
|
||||
|
||||
The magnetic strip on the card you swiped encodes a series of instructions for the screen; these instructions are
|
||||
your puzzle input. The screen is 50 pixels wide and 6 pixels tall, all of which start off, and is capable of three
|
||||
somewhat peculiar operations:
|
||||
|
||||
• rect AxB turns on all of the pixels in a rectangle at the top-left of the screen which is A wide and B tall.
|
||||
• rotate row y=A by B shifts all of the pixels in row A (0 is the top row) right by B pixels. Pixels that would
|
||||
fall off the right end appear at the left end of the row.
|
||||
• rotate column x=A by B shifts all of the pixels in column A (0 is the left column) down by B pixels. Pixels
|
||||
that would fall off the bottom appear at the top of the column.
|
||||
|
||||
For example, here is a simple sequence on a smaller screen:
|
||||
|
||||
• rect 3x2 creates a small rectangle in the top-left corner:
|
||||
|
||||
###....
|
||||
###....
|
||||
.......
|
||||
|
||||
• rotate column x=1 by 1 rotates the second column down by one pixel:
|
||||
|
||||
#.#....
|
||||
###....
|
||||
.#.....
|
||||
|
||||
• rotate row y=0 by 4 rotates the top row right by four pixels:
|
||||
|
||||
....#.#
|
||||
###....
|
||||
.#.....
|
||||
|
||||
• rotate column x=1 by 1 again rotates the second column down by one pixel, causing the bottom pixel to wrap back
|
||||
to the top:
|
||||
|
||||
.#..#.#
|
||||
#.#....
|
||||
.#.....
|
||||
|
||||
As you can see, this display technology is extremely powerful, and will soon dominate the
|
||||
tiny-code-displaying-screen market. That's what the advertisement on the back of the display tries to convince you,
|
||||
anyway.
|
||||
|
||||
There seems to be an intermediate check of the voltage used by the display: after you swipe your card, if the
|
||||
screen did work, how many pixels should be lit?
|
||||
|
||||
Your puzzle answer was _____.
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
You notice that the screen is only capable of displaying capital letters; in the font it uses, each letter is 5
|
||||
pixels wide and 6 tall.
|
||||
|
||||
After you swipe your card, what code is the screen trying to display?
|
||||
|
||||
Your puzzle answer was _____________.
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. https://en.wikipedia.org/wiki/Multi-factor_authentication
|
||||
. https://en.wikipedia.org/wiki/Requirement
|
||||
. https://en.wikipedia.org/wiki/Chinese_whispers
|
||||
. https://www.google.com/search?q=tiny+lcd&tbm=isch
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/day/8/input
|
1
2016/day09/input
Normal file
1
2016/day09/input
Normal file
File diff suppressed because one or more lines are too long
124
2016/day09/main.go
Normal file
124
2016/day09/main.go
Normal file
@@ -0,0 +1,124 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var re *regexp.Regexp
|
||||
|
||||
func main() {
|
||||
var input []byte
|
||||
var noDecompress bool
|
||||
var printSize bool
|
||||
if len(os.Args) > 1 {
|
||||
for i := 1; i < len(os.Args); i++ {
|
||||
if os.Args[i][0] != '-' {
|
||||
// Assume it's a filename
|
||||
// Read from the given filename
|
||||
input = fileToByteSlice(os.Args[1])
|
||||
} else {
|
||||
switch os.Args[i] {
|
||||
case "-size":
|
||||
printSize = true
|
||||
case "-dry":
|
||||
// -dry implies printSize
|
||||
printSize = true
|
||||
noDecompress = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(input) == 0 {
|
||||
// Must be stdin
|
||||
input = stdinToByteSlice()
|
||||
}
|
||||
input = bytes.TrimSpace(input)
|
||||
// re matches compression markers and submatches the values we care about
|
||||
re = regexp.MustCompile(`\((\d*)x(\d*)\)`)
|
||||
|
||||
if noDecompress {
|
||||
cnt := depthDecompressLength(input)
|
||||
fmt.Println("Total Decompressed Bytes:", cnt)
|
||||
os.Exit(0)
|
||||
}
|
||||
output := depthDecompress(input)
|
||||
fmt.Println(string(output))
|
||||
if printSize {
|
||||
fmt.Println("Total Decompressed Bytes:", len(output))
|
||||
}
|
||||
}
|
||||
|
||||
// depthDecompressLength counts how many uncompressed bytes are
|
||||
// in the byte slice by unravelling the compression levels
|
||||
// recursively
|
||||
func depthDecompressLength(cmp []byte) uint64 {
|
||||
mrkParts := re.FindStringSubmatch(string(cmp))
|
||||
if len(mrkParts) < 3 {
|
||||
// No compressionmarker, just return cmp length
|
||||
return uint64(len(cmp))
|
||||
}
|
||||
marker, mrkBytes, mrkDupe := []byte(mrkParts[0]), atoi(mrkParts[1]), atoi(mrkParts[2])
|
||||
mrkPos := bytes.Index(cmp, marker)
|
||||
if mrkPos > 0 {
|
||||
cmp = cmp[mrkPos:]
|
||||
}
|
||||
recurBytes := bytes.TrimPrefix(cmp, marker)[:mrkBytes]
|
||||
remainder := bytes.TrimPrefix(cmp, append(marker, recurBytes...))
|
||||
return uint64(mrkPos) + (depthDecompressLength(recurBytes) * uint64(mrkDupe)) + depthDecompressLength(remainder)
|
||||
}
|
||||
|
||||
func depthDecompress(cmp []byte) []byte {
|
||||
mrkParts := re.FindStringSubmatch(string(cmp))
|
||||
if len(mrkParts) < 3 {
|
||||
// No compression marker, just return cmp length
|
||||
return cmp
|
||||
}
|
||||
marker, mrkBytes, mrkDupe := []byte(mrkParts[0]), atoi(mrkParts[1]), atoi(mrkParts[2])
|
||||
mrkPos := bytes.Index(cmp, marker)
|
||||
var ret []byte
|
||||
if mrkPos > 0 {
|
||||
ret = cmp[:mrkPos]
|
||||
cmp = cmp[mrkPos:]
|
||||
}
|
||||
recurBytes := bytes.TrimPrefix(cmp, marker)[:mrkBytes]
|
||||
remainder := bytes.TrimPrefix(cmp, append(marker, recurBytes...))
|
||||
|
||||
ret = append(ret, bytes.Repeat(depthDecompress(recurBytes), mrkDupe)...)
|
||||
return append(ret, depthDecompress(remainder)...)
|
||||
}
|
||||
|
||||
func fileToByteSlice(fn string) []byte {
|
||||
var c []byte
|
||||
var err error
|
||||
c, err = ioutil.ReadFile(fn)
|
||||
if err != nil {
|
||||
fmt.Println("Unable to read file: " + fn)
|
||||
os.Exit(1)
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
func stdinToByteSlice() []byte {
|
||||
var input string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input += scanner.Text()
|
||||
}
|
||||
return []byte(input)
|
||||
}
|
||||
|
||||
func atoi(i string) int {
|
||||
var ret int
|
||||
var err error
|
||||
if ret, err = strconv.Atoi(i); err != nil {
|
||||
log.Fatal("Invalid Atoi")
|
||||
}
|
||||
return ret
|
||||
}
|
70
2016/day09/problem
Normal file
70
2016/day09/problem
Normal file
@@ -0,0 +1,70 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 9: Explosives in Cyberspace ---
|
||||
|
||||
Wandering around a secure area, you come across a datalink port to a new part of the network. After briefly scanning it for
|
||||
interesting files, you find one file in particular that catches your attention. It's compressed with an experimental format, but
|
||||
fortunately, the documentation for the format is nearby.
|
||||
|
||||
The format compresses a sequence of characters. Whitespace is ignored. To indicate that some sequence should be repeated, a marker is
|
||||
added to the file, like (10x2). To decompress this marker, take the subsequent 10 characters and repeat them 2 times. Then, continue
|
||||
reading the file after the repeated data. The marker itself is not included in the decompressed output.
|
||||
|
||||
If parentheses or other characters appear within the data referenced by a marker, that's okay - treat it like normal data, not a
|
||||
marker, and then resume looking for markers after the decompressed section.
|
||||
|
||||
For example:
|
||||
|
||||
• ADVENT contains no markers and decompresses to itself with no changes, resulting in a decompressed length of 6.
|
||||
• A(1x5)BC repeats only the B a total of 5 times, becoming ABBBBBC for a decompressed length of 7.
|
||||
• (3x3)XYZ becomes XYZXYZXYZ for a decompressed length of 9.
|
||||
• A(2x2)BCD(2x2)EFG doubles the BC and EF, becoming ABCBCDEFEFG for a decompressed length of 11.
|
||||
• (6x1)(1x3)A simply becomes (1x3)A - the (1x3) looks like a marker, but because it's within a data section of another marker, it
|
||||
is not treated any differently from the A that comes after it. It has a decompressed length of 6.
|
||||
• X(8x2)(3x3)ABCY becomes X(3x3)ABC(3x3)ABCY (for a decompressed length of 18), because the decompressed data from the (8x2) marker
|
||||
(the (3x3)ABC) is skipped and not processed further.
|
||||
|
||||
What is the decompressed length of the file (your puzzle input)? Don't count whitespace.
|
||||
|
||||
Your puzzle answer was __________.
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
Apparently, the file actually uses version two of the format.
|
||||
|
||||
In version two, the only difference is that markers within decompressed data are decompressed. This, the documentation explains,
|
||||
provides much more substantial compression capabilities, allowing many-gigabyte files to be stored in only a few kilobytes.
|
||||
|
||||
For example:
|
||||
|
||||
• (3x3)XYZ still becomes XYZXYZXYZ, as the decompressed section contains no markers.
|
||||
• X(8x2)(3x3)ABCY becomes XABCABCABCABCABCABCY, because the decompressed data from the (8x2) marker is then further decompressed,
|
||||
thus triggering the (3x3) marker twice for a total of six ABC sequences.
|
||||
• (27x12)(20x12)(13x14)(7x10)(1x12)A decompresses into a string of A repeated 241920 times.
|
||||
• (25x3)(3x3)ABC(2x3)XY(5x2)PQRSTX(18x9)(3x2)TWO(5x7)SEVEN becomes 445 characters long.
|
||||
|
||||
Unfortunately, the computer you brought probably doesn't have enough memory to actually decompress the file; you'll have to come up
|
||||
with another way to get its decompressed length.
|
||||
|
||||
What is the decompressed length of the file using this improved format?
|
||||
|
||||
Although it hasn't changed, you can still get your puzzle input.
|
||||
|
||||
Answer: _____________________ [ [Submit] ]
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/day/9/input
|
231
2016/day10/input
Normal file
231
2016/day10/input
Normal file
@@ -0,0 +1,231 @@
|
||||
bot 59 gives low to bot 176 and high to bot 120
|
||||
bot 92 gives low to bot 42 and high to bot 187
|
||||
value 31 goes to bot 114
|
||||
bot 182 gives low to bot 49 and high to bot 176
|
||||
bot 17 gives low to bot 181 and high to bot 162
|
||||
bot 36 gives low to bot 118 and high to bot 121
|
||||
bot 118 gives low to bot 164 and high to bot 55
|
||||
bot 172 gives low to bot 79 and high to bot 123
|
||||
bot 51 gives low to bot 60 and high to bot 31
|
||||
bot 48 gives low to bot 107 and high to bot 58
|
||||
bot 142 gives low to output 6 and high to bot 35
|
||||
bot 133 gives low to output 4 and high to bot 47
|
||||
bot 134 gives low to bot 122 and high to bot 66
|
||||
bot 106 gives low to bot 155 and high to bot 99
|
||||
bot 77 gives low to bot 93 and high to bot 84
|
||||
bot 9 gives low to bot 173 and high to bot 197
|
||||
bot 64 gives low to bot 123 and high to bot 48
|
||||
bot 177 gives low to bot 21 and high to bot 132
|
||||
bot 94 gives low to bot 6 and high to bot 25
|
||||
bot 126 gives low to bot 193 and high to bot 56
|
||||
bot 74 gives low to bot 187 and high to bot 125
|
||||
bot 80 gives low to bot 41 and high to bot 191
|
||||
bot 62 gives low to bot 157 and high to bot 138
|
||||
bot 66 gives low to bot 1 and high to bot 209
|
||||
bot 90 gives low to bot 104 and high to bot 34
|
||||
bot 68 gives low to bot 23 and high to bot 87
|
||||
bot 121 gives low to bot 55 and high to bot 126
|
||||
bot 122 gives low to bot 137 and high to bot 1
|
||||
bot 209 gives low to bot 168 and high to bot 26
|
||||
bot 141 gives low to bot 170 and high to bot 6
|
||||
bot 149 gives low to bot 62 and high to bot 13
|
||||
bot 120 gives low to bot 179 and high to bot 71
|
||||
bot 160 gives low to bot 194 and high to bot 151
|
||||
bot 86 gives low to bot 96 and high to bot 106
|
||||
value 13 goes to bot 9
|
||||
bot 180 gives low to bot 189 and high to bot 27
|
||||
value 67 goes to bot 88
|
||||
bot 169 gives low to bot 99 and high to bot 159
|
||||
bot 56 gives low to bot 98 and high to bot 147
|
||||
bot 197 gives low to bot 174 and high to bot 81
|
||||
bot 57 gives low to bot 113 and high to bot 179
|
||||
bot 39 gives low to bot 115 and high to bot 3
|
||||
bot 79 gives low to bot 22 and high to bot 40
|
||||
bot 161 gives low to output 14 and high to bot 185
|
||||
bot 21 gives low to bot 114 and high to bot 119
|
||||
bot 136 gives low to bot 28 and high to bot 158
|
||||
bot 105 gives low to bot 89 and high to bot 19
|
||||
bot 168 gives low to bot 126 and high to bot 26
|
||||
bot 193 gives low to bot 64 and high to bot 98
|
||||
bot 186 gives low to bot 86 and high to bot 178
|
||||
value 11 goes to bot 165
|
||||
bot 33 gives low to bot 116 and high to bot 150
|
||||
bot 32 gives low to bot 154 and high to bot 206
|
||||
bot 166 gives low to bot 33 and high to bot 139
|
||||
value 7 goes to bot 63
|
||||
bot 203 gives low to bot 172 and high to bot 64
|
||||
bot 200 gives low to bot 94 and high to bot 25
|
||||
value 43 goes to bot 76
|
||||
bot 145 gives low to bot 103 and high to bot 128
|
||||
bot 119 gives low to bot 186 and high to bot 97
|
||||
bot 12 gives low to bot 31 and high to bot 4
|
||||
bot 23 gives low to bot 198 and high to bot 171
|
||||
bot 34 gives low to bot 10 and high to bot 20
|
||||
bot 198 gives low to bot 43 and high to bot 17
|
||||
bot 50 gives low to output 1 and high to bot 127
|
||||
bot 155 gives low to bot 191 and high to bot 32
|
||||
bot 206 gives low to bot 12 and high to bot 43
|
||||
bot 96 gives low to bot 80 and high to bot 155
|
||||
bot 93 gives low to bot 44 and high to bot 70
|
||||
bot 24 gives low to bot 85 and high to bot 83
|
||||
bot 30 gives low to bot 159 and high to bot 68
|
||||
bot 55 gives low to bot 203 and high to bot 193
|
||||
bot 199 gives low to bot 68 and high to bot 135
|
||||
bot 170 gives low to bot 97 and high to bot 5
|
||||
bot 65 gives low to bot 152 and high to bot 194
|
||||
bot 43 gives low to bot 4 and high to bot 181
|
||||
bot 113 gives low to output 9 and high to bot 161
|
||||
bot 81 gives low to bot 141 and high to bot 94
|
||||
value 29 goes to bot 7
|
||||
bot 46 gives low to bot 175 and high to bot 195
|
||||
value 47 goes to bot 21
|
||||
value 23 goes to bot 42
|
||||
bot 13 gives low to bot 138 and high to bot 61
|
||||
bot 135 gives low to bot 87 and high to bot 111
|
||||
bot 194 gives low to bot 190 and high to bot 82
|
||||
value 73 goes to bot 109
|
||||
bot 154 gives low to bot 51 and high to bot 12
|
||||
bot 1 gives low to bot 18 and high to bot 209
|
||||
bot 98 gives low to bot 48 and high to bot 45
|
||||
bot 147 gives low to bot 45 and high to bot 95
|
||||
bot 47 gives low to output 19 and high to bot 152
|
||||
bot 26 gives low to bot 56 and high to bot 147
|
||||
bot 179 gives low to bot 161 and high to bot 71
|
||||
bot 148 gives low to bot 204 and high to bot 137
|
||||
bot 5 gives low to bot 67 and high to bot 85
|
||||
bot 174 gives low to bot 132 and high to bot 141
|
||||
bot 8 gives low to bot 13 and high to bot 75
|
||||
bot 82 gives low to bot 146 and high to bot 22
|
||||
bot 123 gives low to bot 40 and high to bot 107
|
||||
bot 99 gives low to bot 32 and high to bot 201
|
||||
bot 41 gives low to bot 196 and high to bot 192
|
||||
bot 139 gives low to bot 150 and high to bot 153
|
||||
bot 11 gives low to output 16 and high to bot 113
|
||||
bot 72 gives low to bot 65 and high to bot 160
|
||||
bot 195 gives low to bot 133 and high to bot 183
|
||||
bot 54 gives low to output 12 and high to output 10
|
||||
bot 158 gives low to bot 102 and high to bot 110
|
||||
bot 112 gives low to bot 19 and high to bot 118
|
||||
bot 31 gives low to bot 208 and high to bot 143
|
||||
bot 167 gives low to bot 7 and high to bot 96
|
||||
bot 63 gives low to bot 92 and high to bot 74
|
||||
bot 116 gives low to bot 20 and high to bot 131
|
||||
bot 184 gives low to bot 39 and high to bot 3
|
||||
bot 162 gives low to bot 205 and high to bot 39
|
||||
bot 108 gives low to output 11 and high to bot 175
|
||||
value 53 goes to bot 207
|
||||
bot 111 gives low to bot 202 and high to bot 184
|
||||
bot 25 gives low to bot 24 and high to bot 83
|
||||
value 71 goes to bot 77
|
||||
bot 69 gives low to bot 142 and high to bot 0
|
||||
bot 146 gives low to output 13 and high to bot 53
|
||||
bot 7 gives low to bot 76 and high to bot 80
|
||||
bot 131 gives low to bot 73 and high to bot 204
|
||||
bot 102 gives low to bot 195 and high to bot 117
|
||||
bot 76 gives low to bot 165 and high to bot 41
|
||||
bot 153 gives low to bot 148 and high to bot 122
|
||||
bot 208 gives low to bot 90 and high to bot 163
|
||||
bot 70 gives low to bot 144 and high to bot 78
|
||||
bot 125 gives low to bot 8 and high to bot 156
|
||||
bot 83 gives low to bot 199 and high to bot 135
|
||||
bot 75 gives low to bot 61 and high to bot 104
|
||||
bot 67 gives low to bot 169 and high to bot 30
|
||||
bot 14 gives low to bot 81 and high to bot 200
|
||||
bot 159 gives low to bot 201 and high to bot 23
|
||||
value 3 goes to bot 93
|
||||
bot 110 gives low to bot 117 and high to bot 89
|
||||
bot 128 gives low to bot 129 and high to bot 182
|
||||
bot 87 gives low to bot 171 and high to bot 111
|
||||
bot 45 gives low to bot 58 and high to bot 95
|
||||
bot 4 gives low to bot 143 and high to bot 166
|
||||
bot 60 gives low to bot 156 and high to bot 208
|
||||
bot 27 gives low to bot 108 and high to bot 46
|
||||
bot 42 gives low to bot 207 and high to bot 149
|
||||
bot 117 gives low to bot 183 and high to bot 72
|
||||
bot 115 gives low to bot 153 and high to bot 134
|
||||
bot 140 gives low to bot 125 and high to bot 60
|
||||
bot 173 gives low to bot 177 and high to bot 174
|
||||
bot 138 gives low to bot 180 and high to bot 52
|
||||
bot 100 gives low to bot 38 and high to bot 59
|
||||
value 41 goes to bot 173
|
||||
value 59 goes to bot 177
|
||||
bot 165 gives low to bot 63 and high to bot 196
|
||||
bot 84 gives low to bot 70 and high to bot 78
|
||||
bot 2 gives low to bot 160 and high to bot 91
|
||||
value 61 goes to bot 29
|
||||
bot 114 gives low to bot 109 and high to bot 186
|
||||
bot 205 gives low to bot 139 and high to bot 115
|
||||
bot 175 gives low to output 17 and high to bot 133
|
||||
bot 176 gives low to bot 57 and high to bot 120
|
||||
bot 107 gives low to bot 124 and high to bot 15
|
||||
bot 52 gives low to bot 27 and high to bot 28
|
||||
bot 103 gives low to bot 50 and high to bot 129
|
||||
bot 150 gives low to bot 131 and high to bot 148
|
||||
bot 16 gives low to output 20 and high to bot 189
|
||||
bot 190 gives low to output 18 and high to bot 146
|
||||
bot 157 gives low to bot 16 and high to bot 180
|
||||
bot 10 gives low to bot 158 and high to bot 130
|
||||
bot 202 gives low to bot 162 and high to bot 184
|
||||
bot 88 gives low to bot 77 and high to bot 84
|
||||
bot 188 gives low to bot 128 and high to bot 38
|
||||
bot 58 gives low to bot 15 and high to bot 101
|
||||
bot 171 gives low to bot 17 and high to bot 202
|
||||
bot 97 gives low to bot 178 and high to bot 67
|
||||
bot 163 gives low to bot 34 and high to bot 116
|
||||
bot 124 gives low to bot 0 and high to bot 145
|
||||
bot 71 gives low to bot 185 and high to bot 54
|
||||
bot 78 gives low to bot 14 and high to bot 200
|
||||
bot 101 gives low to bot 188 and high to bot 100
|
||||
bot 189 gives low to output 7 and high to bot 108
|
||||
bot 95 gives low to bot 101 and high to bot 100
|
||||
bot 0 gives low to bot 35 and high to bot 103
|
||||
bot 207 gives low to bot 37 and high to bot 62
|
||||
bot 49 gives low to bot 11 and high to bot 57
|
||||
bot 85 gives low to bot 30 and high to bot 199
|
||||
bot 89 gives low to bot 72 and high to bot 2
|
||||
bot 3 gives low to bot 134 and high to bot 66
|
||||
bot 181 gives low to bot 166 and high to bot 205
|
||||
bot 91 gives low to bot 151 and high to bot 172
|
||||
value 17 goes to bot 167
|
||||
bot 20 gives low to bot 130 and high to bot 73
|
||||
bot 196 gives low to bot 74 and high to bot 140
|
||||
bot 18 gives low to bot 121 and high to bot 168
|
||||
bot 185 gives low to output 15 and high to bot 54
|
||||
bot 178 gives low to bot 106 and high to bot 169
|
||||
bot 129 gives low to bot 127 and high to bot 49
|
||||
bot 19 gives low to bot 2 and high to bot 164
|
||||
bot 15 gives low to bot 145 and high to bot 188
|
||||
bot 144 gives low to bot 197 and high to bot 14
|
||||
bot 201 gives low to bot 206 and high to bot 198
|
||||
bot 164 gives low to bot 91 and high to bot 203
|
||||
bot 73 gives low to bot 105 and high to bot 112
|
||||
bot 191 gives low to bot 192 and high to bot 154
|
||||
bot 109 gives low to bot 167 and high to bot 86
|
||||
bot 151 gives low to bot 82 and high to bot 79
|
||||
bot 53 gives low to output 2 and high to bot 142
|
||||
bot 37 gives low to bot 29 and high to bot 157
|
||||
value 2 goes to bot 44
|
||||
bot 204 gives low to bot 112 and high to bot 36
|
||||
bot 40 gives low to bot 69 and high to bot 124
|
||||
bot 22 gives low to bot 53 and high to bot 69
|
||||
bot 104 gives low to bot 136 and high to bot 10
|
||||
value 19 goes to bot 88
|
||||
bot 127 gives low to output 5 and high to bot 11
|
||||
bot 183 gives low to bot 47 and high to bot 65
|
||||
bot 192 gives low to bot 140 and high to bot 51
|
||||
bot 38 gives low to bot 182 and high to bot 59
|
||||
bot 61 gives low to bot 52 and high to bot 136
|
||||
bot 156 gives low to bot 75 and high to bot 90
|
||||
value 37 goes to bot 37
|
||||
bot 28 gives low to bot 46 and high to bot 102
|
||||
bot 187 gives low to bot 149 and high to bot 8
|
||||
bot 132 gives low to bot 119 and high to bot 170
|
||||
bot 44 gives low to bot 9 and high to bot 144
|
||||
bot 29 gives low to output 0 and high to bot 16
|
||||
bot 6 gives low to bot 5 and high to bot 24
|
||||
bot 137 gives low to bot 36 and high to bot 18
|
||||
bot 130 gives low to bot 110 and high to bot 105
|
||||
value 5 goes to bot 92
|
||||
bot 35 gives low to output 3 and high to bot 50
|
||||
bot 152 gives low to output 8 and high to bot 190
|
||||
bot 143 gives low to bot 163 and high to bot 33
|
119
2016/day10/main.go
Normal file
119
2016/day10/main.go
Normal file
@@ -0,0 +1,119 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var allBots []Bot
|
||||
var watch1, watch2 int
|
||||
|
||||
//var outputBins map[int][]int
|
||||
|
||||
func main() {
|
||||
input := stdinToStringSlice()
|
||||
watch1 = 61
|
||||
watch2 = 17
|
||||
//outputBins := make(map[int][]int)
|
||||
for i := range input {
|
||||
inst := strings.Fields(input[i])
|
||||
if inst[0] == "bot" {
|
||||
// And instruction
|
||||
// make sure we have this bot
|
||||
botNum := inst[0] + inst[1]
|
||||
botIdx := findBotIdx(botNum)
|
||||
allBots[botIdx].giveLowTo = inst[5] + inst[6]
|
||||
allBots[botIdx].giveHighTo = inst[10] + inst[11]
|
||||
}
|
||||
}
|
||||
// Run sim
|
||||
for i := range input {
|
||||
inst := strings.Fields(input[i])
|
||||
if inst[0] == "value" {
|
||||
val := atoi(inst[1])
|
||||
botNum := inst[4] + inst[5]
|
||||
botIdx := findBotIdx(botNum)
|
||||
allBots[botIdx].chips = append(allBots[botIdx].chips, val)
|
||||
allBots[botIdx].Trigger()
|
||||
}
|
||||
}
|
||||
for i := range allBots {
|
||||
fmt.Println(allBots[i])
|
||||
}
|
||||
}
|
||||
|
||||
func findBotIdx(id string) int {
|
||||
fmt.Println("Find bot", id)
|
||||
for i := range allBots {
|
||||
if allBots[i].id == id {
|
||||
return i
|
||||
}
|
||||
}
|
||||
// We didn't find the bot
|
||||
b := new(Bot)
|
||||
b.id = id
|
||||
allBots = append(allBots, *b)
|
||||
return len(allBots) - 1
|
||||
}
|
||||
|
||||
type Bot struct {
|
||||
id string
|
||||
chips []int
|
||||
giveLowTo string
|
||||
giveHighTo string
|
||||
}
|
||||
|
||||
func (b *Bot) Trigger() {
|
||||
if strings.HasPrefix(b.id, "output") {
|
||||
return
|
||||
}
|
||||
if len(b.chips) == 2 {
|
||||
low := b.chips[0]
|
||||
high := b.chips[1]
|
||||
if b.chips[0] > b.chips[1] {
|
||||
high = b.chips[0]
|
||||
low = b.chips[1]
|
||||
}
|
||||
|
||||
giveLowIdx := findBotIdx(b.giveLowTo)
|
||||
allBots[giveLowIdx].chips = append(allBots[giveLowIdx].chips, low)
|
||||
|
||||
giveHighIdx := findBotIdx(b.giveHighTo)
|
||||
allBots[giveHighIdx].chips = append(allBots[giveHighIdx].chips, high)
|
||||
|
||||
allBots[giveLowIdx].Trigger()
|
||||
allBots[giveHighIdx].Trigger()
|
||||
}
|
||||
}
|
||||
|
||||
func checkWatches(b *Bot) {
|
||||
if b.chips[0] == watch1 && b.chips[1] == watch2 || b.chips[0] == watch1 && b.chips[1] == watch2 {
|
||||
fmt.Println("Watch triggered:", b.id)
|
||||
}
|
||||
}
|
||||
|
||||
func stdinToStringSlice() []string {
|
||||
var input []string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input = append(input, scanner.Text())
|
||||
}
|
||||
return input
|
||||
}
|
||||
|
||||
func itoa(i int) string {
|
||||
return strconv.Itoa(i)
|
||||
}
|
||||
|
||||
func atoi(i string) int {
|
||||
var ret int
|
||||
var err error
|
||||
if ret, err = strconv.Atoi(i); err != nil {
|
||||
log.Fatal("Invalid Atoi")
|
||||
}
|
||||
return ret
|
||||
}
|
70
2016/day10/problem
Normal file
70
2016/day10/problem
Normal file
@@ -0,0 +1,70 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 10: Balance Bots ---
|
||||
|
||||
You come upon a factory in which many robots are zooming around handing small microchips to
|
||||
each other.
|
||||
|
||||
Upon closer examination, you notice that each bot only proceeds when it has two microchips,
|
||||
and once it does, it gives each one to a different bot or puts it in a marked "output" bin.
|
||||
Sometimes, bots take microchips from "input" bins, too.
|
||||
|
||||
Inspecting one of the microchips, it seems like they each contain a single number; the bots
|
||||
must use some logic to decide what to do with each chip. You access the local control computer
|
||||
and download the bots' instructions (your puzzle input).
|
||||
|
||||
Some of the instructions specify that a specific-valued microchip should be given to a
|
||||
specific bot; the rest of the instructions indicate what a given bot should do with its
|
||||
lower-value or higher-value chip.
|
||||
|
||||
For example, consider the following instructions:
|
||||
|
||||
value 5 goes to bot 2
|
||||
bot 2 gives low to bot 1 and high to bot 0
|
||||
value 3 goes to bot 1
|
||||
bot 1 gives low to output 1 and high to bot 0
|
||||
bot 0 gives low to output 2 and high to output 0
|
||||
value 2 goes to bot 2
|
||||
|
||||
• Initially, bot 1 starts with a value-3 chip, and bot 2 starts with a value-2 chip and a
|
||||
value-5 chip.
|
||||
• Because bot 2 has two microchips, it gives its lower one (2) to bot 1 and its higher one
|
||||
(5) to bot 0.
|
||||
• Then, bot 1 has two microchips; it puts the value-2 chip in output 1 and gives the value-3
|
||||
chip to bot 0.
|
||||
• Finally, bot 0 has two microchips; it puts the 3 in output 2 and the 5 in output 0.
|
||||
|
||||
In the end, output bin 0 contains a value-5 microchip, output bin 1 contains a value-2
|
||||
microchip, and output bin 2 contains a value-3 microchip. In this configuration, bot number 2
|
||||
is responsible for comparing value-5 microchips with value-2 microchips.
|
||||
|
||||
Based on your instructions, what is the number of the bot that is responsible for comparing
|
||||
value-61 microchips with value-17 microchips?
|
||||
|
||||
Your puzzle answer was ______.
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
What do you get if you multiply together the values of one chip in each of outputs 0, 1, and
|
||||
2?
|
||||
|
||||
Your puzzle answer was _______.
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. https://www.youtube.com/watch?v=JnkMyfQ5YfY&t=40
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/day/10/input
|
4
2016/day11-add/input
Normal file
4
2016/day11-add/input
Normal file
@@ -0,0 +1,4 @@
|
||||
The first floor contains a thulium generator, a thulium-compatible microchip, a plutonium generator, and a strontium generator.
|
||||
The second floor contains a plutonium-compatible microchip, and a strontium-compatible microchip.
|
||||
The third floor contains a promethium generator, a promethium-compatible microchip, a ruthenium generator, and a ruthenium-compatible microchip.
|
||||
The fourth floor contains nothing relevant.
|
176
2016/day11-add/main.go
Normal file
176
2016/day11-add/main.go
Normal file
@@ -0,0 +1,176 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/fatih/color"
|
||||
termbox "github.com/nsf/termbox-go"
|
||||
)
|
||||
|
||||
var elevatorFloor int
|
||||
var floorInv [][]string
|
||||
var componentRegistry []string
|
||||
var cursorPosX, cursorPosY int
|
||||
var selectItems []string
|
||||
|
||||
// This code requires oxford commas in the input
|
||||
func main() {
|
||||
input := stdinToStringSlice()
|
||||
for i := range input {
|
||||
listIdx := strings.Index(input[i], "a ")
|
||||
if listIdx == -1 {
|
||||
floorInv = append(floorInv, []string{})
|
||||
continue
|
||||
}
|
||||
input[i] = input[i][listIdx:]
|
||||
floorInv = append(floorInv, strings.Split(input[i], ", "))
|
||||
}
|
||||
for i := range floorInv {
|
||||
for j := range floorInv[i] {
|
||||
tp := "G"
|
||||
if strings.Contains(floorInv[i][j], "microchip") {
|
||||
tp = "M"
|
||||
}
|
||||
floorInv[i][j] = strings.TrimPrefix(floorInv[i][j], "a ")
|
||||
floorInv[i][j] = strings.TrimPrefix(floorInv[i][j], "and a ")
|
||||
ele := strings.ToUpper(floorInv[i][j][:2])
|
||||
floorInv[i][j] = ele + ":" + tp
|
||||
componentRegistry = append(componentRegistry, floorInv[i][j])
|
||||
}
|
||||
}
|
||||
|
||||
err := termbox.Init()
|
||||
if err != nil {
|
||||
fmt.Println("Error initializing termbox")
|
||||
os.Exit(1)
|
||||
}
|
||||
defer termbox.Close()
|
||||
|
||||
eventQueue := make(chan termbox.Event)
|
||||
go func() {
|
||||
for {
|
||||
eventQueue <- termbox.PollEvent()
|
||||
}
|
||||
}()
|
||||
|
||||
PrintScreen()
|
||||
var doQuit bool
|
||||
for {
|
||||
select {
|
||||
case ev := <-eventQueue:
|
||||
if ev.Type == termbox.EventKey {
|
||||
switch {
|
||||
case ev.Key == termbox.KeyArrowLeft:
|
||||
if cursorPosX > 0 {
|
||||
cursorPosX--
|
||||
}
|
||||
case ev.Key == termbox.KeyArrowRight:
|
||||
if cursorPosX < len(componentRegistry)-1 {
|
||||
cursorPosX++
|
||||
}
|
||||
case ev.Ch == 'q':
|
||||
doQuit = true
|
||||
}
|
||||
}
|
||||
ClearScreen()
|
||||
PrintScreen()
|
||||
}
|
||||
if doQuit {
|
||||
break
|
||||
}
|
||||
}
|
||||
//fmt.Println("Registered Components: ", componentRegistry)
|
||||
|
||||
// a microchip without it's generator cannot be on the same floor
|
||||
// as a different microchip that _does_ have it's generator
|
||||
|
||||
// Look at what we have on the lowest floor with items
|
||||
// For each microchip, find it's generator
|
||||
// if it's on this floor, take them both up a floor
|
||||
// If we have microchips, see where their generators are
|
||||
// If they are with us, take both and move up
|
||||
// If they are one floor above,
|
||||
}
|
||||
|
||||
func SelectItem() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func FloorHasComponent(flr int, cmp string) bool {
|
||||
for i := range floorInv[flr] {
|
||||
if floorInv[flr][i] == cmp {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func MoveElevator(dir int, take []string) error {
|
||||
if len(take) < 1 || len(take) > 2 {
|
||||
return errors.New("Error tried to move with invalid number of items: " + itoa(len(take)))
|
||||
}
|
||||
// Are the requested items on the current floor?
|
||||
// If so, move them to the floor we're going to
|
||||
for j := range take {
|
||||
if FloorHasComponent(elevatorFloor, take[j]) {
|
||||
// TODO: Move the component
|
||||
floorInv[elevatorFloor+dir] = append(floorInv[elevatorFloor+dir], take[j])
|
||||
} else {
|
||||
return errors.New("Elevator tried to take " + take[j] + " but it's not on floor " + itoa(elevatorFloor+1))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ClearScreen() {
|
||||
fmt.Print("\033[H\033[2J")
|
||||
}
|
||||
|
||||
func PrintScreen() {
|
||||
c := color.New(color.FgCyan)
|
||||
w := color.New(color.FgWhite)
|
||||
g := color.New(color.FgGreen)
|
||||
g.Add(color.Bold)
|
||||
for i := len(floorInv); i > 0; i-- {
|
||||
c.Printf("F%d ", i)
|
||||
if elevatorFloor == i-1 {
|
||||
c.Print("E ")
|
||||
} else {
|
||||
w.Print(". ")
|
||||
}
|
||||
for cr := range componentRegistry {
|
||||
out := ". "
|
||||
for j := range floorInv[i-1] {
|
||||
if floorInv[i-1][j] == componentRegistry[cr] {
|
||||
out = componentRegistry[cr] + " "
|
||||
break
|
||||
}
|
||||
}
|
||||
if elevatorFloor == i-1 && cursorPosX == cr {
|
||||
g.Print(out)
|
||||
} else {
|
||||
w.Print(out)
|
||||
}
|
||||
}
|
||||
w.Println("")
|
||||
}
|
||||
w.Println("")
|
||||
}
|
||||
|
||||
func stdinToStringSlice() []string {
|
||||
var input []string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input = append(input, scanner.Text())
|
||||
}
|
||||
return input
|
||||
}
|
||||
|
||||
func itoa(i int) string {
|
||||
return strconv.Itoa(i)
|
||||
}
|
4
2016/day11-add/testinput
Normal file
4
2016/day11-add/testinput
Normal file
@@ -0,0 +1,4 @@
|
||||
The first floor contains a hydrogen-compatible microchip, and a lithium-compatible microchip.
|
||||
The second floor contains a hydrogen generator.
|
||||
The third floor contains a lithium generator.
|
||||
The fourth floor contains nothing relevant.
|
4
2016/day11/input-part1
Normal file
4
2016/day11/input-part1
Normal file
@@ -0,0 +1,4 @@
|
||||
The first floor contains a thulium generator, a thulium-compatible microchip, a plutonium generator, and a strontium generator.
|
||||
The second floor contains a plutonium-compatible microchip, and a strontium-compatible microchip.
|
||||
The third floor contains a promethium generator, a promethium-compatible microchip, a ruthenium generator, and a ruthenium-compatible microchip.
|
||||
The fourth floor contains nothing relevant.
|
4
2016/day11/input-part2
Normal file
4
2016/day11/input-part2
Normal file
@@ -0,0 +1,4 @@
|
||||
The first floor contains a elerium generator, a elerium-compatible microchip, a dilithium generator, a dilitium-compatible microchip, a thulium generator, a thulium-compatible microchip, a plutonium generator, and a strontium generator.
|
||||
The second floor contains a plutonium-compatible microchip, and a strontium-compatible microchip.
|
||||
The third floor contains a promethium generator, a promethium-compatible microchip, a ruthenium generator, and a ruthenium-compatible microchip.
|
||||
The fourth floor contains nothing relevant.
|
157
2016/day11/main.go
Normal file
157
2016/day11/main.go
Normal file
@@ -0,0 +1,157 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
// This is a purely mathematical solution to this problem
|
||||
// We don't care about what the elements are.
|
||||
// Loop on each floor and consider:
|
||||
// 1: We have less than 3 items on the floor
|
||||
// So move them all up; 1 total move
|
||||
// 2: We have more than 3 items on the floor
|
||||
// So move two up and one back down; 2 total moves
|
||||
|
||||
// Setting visual to true will output what's happening
|
||||
var visual bool
|
||||
|
||||
func main() {
|
||||
input := stdinToStringSlice()
|
||||
var numMoves int
|
||||
if !visual {
|
||||
var lvlItmCnts []int
|
||||
for i := range input {
|
||||
lvlItmCnts = append(lvlItmCnts, strings.Count(input[i], "generator")+strings.Count(input[i], "microchip"))
|
||||
}
|
||||
for i := 0; i < 3; i++ {
|
||||
for lvlItmCnts[i] > 0 {
|
||||
if lvlItmCnts[i] < 3 {
|
||||
lvlItmCnts[i+1] = lvlItmCnts[i+1] + lvlItmCnts[i]
|
||||
lvlItmCnts[i] = 0
|
||||
numMoves++
|
||||
} else {
|
||||
lvlItmCnts[i] = lvlItmCnts[i] - 1
|
||||
lvlItmCnts[i+1] = lvlItmCnts[i+1] + 1
|
||||
numMoves = numMoves + 2
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Visual mode spits a lot more stuff out, so it has
|
||||
// to track a lot more things...
|
||||
numMoves = VisualMode(input)
|
||||
}
|
||||
fmt.Println("Number of moves:", numMoves)
|
||||
}
|
||||
|
||||
func VisualMode(input []string) int {
|
||||
// This code requires oxford commas in the input :)
|
||||
var elevatorFloor int
|
||||
var floorInv [][]string
|
||||
var componentRegistry []string
|
||||
for i := range input {
|
||||
listIdx := strings.Index(input[i], "a ")
|
||||
if listIdx == -1 {
|
||||
floorInv = append(floorInv, []string{})
|
||||
continue
|
||||
}
|
||||
input[i] = input[i][listIdx:]
|
||||
floorInv = append(floorInv, strings.Split(input[i], ", "))
|
||||
}
|
||||
for i := range floorInv {
|
||||
elevatorFloor = i
|
||||
for j := range floorInv[i] {
|
||||
tp := "G"
|
||||
if strings.Contains(floorInv[i][j], "microchip") {
|
||||
tp = "M"
|
||||
}
|
||||
floorInv[i][j] = strings.TrimPrefix(floorInv[i][j], "a ")
|
||||
floorInv[i][j] = strings.TrimPrefix(floorInv[i][j], "and a ")
|
||||
ele := strings.ToUpper(floorInv[i][j][:2])
|
||||
floorInv[i][j] = ele + ":" + tp
|
||||
componentRegistry = append(componentRegistry, floorInv[i][j])
|
||||
}
|
||||
}
|
||||
var numMoves int
|
||||
var pt1, pt2 string
|
||||
for i := 0; i < len(floorInv)-1; i++ {
|
||||
for len(floorInv[i]) > 1 {
|
||||
if len(floorInv[i]) > 1 {
|
||||
// If there are exactly two items on the floor, move them up
|
||||
if len(floorInv[i]) == 2 {
|
||||
pt1, pt2, floorInv[i] = floorInv[i][0], floorInv[i][1], floorInv[i][2:]
|
||||
floorInv[i+1] = append(floorInv[i+1], pt1, pt2)
|
||||
numMoves++
|
||||
} else if len(floorInv[i]) > 2 {
|
||||
// If more than two, move one up, but add 2 to the move
|
||||
// To simulate, moving two up then one back down
|
||||
pt1, floorInv[i] = floorInv[i][0], floorInv[i][1:]
|
||||
floorInv[i+1] = append(floorInv[i+1], pt1)
|
||||
numMoves = numMoves + 2
|
||||
}
|
||||
} else {
|
||||
// Only one left on floor, move it up
|
||||
pt1, floorInv[i] = floorInv[i][0], []string{}
|
||||
floorInv[i+1] = append(floorInv[i+1], pt1, pt2)
|
||||
numMoves++
|
||||
}
|
||||
if visual {
|
||||
ClearScreen()
|
||||
PrintScreen(floorInv, elevatorFloor, componentRegistry)
|
||||
time.Sleep(time.Millisecond * 250)
|
||||
}
|
||||
}
|
||||
}
|
||||
return numMoves
|
||||
}
|
||||
|
||||
func ClearScreen() {
|
||||
fmt.Print("\033[H\033[2J")
|
||||
}
|
||||
|
||||
func PrintScreen(floorInv [][]string, elevatorFloor int, componentRegistry []string) {
|
||||
c := color.New(color.FgCyan)
|
||||
w := color.New(color.FgWhite)
|
||||
for i := len(floorInv); i > 0; i-- {
|
||||
c.Printf("F%d ", i)
|
||||
if elevatorFloor == i-1 {
|
||||
c.Print("E ")
|
||||
} else {
|
||||
w.Print(". ")
|
||||
}
|
||||
for cr := range componentRegistry {
|
||||
var fnd bool
|
||||
for j := range floorInv[i-1] {
|
||||
if floorInv[i-1][j] == componentRegistry[cr] {
|
||||
fnd = true
|
||||
fmt.Print(componentRegistry[cr] + " ")
|
||||
break
|
||||
}
|
||||
}
|
||||
if !fnd {
|
||||
fmt.Print(". ")
|
||||
}
|
||||
}
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
|
||||
func stdinToStringSlice() []string {
|
||||
var input []string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input = append(input, scanner.Text())
|
||||
}
|
||||
return input
|
||||
}
|
||||
|
||||
func itoa(i int) string {
|
||||
return strconv.Itoa(i)
|
||||
}
|
23
2016/day12/input
Normal file
23
2016/day12/input
Normal file
@@ -0,0 +1,23 @@
|
||||
cpy 1 a
|
||||
cpy 1 b
|
||||
cpy 26 d
|
||||
jnz c 2
|
||||
jnz 1 5
|
||||
cpy 7 c
|
||||
inc d
|
||||
dec c
|
||||
jnz c -2
|
||||
cpy a c
|
||||
inc a
|
||||
dec b
|
||||
jnz b -2
|
||||
cpy c b
|
||||
dec d
|
||||
jnz d -6
|
||||
cpy 19 c
|
||||
cpy 14 d
|
||||
inc a
|
||||
dec d
|
||||
jnz d -2
|
||||
dec c
|
||||
jnz c -5
|
78
2016/day12/main.go
Normal file
78
2016/day12/main.go
Normal file
@@ -0,0 +1,78 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var regs = map[string]int{
|
||||
"a": 0,
|
||||
"b": 0,
|
||||
"c": 1,
|
||||
"d": 0,
|
||||
}
|
||||
|
||||
func main() {
|
||||
input := stdinToStringSlice()
|
||||
curr := 0
|
||||
for curr < len(input) {
|
||||
ins := strings.Fields(input[curr])
|
||||
curr++
|
||||
switch ins[0] {
|
||||
case "cpy":
|
||||
src := ins[1]
|
||||
dst := ins[2]
|
||||
// check if the src is a register
|
||||
if v, ok := regs[src]; ok {
|
||||
regs[dst] = v
|
||||
} else {
|
||||
// It's not, must be an int
|
||||
regs[dst] = atoi(src)
|
||||
}
|
||||
case "inc":
|
||||
regs[ins[1]] = regs[ins[1]] + 1
|
||||
case "dec":
|
||||
regs[ins[1]] = regs[ins[1]] - 1
|
||||
case "jnz":
|
||||
v, ok := regs[ins[1]]
|
||||
if !ok {
|
||||
v = atoi(ins[1])
|
||||
}
|
||||
if v != 0 {
|
||||
// Subtract 1 from the jump because we incremented already
|
||||
curr += atoi(ins[2]) - 1
|
||||
}
|
||||
}
|
||||
}
|
||||
PrintState()
|
||||
}
|
||||
|
||||
// Fancy State Printing
|
||||
func PrintState() {
|
||||
datLine := fmt.Sprint("\u2502 a:", regs["a"], " b:", regs["b"], " c:", regs["c"], " d:", regs["d"], " \u2502")
|
||||
fmt.Println("\u250C" + strings.Repeat("\u2500", len(datLine)-6) + "\u2510")
|
||||
fmt.Println(datLine)
|
||||
fmt.Println("\u2514" + strings.Repeat("\u2500", len(datLine)-6) + "\u2518")
|
||||
}
|
||||
|
||||
func stdinToStringSlice() []string {
|
||||
var input []string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input = append(input, scanner.Text())
|
||||
}
|
||||
return input
|
||||
}
|
||||
|
||||
func atoi(i string) int {
|
||||
var ret int
|
||||
var err error
|
||||
if ret, err = strconv.Atoi(i); err != nil {
|
||||
log.Fatal("Invalid Atoi:" + i)
|
||||
}
|
||||
return ret
|
||||
}
|
78
2016/day12/problem
Normal file
78
2016/day12/problem
Normal file
@@ -0,0 +1,78 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 12: Leonardo's Monorail ---
|
||||
|
||||
You finally reach the top floor of this building: a garden with a slanted glass ceiling. Looks like there are no more
|
||||
stars to be had.
|
||||
|
||||
While sitting on a nearby bench amidst some tiger lilies, you manage to decrypt some of the files you extracted from
|
||||
the servers downstairs.
|
||||
|
||||
According to these documents, Easter Bunny HQ isn't just this building - it's a collection of buildings in the nearby
|
||||
area. They're all connected by a local monorail, and there's another building not far from here! Unfortunately, being
|
||||
night, the monorail is currently not operating.
|
||||
|
||||
You remotely connect to the monorail control systems and discover that the boot sequence expects a password. The
|
||||
password-checking logic (your puzzle input) is easy to extract, but the code it uses is strange: it's assembunny code
|
||||
designed for the new computer you just assembled. You'll have to execute the code and get the password.
|
||||
|
||||
The assembunny code you've extracted operates on four registers (a, b, c, and d) that start at 0 and can hold any
|
||||
integer. However, it seems to make use of only a few instructions:
|
||||
|
||||
• cpy x y copies x (either an integer or the value of a register) into register y.
|
||||
• inc x increases the value of register x by one.
|
||||
• dec x decreases the value of register x by one.
|
||||
• jnz x y jumps to an instruction y away (positive means forward; negative means backward), but only if x is not
|
||||
zero.
|
||||
|
||||
The jnz instruction moves relative to itself: an offset of -1 would continue at the previous instruction, while an
|
||||
offset of 2 would skip over the next instruction.
|
||||
|
||||
For example:
|
||||
|
||||
cpy 41 a
|
||||
inc a
|
||||
inc a
|
||||
dec a
|
||||
jnz a 2
|
||||
dec a
|
||||
|
||||
The above code would set register a to 41, increase its value by 2, decrease its value by 1, and then skip the last
|
||||
dec a (because a is not zero, so the jnz a 2 skips it), leaving register a at 42. When you move past the last
|
||||
instruction, the program halts.
|
||||
|
||||
After executing the assembunny code in your puzzle input, what value is left in register a?
|
||||
|
||||
Your puzzle answer was __________.
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
As you head down the fire escape to the monorail, you notice it didn't start; register c needs to be initialized to
|
||||
the position of the ignition key.
|
||||
|
||||
If you instead initialize register c to be 1, what value is now left in register a?
|
||||
|
||||
Your puzzle answer was ___________.
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. https://www.google.com/search?q=tiger+lilies&tbm=isch
|
||||
. http://adventofcode.com/2016/day/11
|
||||
. https://en.wikipedia.org/wiki/Processor_register
|
||||
. https://en.wikipedia.org/wiki/Integer
|
||||
. https://en.wikipedia.org/wiki/Instruction_set
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/day/12/input
|
341
2016/day13/main.go
Normal file
341
2016/day13/main.go
Normal file
@@ -0,0 +1,341 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
termbox "github.com/nsf/termbox-go"
|
||||
)
|
||||
|
||||
var tWidth, tHeight int
|
||||
|
||||
// Puzzle 1 Input: 1364 31 39
|
||||
// Puzzle 1 Test Input: 10 7 4
|
||||
func main() {
|
||||
mode := "solve"
|
||||
if len(os.Args) < 4 {
|
||||
fmt.Println("Usage: day13 <seed> <dest-x> <dest-y>")
|
||||
os.Exit(1)
|
||||
}
|
||||
seed := atoi(os.Args[1])
|
||||
destX, destY := atoi(os.Args[2]), atoi(os.Args[3])
|
||||
if len(os.Args) >= 5 {
|
||||
mode = os.Args[4]
|
||||
}
|
||||
f := CreateFloor(1, 1, destX, destY, seed)
|
||||
|
||||
if err := termbox.Init(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
tWidth, tHeight = termbox.Size()
|
||||
termbox.Close()
|
||||
switch mode {
|
||||
case "solve":
|
||||
if f.Solve(f.start.x, f.start.y, 0, true) {
|
||||
f.dispCoord = f.end
|
||||
}
|
||||
ClearScreen()
|
||||
f.Print()
|
||||
fmt.Println("Shortest Path:", len(f.solvePath.coords))
|
||||
case "walk":
|
||||
dist := 50
|
||||
f.Walk(f.start.x, f.start.y, 0, dist, true)
|
||||
fmt.Println("Within", dist, "steps: ", len(f.testedPath.coords))
|
||||
}
|
||||
}
|
||||
|
||||
type Coord struct {
|
||||
x, y, dist int
|
||||
}
|
||||
|
||||
func (c *Coord) Is(x, y int) bool {
|
||||
return c.x == x && c.y == y
|
||||
}
|
||||
|
||||
func (c *Coord) Equals(t *Coord) bool {
|
||||
return c.x == t.x && c.y == t.y
|
||||
}
|
||||
|
||||
func NewCoord(x, y int) *Coord {
|
||||
return &Coord{x, y, -1}
|
||||
}
|
||||
|
||||
type Path struct {
|
||||
coords []Coord
|
||||
}
|
||||
|
||||
func (p *Path) Append(c Coord) {
|
||||
p.coords = append(p.coords, c)
|
||||
}
|
||||
|
||||
func (p *Path) ContainsCoord(x, y int) bool {
|
||||
for i := range p.coords {
|
||||
if p.coords[i].Is(x, y) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *Path) GetCoordAt(x, y int) *Coord {
|
||||
for i := range p.coords {
|
||||
if p.coords[i].Is(x, y) {
|
||||
return &p.coords[i]
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Floor struct {
|
||||
start *Coord
|
||||
end *Coord
|
||||
seed int
|
||||
testedPath Path
|
||||
solvePath Path
|
||||
dispCoord *Coord
|
||||
}
|
||||
|
||||
func CreateFloor(stX, stY, endX, endY, seed int) *Floor {
|
||||
f := Floor{
|
||||
start: NewCoord(stX, stY),
|
||||
end: NewCoord(endX, endY),
|
||||
seed: seed,
|
||||
}
|
||||
return &f
|
||||
}
|
||||
|
||||
func (f *Floor) Walk(x, y, dist, maxDist int, print bool) {
|
||||
wrkCoord := Coord{x, y, dist}
|
||||
if f.IsWall(x, y) || f.testedPath.ContainsCoord(x, y) {
|
||||
return
|
||||
}
|
||||
if dist == maxDist {
|
||||
f.testedPath.Append(wrkCoord)
|
||||
return
|
||||
}
|
||||
if print {
|
||||
f.dispCoord = &wrkCoord
|
||||
ClearScreen()
|
||||
f.Print()
|
||||
fmt.Println("Tested Spots:", len(f.testedPath.coords))
|
||||
time.Sleep(time.Millisecond * 70)
|
||||
}
|
||||
if !f.IsWall(x-1, y) {
|
||||
if t := f.testedPath.GetCoordAt(x-1, y); t != nil {
|
||||
if t.dist+1 < wrkCoord.dist {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if !f.IsWall(x+1, y) {
|
||||
if t := f.testedPath.GetCoordAt(x+1, y); t != nil {
|
||||
if t.dist+1 < wrkCoord.dist {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if !f.IsWall(x, y-1) {
|
||||
if t := f.testedPath.GetCoordAt(x, y-1); t != nil {
|
||||
if t.dist+1 < wrkCoord.dist {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if !f.IsWall(x, y+1) {
|
||||
if t := f.testedPath.GetCoordAt(x, y+1); t != nil {
|
||||
if t.dist+1 < wrkCoord.dist {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
f.testedPath.Append(wrkCoord)
|
||||
// Try intelligently first
|
||||
// (Attempt to move towards the exit)
|
||||
if x > 0 {
|
||||
f.Walk(x-1, y, wrkCoord.dist+1, maxDist, print)
|
||||
}
|
||||
if y > 0 {
|
||||
f.Walk(x, y-1, wrkCoord.dist+1, maxDist, print)
|
||||
}
|
||||
f.Walk(x+1, y, wrkCoord.dist+1, maxDist, print)
|
||||
f.Walk(x, y+1, wrkCoord.dist+1, maxDist, print)
|
||||
}
|
||||
|
||||
func (f *Floor) Solve(x, y, dist int, print bool) bool {
|
||||
wrkCoord := Coord{x, y, dist}
|
||||
if f.end.Is(x, y) {
|
||||
return true
|
||||
}
|
||||
if f.IsWall(x, y) || f.testedPath.ContainsCoord(x, y) {
|
||||
return false
|
||||
}
|
||||
// Test if there is a shorter path to this coordinate
|
||||
if !f.IsWall(x-1, y) {
|
||||
if t := f.testedPath.GetCoordAt(x-1, y); t != nil {
|
||||
if t.dist+1 < wrkCoord.dist {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
if !f.IsWall(x+1, y) {
|
||||
if t := f.testedPath.GetCoordAt(x+1, y); t != nil {
|
||||
if t.dist+1 < wrkCoord.dist {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
if !f.IsWall(x, y-1) {
|
||||
if t := f.testedPath.GetCoordAt(x, y-1); t != nil {
|
||||
if t.dist+1 < wrkCoord.dist {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
if !f.IsWall(x, y+1) {
|
||||
if t := f.testedPath.GetCoordAt(x, y+1); t != nil {
|
||||
if t.dist+1 < wrkCoord.dist {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
if print {
|
||||
f.dispCoord = &wrkCoord
|
||||
ClearScreen()
|
||||
f.Print()
|
||||
fmt.Println("Tested Spots:", len(f.testedPath.coords))
|
||||
time.Sleep(time.Millisecond * 70)
|
||||
}
|
||||
f.testedPath.Append(wrkCoord)
|
||||
// Try intelligently first
|
||||
// (Attempt to move towards the exit)
|
||||
if x > f.end.x && x > 0 {
|
||||
if f.Solve(x-1, y, wrkCoord.dist+1, print) {
|
||||
f.solvePath.Append(wrkCoord)
|
||||
return true
|
||||
}
|
||||
}
|
||||
if y > f.end.y && y > 0 {
|
||||
if f.Solve(x, y-1, wrkCoord.dist+1, print) {
|
||||
f.solvePath.Append(wrkCoord)
|
||||
return true
|
||||
}
|
||||
}
|
||||
if x < f.end.x {
|
||||
if f.Solve(x+1, y, wrkCoord.dist+1, print) {
|
||||
f.solvePath.Append(wrkCoord)
|
||||
return true
|
||||
}
|
||||
}
|
||||
if y < f.end.y {
|
||||
if f.Solve(x, y+1, wrkCoord.dist+1, print) {
|
||||
f.solvePath.Append(wrkCoord)
|
||||
return true
|
||||
}
|
||||
}
|
||||
// Intelligence failed us... Just find a move
|
||||
if x > 0 {
|
||||
if f.Solve(x-1, y, wrkCoord.dist+1, print) {
|
||||
f.solvePath.Append(wrkCoord)
|
||||
return true
|
||||
}
|
||||
}
|
||||
if y > 0 {
|
||||
if f.Solve(x, y-1, wrkCoord.dist+1, print) {
|
||||
f.solvePath.Append(wrkCoord)
|
||||
return true
|
||||
}
|
||||
}
|
||||
// This is where it gets shaky...
|
||||
// Since we have an infinite maze, this could run forever
|
||||
// So we have a hard cutoff at:
|
||||
var MaxInt = int(^uint(0) >> 1)
|
||||
if len(f.testedPath.coords) >= MaxInt {
|
||||
fmt.Println("ERROR: Couldn't find a path.")
|
||||
os.Exit(1)
|
||||
}
|
||||
if f.Solve(x+1, y, wrkCoord.dist+1, print) {
|
||||
f.solvePath.Append(wrkCoord)
|
||||
return true
|
||||
}
|
||||
if f.Solve(x, y+1, wrkCoord.dist+1, print) {
|
||||
f.solvePath.Append(wrkCoord)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (f *Floor) IsWall(x, y int) bool {
|
||||
sum := (x*x + 3*x + 2*x*y + y + y*y + f.seed)
|
||||
s := fmt.Sprintf("%b", sum)
|
||||
if strings.Count(s, "1")%2 == 0 {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (f *Floor) Print() {
|
||||
wall := color.New(color.BgWhite)
|
||||
space := color.New(color.FgWhite)
|
||||
g := color.New(color.BgGreen).Add(color.FgBlack)
|
||||
g.Add(color.Bold)
|
||||
r := color.New(color.BgRed)
|
||||
b := color.New(color.BgBlue).Add(color.BgBlack)
|
||||
b.Add(color.Bold)
|
||||
topY, topX := tHeight, tWidth
|
||||
botY, botX := 0, 0
|
||||
// We want to center approx 20x20 on our current location
|
||||
// f.testedPath[len(f.testedPath)-1]?
|
||||
if len(f.testedPath.coords) > 0 {
|
||||
cntrCoord := f.testedPath.coords[len(f.testedPath.coords)-1]
|
||||
if topY < cntrCoord.y+(tHeight/2) {
|
||||
topY = cntrCoord.y + (tHeight / 2)
|
||||
}
|
||||
if topY > tHeight {
|
||||
botY = topY - tHeight
|
||||
}
|
||||
if topX < cntrCoord.x+(tWidth/2) {
|
||||
topX = cntrCoord.x + (tWidth / 2)
|
||||
}
|
||||
if topX > tWidth {
|
||||
botX = topX - tWidth
|
||||
}
|
||||
}
|
||||
for y := botY; y < topY; y++ {
|
||||
for x := botX; x < topX; x++ {
|
||||
if f.dispCoord != nil && f.dispCoord.Is(x, y) {
|
||||
g.Print("O")
|
||||
} else if f.solvePath.ContainsCoord(x, y) {
|
||||
g.Print(".")
|
||||
} else if f.testedPath.ContainsCoord(x, y) {
|
||||
r.Print(" ")
|
||||
} else {
|
||||
if f.end.Is(x, y) {
|
||||
b.Print("X")
|
||||
} else if f.IsWall(x, y) {
|
||||
wall.Print(" ")
|
||||
} else {
|
||||
space.Print(".")
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
|
||||
func ClearScreen() {
|
||||
fmt.Print("\033[H\033[2J")
|
||||
}
|
||||
|
||||
func atoi(i string) int {
|
||||
var ret int
|
||||
var err error
|
||||
if ret, err = strconv.Atoi(i); err != nil {
|
||||
log.Fatal("Invalid Atoi")
|
||||
}
|
||||
return ret
|
||||
}
|
77
2016/day13/problem
Normal file
77
2016/day13/problem
Normal file
@@ -0,0 +1,77 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 13: A Maze of Twisty Little Cubicles ---
|
||||
|
||||
You arrive at the first floor of this new building to discover a much less welcoming environment than the shiny atrium of the
|
||||
last one. Instead, you are in a maze of twisty little cubicles, all alike.
|
||||
|
||||
Every location in this area is addressed by a pair of non-negative integers (x,y). Each such coordinate is either a wall or an
|
||||
open space. You can't move diagonally. The cube maze starts at 0,0 and seems to extend infinitely toward positive x and y;
|
||||
negative values are invalid, as they represent a location outside the building. You are in a small waiting area at 1,1.
|
||||
|
||||
While it seems chaotic, a nearby morale-boosting poster explains, the layout is actually quite logical. You can determine
|
||||
whether a given x,y coordinate will be a wall or an open space using a simple system:
|
||||
|
||||
• Find x*x + 3*x + 2*x*y + y + y*y.
|
||||
• Add the office designer's favorite number (your puzzle input).
|
||||
• Find the binary representation of that sum; count the number of bits that are 1.
|
||||
|
||||
• If the number of bits that are 1 is even, it's an open space.
|
||||
• If the number of bits that are 1 is odd, it's a wall.
|
||||
|
||||
For example, if the office designer's favorite number were 10, drawing walls as # and open spaces as ., the corner of the
|
||||
building containing 0,0 would look like this:
|
||||
|
||||
0123456789
|
||||
0 .#.####.##
|
||||
1 ..#..#...#
|
||||
2 #....##...
|
||||
3 ###.#.###.
|
||||
4 .##..#..#.
|
||||
5 ..##....#.
|
||||
6 #...##.###
|
||||
|
||||
Now, suppose you wanted to reach 7,4. The shortest route you could take is marked as O:
|
||||
|
||||
0123456789
|
||||
0 .#.####.##
|
||||
1 .O#..#...#
|
||||
2 #OOO.##...
|
||||
3 ###O#.###.
|
||||
4 .##OO#OO#.
|
||||
5 ..##OOO.#.
|
||||
6 #...##.###
|
||||
|
||||
Thus, reaching 7,4 would take a minimum of 11 steps (starting from your current location, 1,1).
|
||||
|
||||
What is the fewest number of steps required for you to reach 31,39?
|
||||
|
||||
Your puzzle answer was _____.
|
||||
|
||||
The first half of this puzzle is complete! It provides one gold star: *
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
How many locations (distinct x,y coordinates, including your starting location) can you reach in at most 50 steps?
|
||||
|
||||
Your puzzle input is still 1364.
|
||||
|
||||
Answer: _____________________
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. https://en.wikipedia.org/wiki/Binary_number
|
||||
. https://en.wikipedia.org/wiki/Bit
|
82
2016/day14/main.go
Normal file
82
2016/day14/main.go
Normal file
@@ -0,0 +1,82 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var hashStore []string
|
||||
var salt string
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 3 {
|
||||
fmt.Println("Usage: ./day14 <salt> <key-num>")
|
||||
fmt.Println(" My input: ./day14 cuanljph 64")
|
||||
os.Exit(1)
|
||||
}
|
||||
salt = os.Args[1]
|
||||
keyNum := atoi(os.Args[2])
|
||||
var foundKeys []string
|
||||
tryIdx := 0
|
||||
for len(foundKeys) < keyNum {
|
||||
tst := getHash(tryIdx)
|
||||
for i := range tst {
|
||||
if len(tst) > i+3 {
|
||||
if tst[i:i+3] == strings.Repeat(string(tst[i]), 3) {
|
||||
// Found a triple, search the next 1000 for a quintuple
|
||||
if searchForQuint(salt, tryIdx+1, string(tst[i])) {
|
||||
foundKeys = append(foundKeys, tst)
|
||||
}
|
||||
// Once we test the first triplet, we're done with this one
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
tryIdx++
|
||||
}
|
||||
fmt.Println("Key:", getHash(tryIdx-1), "Idx:", tryIdx)
|
||||
}
|
||||
|
||||
func getHash(idx int) string {
|
||||
for len(hashStore)-1 < idx {
|
||||
hashStore = append(
|
||||
hashStore,
|
||||
getStretchedHash(fmt.Sprintf("%x", md5.Sum([]byte(salt+itoa(len(hashStore)+1))))),
|
||||
)
|
||||
}
|
||||
return hashStore[idx]
|
||||
}
|
||||
|
||||
func getStretchedHash(s string) string {
|
||||
for i := 0; i < 2016; i++ {
|
||||
s = fmt.Sprintf("%x", md5.Sum([]byte(s)))
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func searchForQuint(salt string, startIdx int, srch string) bool {
|
||||
for i := startIdx; i <= startIdx+1000; i++ {
|
||||
tst := getHash(i)
|
||||
if strings.Contains(tst, strings.Repeat(srch, 5)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func atoi(i string) int {
|
||||
var ret int
|
||||
var err error
|
||||
if ret, err = strconv.Atoi(i); err != nil {
|
||||
log.Fatal("Invalid Atoi")
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func itoa(i int) string {
|
||||
return strconv.Itoa(i)
|
||||
}
|
89
2016/day14/problem
Normal file
89
2016/day14/problem
Normal file
@@ -0,0 +1,89 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 14: One-Time Pad ---
|
||||
|
||||
In order to communicate securely with Santa while you're on this mission, you've been using a one-time pad that you generate using a pre-agreed algorithm.
|
||||
Unfortunately, you've run out of keys in your one-time pad, and so you need to generate some more.
|
||||
|
||||
To generate keys, you first get a stream of random data by taking the MD5 of a pre-arranged salt (your puzzle input) and an increasing integer index (starting with 0,
|
||||
and represented in decimal); the resulting MD5 hash should be represented as a string of lowercase hexadecimal digits.
|
||||
|
||||
However, not all of these MD5 hashes are keys, and you need 64 new keys for your one-time pad. A hash is a key only if:
|
||||
|
||||
• It contains three of the same character in a row, like 777. Only consider the first such triplet in a hash.
|
||||
• One of the next 1000 hashes in the stream contains that same character five times in a row, like 77777.
|
||||
|
||||
Considering future hashes for five-of-a-kind sequences does not cause those hashes to be skipped; instead, regardless of whether the current hash is a key, always
|
||||
resume testing for keys starting with the very next hash.
|
||||
|
||||
For example, if the pre-arranged salt is abc:
|
||||
|
||||
• The first index which produces a triple is 18, because the MD5 hash of abc18 contains ...cc38887a5.... However, index 18 does not count as a key for your one-time
|
||||
pad, because none of the next thousand hashes (index 19 through index 1018) contain 88888.
|
||||
• The next index which produces a triple is 39; the hash of abc39 contains eee. It is also the first key: one of the next thousand hashes (the one at index 816)
|
||||
contains eeeee.
|
||||
• None of the next six triples are keys, but the one after that, at index 92, is: it contains 999 and index 200 contains 99999.
|
||||
• Eventually, index 22728 meets all of the criteria to generate the 64th key.
|
||||
|
||||
So, using our example salt of abc, index 22728 produces the 64th key.
|
||||
|
||||
Given the actual salt in your puzzle input, what index produces your 64th one-time pad key?
|
||||
|
||||
Your puzzle input was cuanljph.
|
||||
|
||||
Your puzzle answer was ________.
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
Of course, in order to make this process even more secure, you've also implemented key stretching.
|
||||
|
||||
Key stretching forces attackers to spend more time generating hashes. Unfortunately, it forces everyone else to spend more time, too.
|
||||
|
||||
To implement key stretching, whenever you generate a hash, before you use it, you first find the MD5 hash of that hash, then the MD5 hash of that hash, and so on, a
|
||||
total of 2016 additional hashings. Always use lowercase hexadecimal representations of hashes.
|
||||
|
||||
For example, to find the stretched hash for index 0 and salt abc:
|
||||
|
||||
• Find the MD5 hash of abc0: 577571be4de9dcce85a041ba0410f29f.
|
||||
• Then, find the MD5 hash of that hash: eec80a0c92dc8a0777c619d9bb51e910.
|
||||
• Then, find the MD5 hash of that hash: 16062ce768787384c81fe17a7a60c7e3.
|
||||
• ...repeat many times...
|
||||
• Then, find the MD5 hash of that hash: a107ff634856bb300138cac6568c0f24.
|
||||
|
||||
So, the stretched hash for index 0 in this situation is a107ff.... In the end, you find the original hash (one use of MD5), then find the hash-of-the-previous-hash 2016
|
||||
times, for a total of 2017 uses of MD5.
|
||||
|
||||
The rest of the process remains the same, but now the keys are entirely different. Again for salt abc:
|
||||
|
||||
• The first triple (222, at index 5) has no matching 22222 in the next thousand hashes.
|
||||
• The second triple (eee, at index 10) hash a matching eeeee at index 89, and so it is the first key.
|
||||
• Eventually, index 22551 produces the 64th key (triple fff with matching fffff at index 22859.
|
||||
|
||||
Given the actual salt in your puzzle input and using 2016 extra MD5 calls of key stretching, what index now produces your 64th one-time pad key?
|
||||
|
||||
Your puzzle answer was ________.
|
||||
|
||||
Your puzzle input was cuanljph.
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. https://en.wikipedia.org/wiki/One-time_pad
|
||||
. https://en.wikipedia.org/wiki/Security_through_obscurity
|
||||
. https://en.wikipedia.org/wiki/MD5
|
||||
. https://en.wikipedia.org/wiki/Salt_(cryptography)
|
||||
. https://en.wikipedia.org/wiki/MD5#Security
|
||||
. https://en.wikipedia.org/wiki/Key_stretching
|
||||
. http://adventofcode.com/2016
|
6
2016/day15/input
Normal file
6
2016/day15/input
Normal file
@@ -0,0 +1,6 @@
|
||||
Disc #1 has 17 positions; at time=0, it is at position 15.
|
||||
Disc #2 has 3 positions; at time=0, it is at position 2.
|
||||
Disc #3 has 19 positions; at time=0, it is at position 4.
|
||||
Disc #4 has 13 positions; at time=0, it is at position 2.
|
||||
Disc #5 has 7 positions; at time=0, it is at position 2.
|
||||
Disc #6 has 5 positions; at time=0, it is at position 0.
|
118
2016/day15/main.go
Normal file
118
2016/day15/main.go
Normal file
@@ -0,0 +1,118 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
input := stdinToStringSlice()
|
||||
var verbose, pt2 bool
|
||||
var allDiscs []Disc
|
||||
if len(os.Args) > 1 {
|
||||
for i := range os.Args {
|
||||
switch os.Args[i] {
|
||||
case "-2": // Do part 2
|
||||
pt2 = true
|
||||
case "-v": // Verbose mode
|
||||
verbose = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for i := range input {
|
||||
pts := strings.Fields(input[i])
|
||||
id := atoi(pts[1][1:])
|
||||
ttl := atoi(pts[3])
|
||||
curr := atoi(pts[11][0 : len(pts[11])-1])
|
||||
allDiscs = append(allDiscs, *CreateDisc(id, ttl, curr))
|
||||
}
|
||||
|
||||
if pt2 {
|
||||
d := CreateDisc(7, 11, 0)
|
||||
allDiscs = append(allDiscs, *d)
|
||||
}
|
||||
|
||||
var numTicks int
|
||||
|
||||
for !AllDiscsAlign(allDiscs) {
|
||||
numTicks++
|
||||
TickAllDiscs(allDiscs)
|
||||
if verbose {
|
||||
PrintStatus(allDiscs)
|
||||
}
|
||||
}
|
||||
fmt.Println("Total Ticks: ", numTicks)
|
||||
}
|
||||
|
||||
func PrintStatus(d []Disc) {
|
||||
fmt.Print("[ ")
|
||||
for i := range d {
|
||||
fmt.Printf("(%2d/%2d) ", d[i].currPos, d[i].ttlPos)
|
||||
}
|
||||
fmt.Println("]")
|
||||
}
|
||||
|
||||
func TickAllDiscs(d []Disc) {
|
||||
for i := range d {
|
||||
d[i].Tick()
|
||||
}
|
||||
}
|
||||
|
||||
func AllDiscsAlign(d []Disc) bool {
|
||||
for i := range d {
|
||||
if (d[i].currPos+d[i].id)%d[i].ttlPos != 0 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type Disc struct {
|
||||
id int
|
||||
ttlPos int
|
||||
currPos int
|
||||
startPos int
|
||||
numTicks int
|
||||
bufTicks int
|
||||
}
|
||||
|
||||
func CreateDisc(id, ttl, curr int) *Disc {
|
||||
d := new(Disc)
|
||||
d.id = id
|
||||
d.ttlPos = ttl
|
||||
d.currPos = curr
|
||||
d.startPos = curr
|
||||
return d
|
||||
}
|
||||
|
||||
func (d *Disc) Tick() {
|
||||
d.currPos = (d.currPos + 1) % d.ttlPos
|
||||
d.numTicks++
|
||||
}
|
||||
|
||||
func stdinToStringSlice() []string {
|
||||
var input []string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input = append(input, scanner.Text())
|
||||
}
|
||||
return input
|
||||
}
|
||||
|
||||
func atoi(i string) int {
|
||||
var ret int
|
||||
var err error
|
||||
if ret, err = strconv.Atoi(i); err != nil {
|
||||
log.Fatal("Invalid Atoi")
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func ClearScreen() {
|
||||
fmt.Print("\033[H\033[2J")
|
||||
}
|
65
2016/day15/problem
Normal file
65
2016/day15/problem
Normal file
@@ -0,0 +1,65 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 15: Timing is Everything ---
|
||||
|
||||
The halls open into an interior plaza containing a large kinetic sculpture. The sculpture is in a sealed enclosure and seems to involve a set of identical spherical capsules that are carried to the top and allowed to bounce through
|
||||
the maze of spinning pieces.
|
||||
|
||||
Part of the sculpture is even interactive! When a button is pressed, a capsule is dropped and tries to fall through slots in a set of rotating discs to finally go through a little hole at the bottom and come out of the sculpture. If
|
||||
any of the slots aren't aligned with the capsule as it passes, the capsule bounces off the disc and soars away. You feel compelled to get one of those capsules.
|
||||
|
||||
The discs pause their motion each second and come in different sizes; they seem to each have a fixed number of positions at which they stop. You decide to call the position with the slot 0, and count up for each position it reaches
|
||||
next.
|
||||
|
||||
Furthermore, the discs are spaced out so that after you push the button, one second elapses before the first disc is reached, and one second elapses as the capsule passes from one disk to the one below it. So, if you push the button
|
||||
at time=100, then the capsule reaches the top disc at time=101, the second disc at time=102, the third disc at time=103, and so on.
|
||||
|
||||
The button will only drop a capsule at an integer time - no fractional seconds allowed.
|
||||
|
||||
For example, at time=0, suppose you see the following arrangement:
|
||||
|
||||
Disc #1 has 5 positions; at time=0, it is at position 4.
|
||||
Disc #2 has 2 positions; at time=0, it is at position 1.
|
||||
|
||||
If you press the button exactly at time=0, the capsule would start to fall; it would reach the first disc at time=1. Since the first disc was at position 4 at time=0, by time=1 it has ticked one position forward. As a five-position
|
||||
disc, the next position is 0, and the capsule falls through the slot.
|
||||
|
||||
Then, at time=2, the capsule reaches the second disc. The second disc has ticked forward two positions at this point: it started at position 1, then continued to position 0, and finally ended up at position 1 again. Because there's
|
||||
only a slot at position 0, the capsule bounces away.
|
||||
|
||||
If, however, you wait until time=5 to push the button, then when the capsule reaches each disc, the first disc will have ticked forward 5+1 = 6 times (to position 0), and the second disc will have ticked forward 5+2 = 7 times (also
|
||||
to position 0). In this case, the capsule would fall through the discs and come out of the machine.
|
||||
|
||||
However, your situation has more than two discs; you've noted their positions in your puzzle input. What is the first time you can press the button to get a capsule?
|
||||
|
||||
Your puzzle answer was _________.
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
After getting the first capsule (it contained a star! what great fortune!), the machine detects your success and begins to rearrange itself.
|
||||
|
||||
When it's done, the discs are back in their original configuration as if it were time=0 again, but a new disc with 11 positions and starting at position 0 has appeared exactly one second below the previously-bottom disc.
|
||||
|
||||
With this new disc, and counting again starting from time=0 with the configuration in your puzzle input, what is the first time you can press the button to get another capsule?
|
||||
|
||||
Although it hasn't changed, you can still get your puzzle input.
|
||||
|
||||
Answer: _____________________
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. https://youtu.be/IxDoO9oODOk?t=177
|
||||
. http://adventofcode.com/2016/day/15/input
|
1
2016/day16/input
Normal file
1
2016/day16/input
Normal file
@@ -0,0 +1 @@
|
||||
00111101111101000
|
89
2016/day16/main.go
Normal file
89
2016/day16/main.go
Normal file
@@ -0,0 +1,89 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Part 1 Disk Size: 272
|
||||
// Part 2 Disk Size: 35651584
|
||||
func main() {
|
||||
diskSize := 272
|
||||
if len(os.Args) > 1 {
|
||||
switch os.Args[1] {
|
||||
case "-2":
|
||||
// Do part two
|
||||
diskSize = 35651584
|
||||
default:
|
||||
// manually set disk size
|
||||
diskSize = atoi(os.Args[1])
|
||||
}
|
||||
}
|
||||
input := stdinToString()
|
||||
for len(input) < diskSize {
|
||||
input = dragonCurve(input)
|
||||
}
|
||||
input = input[:diskSize]
|
||||
fmt.Println(checksum(input))
|
||||
}
|
||||
|
||||
func dragonCurve(inp string) string {
|
||||
return inp + "0" + invert(reverse(inp))
|
||||
}
|
||||
|
||||
func invert(inp string) string {
|
||||
var ret []rune
|
||||
for i := range inp {
|
||||
if inp[i] == '1' {
|
||||
ret = append(ret, '0')
|
||||
} else {
|
||||
ret = append(ret, '1')
|
||||
}
|
||||
}
|
||||
return string(ret)
|
||||
}
|
||||
|
||||
func reverse(inp string) string {
|
||||
var ret []byte
|
||||
for i := len(inp) - 1; i >= 0; i-- {
|
||||
ret = append(ret, inp[i])
|
||||
}
|
||||
return string(ret)
|
||||
}
|
||||
|
||||
func checksum(inp string) string {
|
||||
var chkSum []rune
|
||||
for i := 0; i < len(inp); i += 2 {
|
||||
if inp[i] == inp[i+1] {
|
||||
chkSum = append(chkSum, '1')
|
||||
} else {
|
||||
chkSum = append(chkSum, '0')
|
||||
}
|
||||
}
|
||||
if len(chkSum)%2 == 0 {
|
||||
// Length is even, repeat
|
||||
return checksum(string(chkSum))
|
||||
}
|
||||
return string(chkSum)
|
||||
}
|
||||
|
||||
func stdinToString() string {
|
||||
var input string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input += scanner.Text()
|
||||
}
|
||||
return input
|
||||
}
|
||||
|
||||
func atoi(i string) int {
|
||||
var ret int
|
||||
var err error
|
||||
if ret, err = strconv.Atoi(i); err != nil {
|
||||
log.Fatal("Invalid Atoi")
|
||||
}
|
||||
return ret
|
||||
}
|
95
2016/day16/problem
Normal file
95
2016/day16/problem
Normal file
@@ -0,0 +1,95 @@
|
||||
Advent of Code
|
||||
|
||||
--- Day 16: Dragon Checksum ---
|
||||
|
||||
You're done scanning this part of the network, but you've left traces of your presence. You need to
|
||||
overwrite some disks with random-looking data to cover your tracks and update the local security system
|
||||
with a new checksum for those disks.
|
||||
|
||||
For the data to not be suspiscious, it needs to have certain properties; purely random data will be
|
||||
detected as tampering. To generate appropriate random data, you'll need to use a modified dragon curve.
|
||||
|
||||
Start with an appropriate initial state (your puzzle input). Then, so long as you don't have enough data
|
||||
yet to fill the disk, repeat the following steps:
|
||||
|
||||
• Call the data you have at this point "a".
|
||||
• Make a copy of "a"; call this copy "b".
|
||||
• Reverse the order of the characters in "b".
|
||||
• In "b", replace all instances of 0 with 1 and all 1s with 0.
|
||||
• The resulting data is "a", then a single 0, then "b".
|
||||
|
||||
For example, after a single step of this process,
|
||||
|
||||
• 1 becomes 100.
|
||||
• 0 becomes 001.
|
||||
• 11111 becomes 11111000000.
|
||||
• 111100001010 becomes 1111000010100101011110000.
|
||||
|
||||
Repeat these steps until you have enough data to fill the desired disk.
|
||||
|
||||
Once the data has been generated, you also need to create a checksum of that data. Calculate the checksum
|
||||
only for the data that fits on the disk, even if you generated more data than that in the previous step.
|
||||
|
||||
The checksum for some given data is created by considering each non-overlapping pair of characters in the
|
||||
input data. If the two characters match (00 or 11), the next checksum character is a 1. If the characters
|
||||
do not match (01 or 10), the next checksum character is a 0. This should produce a new string which is
|
||||
exactly half as long as the original. If the length of the checksum is even, repeat the process until you
|
||||
end up with a checksum with an odd length.
|
||||
|
||||
For example, suppose we want to fill a disk of length 12, and when we finally generate a string of at
|
||||
least length 12, the first 12 characters are 110010110100. To generate its checksum:
|
||||
|
||||
• Consider each pair: 11, 00, 10, 11, 01, 00.
|
||||
• These are same, same, different, same, different, same, producing 110101.
|
||||
• The resulting string has length 6, which is even, so we repeat the process.
|
||||
• The pairs are 11 (same), 01 (different), 01 (different).
|
||||
• This produces the checksum 100, which has an odd length, so we stop.
|
||||
|
||||
Therefore, the checksum for 110010110100 is 100.
|
||||
|
||||
Combining all of these steps together, suppose you want to fill a disk of length 20 using an initial state
|
||||
of 10000:
|
||||
|
||||
• Because 10000 is too short, we first use the modified dragon curve to make it longer.
|
||||
• After one round, it becomes 10000011110 (11 characters), still too short.
|
||||
• After two rounds, it becomes 10000011110010000111110 (23 characters), which is enough.
|
||||
• Since we only need 20, but we have 23, we get rid of all but the first 20 characters:
|
||||
10000011110010000111.
|
||||
• Next, we start calculating the checksum; after one round, we have 0111110101, which 10 characters long
|
||||
(even), so we continue.
|
||||
• After two rounds, we have 01100, which is 5 characters long (odd), so we are done.
|
||||
|
||||
In this example, the correct checksum would therefore be 01100.
|
||||
|
||||
The first disk you have to fill has length 272. Using the initial state in your puzzle input, what is the
|
||||
correct checksum?
|
||||
|
||||
Your puzzle answer _____________________.
|
||||
|
||||
The first half of this puzzle is complete! It provides one gold star: *
|
||||
|
||||
--- Part Two ---
|
||||
|
||||
The second disk you have to fill has length 35651584. Again using the initial state in your puzzle input,
|
||||
what is the correct checksum for this disk?
|
||||
|
||||
Your puzzle input is still 00111101111101000.
|
||||
|
||||
Answer: _____________________
|
||||
|
||||
References
|
||||
|
||||
Visible links
|
||||
. http://adventofcode.com/
|
||||
. http://adventofcode.com/2016/about
|
||||
. http://adventofcode.com/2016/support
|
||||
. http://adventofcode.com/2016/events
|
||||
. http://adventofcode.com/2016/settings
|
||||
. http://adventofcode.com/2016/auth/logout
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016
|
||||
. http://adventofcode.com/2016/leaderboard
|
||||
. http://adventofcode.com/2016/stats
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. http://adventofcode.com/2016/sponsors
|
||||
. https://en.wikipedia.org/wiki/Dragon_curve
|
Reference in New Issue
Block a user