def day11_2(data): #data = read_input(2015, "111") oldPassword = '******' result = nextPassword(oldPassword) AssertExpectedResult('heqaabcc', result, 2) return result
def day7_2(data): #data = read_input(2015, "701") wires, circuit = processInstructionsBooklet(data) wires['b'] = 956 wires = emulateCircuit(wires, circuit) result = wires[wires['a']] AssertExpectedResult(40149, result, 2) return result
def day11_1(data): #data = read_input(2015, "111") oldPassword = data[0] #newPassword = nextPassword(newPassword) #print("next:",nextPassword('abcdefgh')) #print("next:",nextPassword('ghijklmn')) result = nextPassword(oldPassword) AssertExpectedResult('hepxxyzz', result, 1) return result
def day7_1(data): #data = read_input(2015, "701") wires, circuit = processInstructionsBooklet(data) #print(wires) wires = emulateCircuit(wires, circuit) #print(wires) result = wires[wires['a']] AssertExpectedResult(956, result, 1) return result
def day9_2(data): #data = read_input(2015, "901") graph, cities = processInputAndBuildGraph(data) cost = 0 for i in itertools.permutations(list(cities.values())): r = path_cost(graph, i) if r > cost: cost = r result = cost AssertExpectedResult(804, result, 2) return result
def day10_1(data): #data = read_input(2015, "101") rounds = 40 result = data[0] for _ in range(rounds): result = playLookAndSay(result, rounds) result = len(result) AssertExpectedResult(329356, result, 1) return result
def day10_2(data): #data = read_input(2015, "101") rounds = 50 result = data[0] for _ in range(rounds): result = playLookAndSay(result, rounds) result = len(result) AssertExpectedResult(4666278, result, 2) return result
def day6_2(data): #data = read_input(2015, "601") rows, columns = 1000, 1000 grid = [ [ False for i in range(columns) ] for j in range(rows) ] grid = executeInstructions(grid, data, 2) result = sum( [ grid[j][i] for i in range(columns) for j in range(rows) ] ) AssertExpectedResult(14687245, result, 2) return result
def day12_2(data): #data = read_input(2015, "121") testSamples() result = 0 result = parseAndGetResult(data[0]) # 54040 too low # 89528 too high # should be around 65k :\ AssertExpectedResult(111754, result, 2) return result
def day6_1(data): #data = read_input(2015, "601") rows, columns = 1000, 1000 grid = [ [ 0 for i in range(columns) ] for j in range(rows) ] grid = executeInstructions(grid, data) result = sum( [ grid[j][i] for i in range(columns) for j in range(rows) ] ) AssertExpectedResult(543903, result, 1) return result
def day9_1(data): #data = read_input(2015, "901") graph, cities = processInputAndBuildGraph(data) #print(cities) #for ds in graph: # print(ds) path = solve_tsp(graph) print(path) result = path_cost(graph, path) AssertExpectedResult(207, result, 1) return result
def day16_2(data): #data = read_input(2015, "151") candidates = parseAunstSue(data, validatePropertyV2) mostConditionsSatisfied = 0 for aunt in candidates.keys(): property = candidates[aunt] if len(list(property)) > int(mostConditionsSatisfied): mostConditionsSatisfied = len(list(property)) auntSue = int(aunt) result = auntSue AssertExpectedResult(405, result) return result
def day12_1(data): #data = read_input(2015, "121") tree2Json = TreeToJson() json_parser = Lark(json_grammar, parser='lalr', transformer=tree2Json) parse = json_parser.parse parsedTree = parse(data[0]) tree2Json.visit_topdown(tree=parsedTree) print("sum:", tree2Json.sum()) #print("sum:", parsedTree) result = tree2Json.sum() AssertExpectedResult(111754, result, 1) return result
def day15_2(data): #data = read_input(2015, "151") ingredients = parseIngredients(data) combinations = [combination for combination in permutations(range(1,100), len(ingredients)) if sum(combination) == 100 and sum(np.multiply(combination, [i.calories for i in ingredients.values()])) == 500 ] bestScore = 0 for recipe in combinations: score = computeCookieRecipeScore(ingredients, (zip(ingredients.keys(), recipe))) if score > bestScore: bestScore = score result = bestScore AssertExpectedResult(1766400, result) return result
def day15_1(data): #data = read_input(2015, "151") ingredients = parseIngredients(data) combinations = [combination for combination in permutations(range(1,100), len(ingredients)) if sum(combination) == 100 ] bestScore = 0 for recipe in combinations: score = computeCookieRecipeScore(ingredients, (zip(ingredients.keys(), recipe))) if score > bestScore: bestScore = score result = bestScore result = 0 AssertExpectedResult(21367368, result) return result
def day1_1(data): #data = read_input(2015, "251") result, _ = followDirections(data[0]) AssertExpectedResult(280, result, 1) return result
def day2_1(data): #data = read_input(2015, "201") boxes = processInputDay2(data) result = determineWrappingPaperOrder(boxes) AssertExpectedResult(1598415, result, 1) return result
def day2_2(data): #data = read_input(2015, "201") boxes = processInputDay2(data) result = determineRibbonOrder(boxes) AssertExpectedResult(3812909, result, 1) return result
def day3_1(data): #data = read_input(2015, "301") result = findHowManyUniqueDeliveries(data[0]) AssertExpectedResult(2565, result, 1) return result
def day5_2(data): #data = ['qjhvhtzxzqqjkmpb', 'xxyxx' , 'uurcxstgmygtbstg', 'ieodomkazucvgmuy'] result = countNiceStrings(data, 2) AssertExpectedResult(55, result, 2) return result
def day8_2(data): #data = read_input(2015, "801") _, result = processStringsAndComputeResult(data) AssertExpectedResult(2074, result, 2) return result
def day8_1(data): #data = read_input(2015, "801") result, _ = processStringsAndComputeResult(data) AssertExpectedResult(1342, result, 1) return result
def day4_1(data): #data = read_input(2015, "301") result = findLowestPositiveNumber(data[0]) AssertExpectedResult(254575, result, 1) return result
def day4_2(data): #data = read_input(2015, "301") result = findLowestPositiveNumber(data[0], 2) #result = findLowestPositiveNumber('pqrstuv', 2) AssertExpectedResult(1038736, result, 2) return result
def day1_2(data): #data = read_input(2015, "251") _, result = followDirections(data[0], True) AssertExpectedResult(1797, result, 2) return result
def day3_2(data): #data = read_input(2015, "301") result = findHowManyUniqueDeliveriesWithRoboSanta(data[0]) AssertExpectedResult(2639, result, 2) return result
def day5_1(data): #data = read_input(2015, "301") result = countNiceStrings(data) AssertExpectedResult(255, result, 1) return result