include("utils.jl") function parse_input(filename) lines = collect(non_empty_lines(filename)) dots = map(l->parse.(Int, split(l,',')), filter(line->Base.Unicode.isnumeric(line[1]), lines)) folds = map(filter(line->!Base.Unicode.isnumeric(line[1]), lines)) do line front, coord = split(line, '=') 'x' in front ? 1 : 2, parse(Int, coord) end sort(dots), folds end function solution13_2() dots, folds = parse_input("13.data") for (axis, coord) in folds foreach(dots) do dot if dot[axis] > coord dot[axis] -= 2 * (dot[axis] - coord) end end dots = sort(unique(dots)) end for y in 0:5 for x in 0:38 if [x, y] in dots print('#') else print(' ') end end println("") end end solution13_2()