Code for the Advent of Code event
aoc advent-of-code
at main 10 lines 279 B view raw
1import add_node, add_edge, longest_path from require 'graph' 2 3for line in io.lines 'input.txt' 4 source, dest, cost = line\match '(%w+) to (%w+) = (%d+)' 5 add_node source 6 add_node dest 7 add_edge source, dest, cost 8 add_edge dest, source, cost 9 10print longest_path!