diff --git a/2017/02/solution.py b/2017/02/solution.py index fed9022..0b9190f 100644 --- a/2017/02/solution.py +++ b/2017/02/solution.py @@ -31,7 +31,6 @@ sum = 0 with open(input_f) as file: for line in file: line = list(map(int,line.rstrip('\n').split())) - print(line) for idx,i in enumerate(line): length=len(line) for j in range(0,length): diff --git a/2017/06/solution.py b/2017/06/solution.py index 163b01f..67d5e43 100644 --- a/2017/06/solution.py +++ b/2017/06/solution.py @@ -6,7 +6,7 @@ input_f = sys.argv[1] ######################################### # # -# Part 1 # +# Part 1+2 # # # ######################################### line = [] @@ -52,10 +52,5 @@ while stop != True: #line not in tests: #input() #print(tests) #print(line) -print(steps-found_at) print(steps) -######################################### -# # -# Part 2 # -# # -######################################### +print(steps-found_at) diff --git a/2017/07/7.md b/2017/07/7.md new file mode 100644 index 0000000..68c5742 --- /dev/null +++ b/2017/07/7.md @@ -0,0 +1,72 @@ +## \-\-- Day 7: Recursive Circus \-\-- + +Wandering further through the circuits of the computer, you come upon a +tower of programs that have gotten +themselves into a bit of trouble. A recursive algorithm has gotten out +of hand, and now they\'re balanced precariously in a large tower. + +One program at the bottom supports the entire tower. It\'s holding a +large disc, and on the disc are balanced several more sub-towers. At the +bottom of these sub-towers, standing on the bottom disc, are other +programs, each holding *their* own disc, and so on. At the very tops of +these sub-sub-sub-\...-towers, many programs stand simply keeping the +disc below them balanced but with no disc of their own. + +You offer to help, but first you need to understand the structure of +these towers. You ask each program to yell out their *name*, their +*weight*, and (if they\'re holding a disc) the *names of the programs +immediately above them* balancing on that disc. You write this +information down (your puzzle input). Unfortunately, in their panic, +they don\'t do this in an orderly fashion; by the time you\'re done, +you\'re not sure which program gave which information. + +For example, if your list is the following: + + pbga (66) + xhth (57) + ebii (61) + havc (66) + ktlj (57) + fwft (72) -> ktlj, cntj, xhth + qoyq (66) + padx (45) -> pbga, havc, qoyq + tknk (41) -> ugml, padx, fwft + jptl (61) + ugml (68) -> gyxo, ebii, jptl + gyxo (61) + cntj (57) + +\...then you would be able to recreate the structure of the towers that +looks like this: + + gyxo + / + ugml - ebii + / \ + | jptl + | + | pbga + / / + tknk --- padx - havc + \ \ + | qoyq + | + | ktlj + \ / + fwft - cntj + \ + xhth + +In this example, `tknk` is at the bottom of the tower (the *bottom +program*), and is holding up `ugml`, `padx`, and `fwft`. Those programs +are, in turn, holding up other programs; in this example, none of those +programs are holding up any other programs, and are all the tops of +their own towers. (The actual tower balancing in front of you is much +larger.) + +Before you\'re ready to help them, you need to make sure your +information is correct. *What is the name of the bottom program?* + +To begin, [get your puzzle input](7/input). + +Answer: diff --git a/2017/07/solution.py b/2017/07/solution.py new file mode 100644 index 0000000..e9056ce --- /dev/null +++ b/2017/07/solution.py @@ -0,0 +1,24 @@ +#!/bin/python3 +import sys +from pprint import pprint + +input_f = sys.argv[1] + + +######################################### +# # +# Part 1 # +# # +######################################### + +with open(input_f) as file: + for line in file: + + + + +######################################### +# # +# Part 2 # +# # +#########################################