diff options
Diffstat (limited to '14')
| -rw-r--r-- | 14/1.lua | 83 | ||||
| -rw-r--r-- | 14/2.lua | 87 | ||||
| -rwxr-xr-x | 14/ext.lua | 62 | ||||
| -rw-r--r-- | 14/input.txt | 148 | ||||
| -rw-r--r-- | 14/sample.txt | 2 |
5 files changed, 382 insertions, 0 deletions
diff --git a/14/1.lua b/14/1.lua new file mode 100644 index 0000000..f774175 --- /dev/null +++ b/14/1.lua @@ -0,0 +1,83 @@ +require "ext" +local cave = {} +local lowest = 0 +for line in io.lines() do + print("line:",line) + local cursor = nil + for pair in line:gmatch("([0-9,]+)") do + local col,row = pair:match("(%d+),(%d+)") + col,row = tonumber(col),tonumber(row) + if cursor then + for rown = math.min(cursor[1],row), math.max(cursor[1],row) do + for coln = math.min(cursor[2],col), math.max(cursor[2],col) do + cave[rown] = cave[rown] or {} + printf("Setting %d %d to true",rown,coln) + cave[rown][coln] = true + end + end + end + lowest = math.max(row,lowest) + cursor = {row,col} + end +end + +local sand = {} +function print_puzzle() + for row = 0, 500 do + for col = 0,100 do + local data = cave[row] and cave[row][col] + if data == "s" then + io.write("O") + elseif data then + io.write("#") + else + io.write(".") + end + end + io.write("\n") + end + for _,row in pairs(cave) do + for _,col in pairs(row) do + end + end +end +print_puzzle() +print("lowest:",lowest) +local floor = lowest + 2 + +local sandpoint = {0,500} +local movement = { + {1,0}, + {1,-1}, + {1,1} +} +local x = 0 +while true do + for k,v in pairs(sandpoint) do + sand[k] = v + end + local could_move = false + repeat + could_move = false + for _,move in ipairs(movement) do + local drow, dcol = sand[1] + move[1], sand[2] + move[2] + if not cave[drow] or cave[drow][dcol] == nil then + could_move = true + sand[1] = drow + sand[2] = dcol + break + end + end + until not could_move or sand[1] = floor + if not could_move then + cave[sand[1]] = cave[sand[1]] or {} + cave[sand[1]][sand[2]] = "s" + end + if sand[1] == 500 then + print("sand stopped falling") + break + end + x = x + 1 +end +print_puzzle() +print(x) diff --git a/14/2.lua b/14/2.lua new file mode 100644 index 0000000..abc6ccd --- /dev/null +++ b/14/2.lua @@ -0,0 +1,87 @@ +require "ext" +local cave = {} +local lowest = 0 +for line in io.lines() do + print("line:",line) + local cursor = nil + for pair in line:gmatch("([0-9,]+)") do + local col,row = pair:match("(%d+),(%d+)") + col,row = tonumber(col),tonumber(row) + if cursor then + for rown = math.min(cursor[1],row), math.max(cursor[1],row) do + for coln = math.min(cursor[2],col), math.max(cursor[2],col) do + cave[rown] = cave[rown] or {} + printf("Setting %d %d to true",rown,coln) + cave[rown][coln] = true + end + end + end + lowest = math.max(row,lowest) + cursor = {row,col} + end +end + +local sand = {} +function print_puzzle() + for row = 0, 11 do + for col = 480,520 do + local data = cave[row] and cave[row][col] + if data == "s" then + io.write("O") + elseif data then + io.write("#") + else + io.write(".") + end + end + io.write("\n") + end + for _,row in pairs(cave) do + for _,col in pairs(row) do + end + end +end +print_puzzle() +print("lowest:",lowest) +local floor = lowest + 2 +cave[floor] = {} +for i = -(500 - floor), (500 + floor) do + cave[floor][i] = true +end + +local sandpoint = {0,500} +local movement = { + {1,0}, + {1,-1}, + {1,1} +} +local x = 0 +while true do + for k,v in pairs(sandpoint) do + sand[k] = v + end + local could_move = false + repeat + could_move = false + for _,move in ipairs(movement) do + local drow, dcol = sand[1] + move[1], sand[2] + move[2] + if not cave[drow] or cave[drow][dcol] == nil then + could_move = true + sand[1] = drow + sand[2] = dcol + break + end + end + until not could_move or sand[1] == floor + if not could_move then + cave[sand[1]] = cave[sand[1]] or {} + cave[sand[1]][sand[2]] = "s" + end + if sand[1] == 0 then + print("sand stopped falling") + break + end + x = x + 1 +end +print_puzzle() +print(x + 1) diff --git a/14/ext.lua b/14/ext.lua new file mode 100755 index 0000000..c1eb1cc --- /dev/null +++ b/14/ext.lua @@ -0,0 +1,62 @@ +-- Override tostring to display more info about the table
+local old_tostring = tostring
+local numtabs = 0
+local printed_tables = {}
+
+local function tostring_helper(el)
+ assert(type(el) == "table", "Tried to call helper with something that was not a table, it was a " .. type(el))
+ local mt = getmetatable(el)
+ if mt and mt.__tostring then
+ return mt.__tostring(el)
+ elseif printed_tables[el] == true then
+ return old_tostring(el)
+ else
+ printed_tables[el] = true
+ numtabs = numtabs + 1
+ local strbuilder = setmetatable({"{"},{__index = table})
+ for k,v in pairs(el) do
+ local key,value
+ if type(k) == "table" then
+ key = tostring_helper(k)
+ else
+ key = old_tostring(k)
+ end
+ if type(v) == "table" then
+ value = tostring_helper(v)
+ else
+ value = old_tostring(v)
+ end
+ strbuilder:insert(string.format("%s%s : %s", string.rep("\t",numtabs), key, value))
+ end
+ strbuilder:insert(string.rep("\t",numtabs - 1) .. "}")
+ numtabs = numtabs - 1
+ return strbuilder:concat("\n")
+ end
+
+end
+function tostring(el)
+ printed_tables = {}
+ if type(el) == "table" then
+ return tostring_helper(el)
+ end
+ return old_tostring(el)
+end
+
+-- Functions to save my hands
+function printf(fmt, ...)
+ print(string.format(fmt,...))
+end
+function errorf(fmt, ...)
+ --Our error isn't actually in this function, it's 1 above us (1) = 2
+ error(string.format(fmt,...),2)
+end
+function assertf(bool, fmt, ...)
+ assert(type(fmt) == "string", "Assertf arg #2 was \"" .. type(fmt) .. "\", expected string")
+ if not bool then
+ args = {fmt}
+ for k,v in ipairs({...}) do
+ table.insert(args,tostring(v))
+ end
+ error(string.format(unpack(args)),2)
+ end
+end
diff --git a/14/input.txt b/14/input.txt new file mode 100644 index 0000000..edade8f --- /dev/null +++ b/14/input.txt @@ -0,0 +1,148 @@ +461,87 -> 461,80 -> 461,87 -> 463,87 -> 463,80 -> 463,87 -> 465,87 -> 465,80 -> 465,87 -> 467,87 -> 467,86 -> 467,87 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +460,159 -> 460,154 -> 460,159 -> 462,159 -> 462,151 -> 462,159 -> 464,159 -> 464,152 -> 464,159 +464,109 -> 464,111 -> 463,111 -> 463,118 -> 473,118 -> 473,111 -> 468,111 -> 468,109 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +478,33 -> 478,37 -> 471,37 -> 471,41 -> 483,41 -> 483,37 -> 482,37 -> 482,33 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +466,96 -> 470,96 +494,22 -> 499,22 +499,13 -> 499,16 -> 498,16 -> 498,19 -> 507,19 -> 507,16 -> 501,16 -> 501,13 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +460,145 -> 460,146 -> 462,146 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +460,159 -> 460,154 -> 460,159 -> 462,159 -> 462,151 -> 462,159 -> 464,159 -> 464,152 -> 464,159 +454,168 -> 458,168 +476,60 -> 476,61 -> 489,61 +502,26 -> 507,26 +447,106 -> 452,106 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +498,24 -> 503,24 +478,33 -> 478,37 -> 471,37 -> 471,41 -> 483,41 -> 483,37 -> 482,37 -> 482,33 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +499,13 -> 499,16 -> 498,16 -> 498,19 -> 507,19 -> 507,16 -> 501,16 -> 501,13 +457,166 -> 461,166 +478,33 -> 478,37 -> 471,37 -> 471,41 -> 483,41 -> 483,37 -> 482,37 -> 482,33 +464,109 -> 464,111 -> 463,111 -> 463,118 -> 473,118 -> 473,111 -> 468,111 -> 468,109 +499,13 -> 499,16 -> 498,16 -> 498,19 -> 507,19 -> 507,16 -> 501,16 -> 501,13 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +478,33 -> 478,37 -> 471,37 -> 471,41 -> 483,41 -> 483,37 -> 482,37 -> 482,33 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +457,99 -> 461,99 +499,13 -> 499,16 -> 498,16 -> 498,19 -> 507,19 -> 507,16 -> 501,16 -> 501,13 +463,162 -> 467,162 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +457,104 -> 462,104 +450,104 -> 455,104 +476,60 -> 476,61 -> 489,61 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +462,143 -> 473,143 -> 473,142 +483,44 -> 483,48 -> 481,48 -> 481,55 -> 489,55 -> 489,48 -> 487,48 -> 487,44 +463,99 -> 467,99 +461,87 -> 461,80 -> 461,87 -> 463,87 -> 463,80 -> 463,87 -> 465,87 -> 465,80 -> 465,87 -> 467,87 -> 467,86 -> 467,87 +478,33 -> 478,37 -> 471,37 -> 471,41 -> 483,41 -> 483,37 -> 482,37 -> 482,33 +472,168 -> 476,168 +472,123 -> 472,124 -> 476,124 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +483,44 -> 483,48 -> 481,48 -> 481,55 -> 489,55 -> 489,48 -> 487,48 -> 487,44 +489,30 -> 494,30 +462,143 -> 473,143 -> 473,142 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +461,87 -> 461,80 -> 461,87 -> 463,87 -> 463,80 -> 463,87 -> 465,87 -> 465,80 -> 465,87 -> 467,87 -> 467,86 -> 467,87 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +482,30 -> 487,30 +461,87 -> 461,80 -> 461,87 -> 463,87 -> 463,80 -> 463,87 -> 465,87 -> 465,80 -> 465,87 -> 467,87 -> 467,86 -> 467,87 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +460,145 -> 460,146 -> 462,146 +460,168 -> 464,168 +460,159 -> 460,154 -> 460,159 -> 462,159 -> 462,151 -> 462,159 -> 464,159 -> 464,152 -> 464,159 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +492,28 -> 497,28 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +464,109 -> 464,111 -> 463,111 -> 463,118 -> 473,118 -> 473,111 -> 468,111 -> 468,109 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +466,164 -> 470,164 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +464,109 -> 464,111 -> 463,111 -> 463,118 -> 473,118 -> 473,111 -> 468,111 -> 468,109 +461,87 -> 461,80 -> 461,87 -> 463,87 -> 463,80 -> 463,87 -> 465,87 -> 465,80 -> 465,87 -> 467,87 -> 467,86 -> 467,87 +478,33 -> 478,37 -> 471,37 -> 471,41 -> 483,41 -> 483,37 -> 482,37 -> 482,33 +460,96 -> 464,96 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +472,123 -> 472,124 -> 476,124 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +460,159 -> 460,154 -> 460,159 -> 462,159 -> 462,151 -> 462,159 -> 464,159 -> 464,152 -> 464,159 +461,87 -> 461,80 -> 461,87 -> 463,87 -> 463,80 -> 463,87 -> 465,87 -> 465,80 -> 465,87 -> 467,87 -> 467,86 -> 467,87 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +499,13 -> 499,16 -> 498,16 -> 498,19 -> 507,19 -> 507,16 -> 501,16 -> 501,13 +464,109 -> 464,111 -> 463,111 -> 463,118 -> 473,118 -> 473,111 -> 468,111 -> 468,109 +463,166 -> 467,166 +483,44 -> 483,48 -> 481,48 -> 481,55 -> 489,55 -> 489,48 -> 487,48 -> 487,44 +491,24 -> 496,24 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +488,26 -> 493,26 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +483,44 -> 483,48 -> 481,48 -> 481,55 -> 489,55 -> 489,48 -> 487,48 -> 487,44 +460,159 -> 460,154 -> 460,159 -> 462,159 -> 462,151 -> 462,159 -> 464,159 -> 464,152 -> 464,159 +499,13 -> 499,16 -> 498,16 -> 498,19 -> 507,19 -> 507,16 -> 501,16 -> 501,13 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +453,102 -> 458,102 +485,28 -> 490,28 +461,106 -> 466,106 +454,106 -> 459,106 +464,109 -> 464,111 -> 463,111 -> 463,118 -> 473,118 -> 473,111 -> 468,111 -> 468,109 +478,33 -> 478,37 -> 471,37 -> 471,41 -> 483,41 -> 483,37 -> 482,37 -> 482,33 +503,30 -> 508,30 +461,87 -> 461,80 -> 461,87 -> 463,87 -> 463,80 -> 463,87 -> 465,87 -> 465,80 -> 465,87 -> 467,87 -> 467,86 -> 467,87 +466,90 -> 470,90 +460,159 -> 460,154 -> 460,159 -> 462,159 -> 462,151 -> 462,159 -> 464,159 -> 464,152 -> 464,159 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +460,164 -> 464,164 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +496,30 -> 501,30 +461,87 -> 461,80 -> 461,87 -> 463,87 -> 463,80 -> 463,87 -> 465,87 -> 465,80 -> 465,87 -> 467,87 -> 467,86 -> 467,87 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +472,96 -> 476,96 +510,30 -> 515,30 +463,93 -> 467,93 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +475,99 -> 479,99 +466,168 -> 470,168 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +469,99 -> 473,99 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +464,109 -> 464,111 -> 463,111 -> 463,118 -> 473,118 -> 473,111 -> 468,111 -> 468,109 +499,13 -> 499,16 -> 498,16 -> 498,19 -> 507,19 -> 507,16 -> 501,16 -> 501,13 +483,44 -> 483,48 -> 481,48 -> 481,55 -> 489,55 -> 489,48 -> 487,48 -> 487,44 +495,26 -> 500,26 +460,159 -> 460,154 -> 460,159 -> 462,159 -> 462,151 -> 462,159 -> 464,159 -> 464,152 -> 464,159 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +499,28 -> 504,28 +483,44 -> 483,48 -> 481,48 -> 481,55 -> 489,55 -> 489,48 -> 487,48 -> 487,44 +461,87 -> 461,80 -> 461,87 -> 463,87 -> 463,80 -> 463,87 -> 465,87 -> 465,80 -> 465,87 -> 467,87 -> 467,86 -> 467,87 +483,44 -> 483,48 -> 481,48 -> 481,55 -> 489,55 -> 489,48 -> 487,48 -> 487,44 +461,87 -> 461,80 -> 461,87 -> 463,87 -> 463,80 -> 463,87 -> 465,87 -> 465,80 -> 465,87 -> 467,87 -> 467,86 -> 467,87 +469,93 -> 473,93 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +506,28 -> 511,28 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +469,166 -> 473,166 +460,159 -> 460,154 -> 460,159 -> 462,159 -> 462,151 -> 462,159 -> 464,159 -> 464,152 -> 464,159 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +468,137 -> 468,132 -> 468,137 -> 470,137 -> 470,130 -> 470,137 -> 472,137 -> 472,136 -> 472,137 -> 474,137 -> 474,127 -> 474,137 -> 476,137 -> 476,131 -> 476,137 -> 478,137 -> 478,130 -> 478,137 -> 480,137 -> 480,128 -> 480,137 -> 482,137 -> 482,128 -> 482,137 -> 484,137 -> 484,133 -> 484,137 +466,74 -> 466,71 -> 466,74 -> 468,74 -> 468,64 -> 468,74 -> 470,74 -> 470,65 -> 470,74 -> 472,74 -> 472,68 -> 472,74 -> 474,74 -> 474,68 -> 474,74 -> 476,74 -> 476,71 -> 476,74 -> 478,74 -> 478,65 -> 478,74 -> 480,74 -> 480,73 -> 480,74 -> 482,74 -> 482,64 -> 482,74 +461,87 -> 461,80 -> 461,87 -> 463,87 -> 463,80 -> 463,87 -> 465,87 -> 465,80 -> 465,87 -> 467,87 -> 467,86 -> 467,87 diff --git a/14/sample.txt b/14/sample.txt new file mode 100644 index 0000000..4e87bb5 --- /dev/null +++ b/14/sample.txt @@ -0,0 +1,2 @@ +498,4 -> 498,6 -> 496,6 +503,4 -> 502,4 -> 502,9 -> 494,9 |
