AdventOfCode/2024/23/solution.py

49 lines
1.3 KiB
Python

#!/bin/python3
import sys,time,re
from pprint import pprint
sys.path.insert(0, '../../')
from fred import list2int,get_re,nprint,lprint,loadFile,dprint,TSP,dfs_graph
start_time = time.time()
input_f = 'test'
#########################################
# #
# Part 1 #
# #
#########################################
def part1():
graph = {}
file = loadFile(input_f)
for f in file:
f = f.split('-')
if f[0] not in graph:
graph[f[0]] = []
if f[1] not in graph:
graph[f[1]] = []
graph[f[0]].append(f[1])
graph[f[1]].append(f[0])
dprint(graph)
for key,values in graph.items():
print(key)
print(dfs_graph(graph,key))
input()
start_time = time.time()
print('Part 1:',part1(), '\t\t', round((time.time() - start_time)*1000), 'ms')
#########################################
# #
# Part 2 #
# #
#########################################
def part2():
return
start_time = time.time()
print('Part 2:',part2(), '\t\t', round((time.time() - start_time)*1000), 'ms')