Compare commits
No commits in common. "221a81583a9fa04991723482215e83191cb10f51" and "e37883ea3a8afa9322f14c12d0ed16dfa714e0a7" have entirely different histories.
221a81583a
...
e37883ea3a
4 changed files with 0 additions and 335 deletions
140
day4/input
140
day4/input
|
@ -1,140 +0,0 @@
|
||||||
XMXXMSSSMSXSXMMXSAMMXXSXMASMSSXXMAMXAMXSXMXSMAMMASXXASMMXMASXMSSXMMMXMXSXXSXMXXSAMXSXSXSAMXMSAMXMAXXXMXMAMSASXMSSXMSXSXXMAXXSSSMXMXMXMMAASXM
|
|
||||||
MSSMMAAXAMMSAAAXXAMSXMAMXMSMAMMXSAXMXMASAMASMAMMASXMAMAXXXMASAAAXMSMSMAMAMMAMAMMMMXMASMMXMXAMASXMAMMMMASMMSMMMMASAAXAAMMMMSMXAAMSAMSASMMMMAX
|
|
||||||
AAAXMMXMSMASXMMSMXMMASMAAMXMASAMMAXSAMASAMASXXSMASASMSMMMMASMMMMMMAAXMXSAMSAMASMASAMAMASMMMMSAMXMAXAASASAAXAAXMASMMMSMXAAXAAMSMMMAXMAXMAASMM
|
|
||||||
SSMMXSAAXMMSAXMAXAAXAMXXMSSSMSMAMAMXAMXXXMXSXMMMMSAMXAXXAMXAXXMAXMASMXASAXXMSAXXASAMAXAMXXAXMXXMSASXMMASMMSSMSMMSASAMXSSSSMSAAAXMMMMXMMSXSXA
|
|
||||||
XAAAAMMSMSXXMXAASXSMSMSMXXMAMXMASXSSMMXMAMAMMMAAMMAMMMXSSMSAMXSMSASMXXMSXMAAMAMMMSXMAMMSXSASASAMXASXAMAXMAAAAXXMSXMXMXMXMAXAMXSAXAAXAXAXAMXS
|
|
||||||
SXMMSXAXASXAMMMMSXMXMASXMMXMMSMAXXMAMAMXAMASASMSMXAMXMMAMASAMXSXMMXAXSXSAMXMMAMAAMXMASMAXAAMAMSMMXMMMMMSMMMSAMXAXMMMSXSASMMMSMMMSSSMMMMMAMSM
|
|
||||||
AAXAXMSMAMSMMAAMSMSAMMMAMAASASMASM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||
XAAXAAMAAMMMMXMXSAMXSXMAAAAMMMSAXASAMXXMXXAMXSXMAXAAMAMAAXAMMSAAXXMXSAMXSAAAMXSAMXSAAAAXXMAMASAMMASMMMAMMSMMSSSMSASXMSSXMXXMAMMSSMMXXAXAAMMX
|
|
||||||
MSMMSSMMMSAAAAXMAXMAMMMSMMMSAAMMMAMAXXSMSMSMAMASXMSXSASMSMMSASMSMSAASMMMMMMSMXSASXMMMSXMASAMAMMMMAXASXXSAAAAAAMASAAXAXAAMXSMSSMAMAXMASMMMSSS
|
|
||||||
AAXAAAAXXSMMSSSXAMSAMXAAAAXSASAMMAMSAMXAAAAMASAMAAXMAXSAAASMMSAXAMMXMAMSAMXAXMSAMMAAAAXAXSXMMSXXMASAMMAMXSSMMSMAMSMAMMSMMSAMXAMASMMASXAAAAAA
|
|
||||||
SSSSSSMMXMAMMMXMAMSMMMSSSMXXMMMXSXSMSXMAMSMSXMXSMMMXMASXXSMSMMMMXMAMXAXSXMSAMXMXMSSMSXMSAMXASMXMAMAMXMMMMMAMXXMXXAXXXAXSXXXMSAMAXXASMSSMMMSM
|
|
|
@ -1,94 +0,0 @@
|
||||||
-- see if the file exists
|
|
||||||
local function file_exists(file)
|
|
||||||
local f = io.open(file, "rb")
|
|
||||||
if f then
|
|
||||||
f:close()
|
|
||||||
end
|
|
||||||
return f ~= nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- get all lines from a file, returns an empty
|
|
||||||
-- list/table if the file does not exist
|
|
||||||
local function lines_from(file)
|
|
||||||
if not file_exists(file) then
|
|
||||||
return {}
|
|
||||||
end
|
|
||||||
local lines = {}
|
|
||||||
for line in io.lines(file) do
|
|
||||||
lines[#lines + 1] = line
|
|
||||||
end
|
|
||||||
return lines
|
|
||||||
end
|
|
||||||
|
|
||||||
-- tests the functions above
|
|
||||||
local file = "input"
|
|
||||||
local lines = lines_from(file)
|
|
||||||
|
|
||||||
-- Solution Starts here
|
|
||||||
|
|
||||||
local target = "XMAS"
|
|
||||||
|
|
||||||
---@diagnostic disable-next-line: redefined-local
|
|
||||||
local function count_xmas_at_index(lines, line_idx, char_idx)
|
|
||||||
local count = 0
|
|
||||||
|
|
||||||
local line = lines[line_idx]
|
|
||||||
|
|
||||||
local test_words = {}
|
|
||||||
-- Forward
|
|
||||||
test_words[#test_words + 1] = line:sub(char_idx, char_idx + 3)
|
|
||||||
-- Backward
|
|
||||||
test_words[#test_words + 1] = line:sub(char_idx - 3, char_idx):reverse()
|
|
||||||
|
|
||||||
local up_right = ""
|
|
||||||
local down_right = ""
|
|
||||||
local up_left = ""
|
|
||||||
local down_left = ""
|
|
||||||
local up = ""
|
|
||||||
local down = ""
|
|
||||||
for offset = 0, 3 do
|
|
||||||
local up_idx = line_idx - offset
|
|
||||||
local down_idx = line_idx + offset
|
|
||||||
local right_idx = char_idx + offset
|
|
||||||
local left_idx = char_idx - offset
|
|
||||||
|
|
||||||
if up_idx >= 1 then
|
|
||||||
up = up .. lines[up_idx]:sub(char_idx, char_idx)
|
|
||||||
|
|
||||||
up_right = up_right .. lines[up_idx]:sub(right_idx, right_idx)
|
|
||||||
up_left = up_left .. lines[up_idx]:sub(left_idx, left_idx)
|
|
||||||
end
|
|
||||||
|
|
||||||
if down_idx <= #lines then
|
|
||||||
down = down .. lines[down_idx]:sub(char_idx, char_idx)
|
|
||||||
|
|
||||||
down_right = down_right .. lines[down_idx]:sub(right_idx, right_idx)
|
|
||||||
down_left = down_left .. lines[down_idx]:sub(left_idx, left_idx)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
test_words[#test_words + 1] = up_right
|
|
||||||
test_words[#test_words + 1] = down_right
|
|
||||||
test_words[#test_words + 1] = up_left
|
|
||||||
test_words[#test_words + 1] = down_left
|
|
||||||
test_words[#test_words + 1] = up
|
|
||||||
test_words[#test_words + 1] = down
|
|
||||||
|
|
||||||
for _, v in ipairs(test_words) do
|
|
||||||
if v == target then
|
|
||||||
count = count + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return count
|
|
||||||
end
|
|
||||||
|
|
||||||
local xmas_count = 0
|
|
||||||
-- print all line numbers and their contents
|
|
||||||
---@diagnostic disable-next-line: unused-local
|
|
||||||
for line_idx, line in ipairs(lines) do
|
|
||||||
for char_idx in line:gmatch("()X") do
|
|
||||||
xmas_count = xmas_count + count_xmas_at_index(lines, line_idx, char_idx)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
io.output():write(xmas_count)
|
|
|
@ -1,91 +0,0 @@
|
||||||
-- see if the file exists
|
|
||||||
local function file_exists(file)
|
|
||||||
local f = io.open(file, "rb")
|
|
||||||
if f then
|
|
||||||
f:close()
|
|
||||||
end
|
|
||||||
return f ~= nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- get all lines from a file, returns an empty
|
|
||||||
-- list/table if the file does not exist
|
|
||||||
local function lines_from(file)
|
|
||||||
if not file_exists(file) then
|
|
||||||
return {}
|
|
||||||
end
|
|
||||||
local lines = {}
|
|
||||||
for line in io.lines(file) do
|
|
||||||
lines[#lines + 1] = line
|
|
||||||
end
|
|
||||||
return lines
|
|
||||||
end
|
|
||||||
|
|
||||||
-- tests the functions above
|
|
||||||
local file = "input"
|
|
||||||
local lines = lines_from(file)
|
|
||||||
|
|
||||||
-- Solution Starts here
|
|
||||||
|
|
||||||
---@diagnostic disable-next-line: redefined-local
|
|
||||||
local function count_xmas_at_index(lines, line_idx, char_idx)
|
|
||||||
local line = lines[line_idx]
|
|
||||||
|
|
||||||
local up_idx = line_idx - 1
|
|
||||||
local down_idx = line_idx + 1
|
|
||||||
local right_idx = char_idx + 1
|
|
||||||
local left_idx = char_idx - 1
|
|
||||||
|
|
||||||
local char_count = {}
|
|
||||||
char_count["M"] = 0
|
|
||||||
char_count["S"] = 0
|
|
||||||
if up_idx >= 1 then
|
|
||||||
if right_idx <= #line then
|
|
||||||
local key = lines[up_idx]:sub(right_idx, right_idx)
|
|
||||||
if char_count[key] ~= nil then
|
|
||||||
char_count[key] = char_count[key] + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if left_idx >= 1 then
|
|
||||||
local key = lines[up_idx]:sub(left_idx, left_idx)
|
|
||||||
if char_count[key] ~= nil then
|
|
||||||
char_count[key] = char_count[key] + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if down_idx <= #lines then
|
|
||||||
if right_idx <= #line then
|
|
||||||
local key = lines[down_idx]:sub(right_idx, right_idx)
|
|
||||||
if char_count[key] ~= nil then
|
|
||||||
char_count[key] = char_count[key] + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if left_idx >= 1 then
|
|
||||||
local key = lines[down_idx]:sub(left_idx, left_idx)
|
|
||||||
if char_count[key] ~= nil then
|
|
||||||
char_count[key] = char_count[key] + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if char_count["M"] == 2 and char_count["S"] == 2 then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local xmas_count = 0
|
|
||||||
-- print all line numbers and their contents
|
|
||||||
---@diagnostic disable-next-line: unused-local
|
|
||||||
for line_idx, line in ipairs(lines) do
|
|
||||||
for char_idx in line:gmatch("()A") do
|
|
||||||
if count_xmas_at_index(lines, line_idx, char_idx) then
|
|
||||||
xmas_count = xmas_count + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
io.output():write(xmas_count)
|
|
|
@ -1,10 +0,0 @@
|
||||||
MMMSXXMASM
|
|
||||||
MSAMXMSMSA
|
|
||||||
AMXSXMAAMM
|
|
||||||
MSAMASMSMX
|
|
||||||
XMASAMXAMM
|
|
||||||
XXAMMXXAMA
|
|
||||||
SMSMSASXSS
|
|
||||||
SAXAMASAAA
|
|
||||||
MAMMMXMMMM
|
|
||||||
MXMXAXMASX
|
|
Loading…
Reference in a new issue