io.input("test") --io.input("input") function p2s( x, y ) return string.format("%d,%d", x, y) end function s2p( s ) local x, y = string.match(s,"(-?%d+),(-?%d+)") x = tonumber(x) y = tonumber(y) return x, y end function neighbors(x, y) local n = {} n.NW = p2s( x-1, y-1) n.N = p2s( x, y-1) n.NE = p2s( x+1, y-1) n.E = p2s( x+1, y ) n.SE = p2s(x+1, y+1) n.S = p2s(x, y+1) n.SW = p2s(x-1, y+1) n.W = p2s(x-1, y) return n end local max = {y=0, x=0} local min = {y=10000, x=10000} function updateMaxMin( j, i ) if j>max.x then max.x = j elseif jmax.y then max.y = i elseif i 0 then round = round + 1 end until count == 0 print("part 1", result1) print("part 2", round) -- print map: for y=min.y,max.y do local m = "" for x=min.x,max.x do local s = p2s(x,y) m = m .. (elves[s] and "#" or ".") end -- print(m) end