Day 4 done

This commit is contained in:
2025-12-04 08:16:42 +01:00
parent f159a0fee6
commit febe80cfb5
5 changed files with 341 additions and 0 deletions

81
2025/Day3/Day3_second.lua Executable file
View File

@@ -0,0 +1,81 @@
#!/usr/bin/lua
-- See https://adventofcode.com/2025/day/3
local DEBUG = false
function debug(msg)
if DEBUG then
print(msg)
end
end
function MaxJolt(Battery, Size)
-- TODO - This going to be a rework, I need to loop 12 times
local BatteryDigits = {}
for I = 1, tonumber(Size) do
BatteryDigits[I] = 0
end
-- lastdigit = tonumber(string.sub(Battery, -1))
-- debug("lastdigit " .. lastdigit)
--
-- BatteryNoLast = string.sub(Battery, 0, -2)
-- BatteryNoLast:gsub(".", function(c)
-- table.insert(b, c)
-- return c
-- end)
--
-- for key, value in pairs(b) do
-- checkdigit = tonumber(value)
-- if firstdigit < checkdigit then
-- firstdigit = checkdigit
-- end
-- end
--
-- local passedfirst = false
-- for key, value in pairs(b) do
-- checkdigit = tonumber(value)
-- if passedfirst and seconddigit < checkdigit then
-- seconddigit = checkdigit
-- end
-- if checkdigit == firstdigit then
-- passedfirst = true
-- end
-- end
--
-- if seconddigit < lastdigit then
-- seconddigit = lastdigit
-- end
--
-- debug("First " .. firstdigit)
-- debug("Second " .. seconddigit)
-- return tostring(firstdigit) .. tostring(seconddigit)
local BatteryString = ""
for I = 1, tonumber(Size) do
BatteryString = BatteryString .. tostring(BatteryDigits[I])
end
return BatteryString
end
function TestMaxJolt(Battery, Test, Size)
local MJ = MaxJolt(Battery, Size)
if MJ == Test then
print("WIN - " .. Battery .. " " .. MJ .. " == " .. Test)
else
print("FAIL - " .. Battery .. " " .. MJ .. " != " .. Test)
end
end
print("# Self Test")
TestMaxJolt("987654321111111", "987654321111", 12)
TestMaxJolt("811111111111119", "811111111119", 12)
TestMaxJolt("234234234234278", "434234234278", 12)
TestMaxJolt("818181911112111", "888911112111", 12)
print("# Calculate MaxJolt")
local TotalJolt = 0
for battery_line in io.lines("full_input") do
TotalJolt = TotalJolt + MaxJolt(battery_line)
end
print("Total " .. TotalJolt)

108
2025/Day4/Day4_first.lua Executable file
View File

@@ -0,0 +1,108 @@
#!/usr/bin/lua
--Advent of Code - 2025 - Day 4
--
--https://adventofcode.com/2025/day/4
-- Problem, find space for forklift to move
-- Tasks
-- [ ] Load Paper roll in array
-- [ ] Walk through Array finding spots
--
--
--local input_file = "test"
local input_file = "full"
local warehouse = {}
local row = 0
local col = 0
for line in io.lines(input_file) do
row = row + 1
warehouse[row] = {}
col = 0
for location in line:gmatch(".") do
col = col + 1
warehouse[row][col] = location
end
end
function space_for_forklift(warehouse, x, y)
-- I'm making the assuption here that all rows have the same columns
-- normally I would say write a selfcheck to confirm input is sound
local rows = table.getn(warehouse)
local columns = table.getn(warehouse[1])
local spaces = 0
if warehouse[x][y] ~= "@" then
-- No paper roll, so skip
--print("warehouse check " .. x .. "," .. y .. " no paper roll")
return false
end
local freespace = 0
local rolls = 0
for rowskim = -1, 1 do
if warehouse[x + rowskim] == nil then
freespace = freespace + 3
else
for colskim = -1, 1 do
local w = warehouse[x + rowskim][y + colskim]
--print("checking " .. (x + rowskim) .. "," .. (y + colskim) .. "=" .. w)
if not (rowskim == 0 and colskim == 0) then
if w == "@" or w == "X" then
rolls = rolls + 1
else
freespace = freespace + 1
end
end
end
end
end
if rolls < 4 then
--print("warehouse check " .. x .. "," .. y .. " found space")
warehouse[x][y] = "X"
return true
else
--print("warehouse check " .. x .. "," .. y .. " no space")
return false
end
end
function remove_rolls(warehouse)
local maxrows = table.getn(warehouse)
local maxcolumns = table.getn(warehouse[1])
for r = 1, maxrows do
for c = 1, maxcolumns do
if warehouse[r][c] == "X" then
warehouse[r][c] = "."
end
end
end
end
-- print(space_for_forklift(warehouse, 1, 1))
-- print(space_for_forklift(warehouse, 1, 3))
-- print(space_for_forklift(warehouse, 2, 1))
-- print(space_for_forklift(warehouse, 3, 7))
function countrolls(warehouse)
local maxrows = table.getn(warehouse)
local maxcolumns = table.getn(warehouse[1])
local forkliftaccess = 0
for r = 1, maxrows do
for c = 1, maxcolumns do
if space_for_forklift(warehouse, r, c) then
forkliftaccess = forkliftaccess + 1
end
end
end
return forkliftaccess
end
totalrolls = 0
for I = 1, 100 do
cr = countrolls(warehouse)
totalrolls = totalrolls + cr
print("Loop " .. I .. ": " .. cr .. " Rolls removed")
remove_rolls(warehouse)
end
print("Total rolls removed " .. totalrolls)

135
2025/Day4/full Normal file
View File

@@ -0,0 +1,135 @@
..@.@@@...@@@@.@.@@.@.@@@@.@@@.@@@..@@@@@.@@@@@@.@.@@.@..@@@@@@@.@@.@@.@@.@@@...@@@.@@..@@@..@@@@@.@@.@..@.@@@@@.@@.@@.@@.@..@.@.@@...@
@@@@@@@.@@@@@@@.@.@@@@@@@@@@@@@.@...@@@@@@@@@@@@.@..@@@.@@.@..@@@@.@.@@@@@@@.@@@.@@@@@@.@.@@@@@@.@@@...@@@.@@@..@@@@.@@...@@@@@@@@@..@.
@@...@@.@@@@@.....@@@.@.@.@.@@..@@@@@..@.@.@@.@@.@@@@@@@...@.@@..@@@@@@@@.@@@..@@.@@@@@.@@.@.@@@@@@.@@.@@.@@.@..@.@.@.@@.@.@@@@@..@@@@@
@@.@..@.@@@.@@@...@...@.@@@@@@.@@@.@.@@@..@@@..@@.@@@..@@@@.@@..@@.@@.@.@@@@@.@.@@.@@@..@@@@@@@@.@@@@@@@....@.@..@@..@@.@@@..@@@.@.@.@@
..@.@@@.@@.@@@@@@@.@.@@@.@@@@.@@.@@@..@@@@@@@.@@..@@@@.@.@@..@@@@@@@@@...@@.@@@@..@@@@@.@@@.@.@.@@.@@@@@.@@.@@@@.@.@@@@.@.@.@.@@.@@@@@.
@@.@@@@@@@@.@@.@....@.@@@.@@@.@@@..@@.....@@@@@@.@@@@@.@.@@@@.@@..@@@@@@@.@..@@@@@@@@@@@@.@@@@@.@...@..@@@@@@@@@@@@..@@@@@.@@.@@.@@@@@.
..@.@@@@@.@@@@.@@.@@@..@@@@.@@.@@@@..@@@@@..@@@@@..@@@@..@.@.@@@.@@......@@@@@@@@@@@.@@@@@.@@@@..@@.@..@@@@@@@@@@@@@@@@.@..@@@@.@.@@.@@
@@@.@@@@@@@@@..@@@.@@@..@@@@.@@.@@..@.@.@.@@.@..@@@.@@@.@.@.@@@@@@.@@...@.@..@..@@.@@@@.@@@@.@..@.@.@@.@@@..@@@@@@.@@@.@...@@...@@@.@@@
@..@.@@@@...@@.@.@@@@@@@@@@@@..@@@@@@@@..@@...@.@@@@@@@@@@@@.@@.@@.@@.@@@@@@@....@@@@@.@..@@.@@.@.@@@.@@@@@@.@@..@@@.@@@@@@@@@@@@.@@@@.
.@.@@@.@@.@@@.@@..@@@@.@@@.@@@@@@@.@@@@@@.@@@.@@.@@...@@@@@.@@@.@.@@@@@...@@@.@.@..@.@..@@@@@@@@.@.@...@.@@.@.@@.@@@@.@.@@@@@@@@..@@@@@
..@@@.@@@@@@.@@@@..@@@@@@@@@@@@@@.@@...@@@.@.@@@@@@@@@@@@@..@@@.@@.@@@@@@..@@@.@@@.@..@@....@.@......@@..@.@@..@@@@@@.@@...@@@@@@@..@@@
@@.@@@.@@.@..@@@@@.@..@...@..@@@@.@.@@.@.@....@@@.@@.@@..@@..@@@@...@@@@@.@@@..@.@@@@..@@@.@.@....@@@@@.@@@@.@...@@@..@@.@..@@@..@@@...
@@@@.@..@@@@@@@@@@@..@.@@@.@.....@.@@@@@@@..@@...@@@@.@..@..@@@@@@@.@@@@.@@@.@@@...@@.@.@@@@.@@@..@@..@@.@.@..@@@.@@....@@@@@@..@.@..@@
..@.@@.@@@@.@.@@@@@@@.@@@@@@@@@..@@@@@@@.@.@.@@@.@@.@.@........@.@...@@@@@.@@@..@@.@@@@@@...@@.@.@@.@@@@.@@@@@.@@@.@@@..@.@@@.@.@....@@
.@@.@@.@@@@@@.@@@.@@.@@@.@@@@@@@.@@@@.@@.@@..@@@@@..@@@.@@@@@@@@@@@.@@@@..@@@.@.@@.@..@@..@..@@.@.@.@@@.@@.@@...@.@@@@@@@.@@@@@@@@@@.@@
@.@@@...@@.@@@.@@@@....@...@@..@@@@@.@@@..@.@.@@.@@@.@@@@.@@.@.@@@@.@@.@@@..@@@@@@@@@@@@@...@@..@.@@.@@@.@@..@@..@@@@@...@.@.@..@@@.@@@
@.@....@@@@..@@..@.@....@.@@@.@@...@@@@.@.@@@.@..@@@@..@@@@@.@....@..@@@.@@...@.@@.@@@@.@@@@@@@@.@@@@.@@@@@@.@@@.@@@@@..@@.@..@@@@@@..@
@...@@.@..@@@@.@.@..@@.@@@@...@@.@@...@@@@.@@.@@.@@@..@@@..@@@@@@@@@@@@@@@.@.@@@@@@@@@.@@@@.@@@....@@@...@.@@.@@.@.....@@.@.@@@@@@@..@.
@@@.@@@@@.@.@.@@@...@@@..@@@@@@@..@..@.@@@@@@@@@.@@.@@..@@@.@@@@@.@@.@@@..@@@@..@.@@.@@@@@.@@.@@.@@@@@.@.@@@@.@..@@.@@@@@@@@..@@...@...
..@..@.@@@.@@@@.@@@@@..@..@.@.@@@.@@@@.@@@@@@.@@@@@..@@@.@@@.@@@@@@@.@@@@.@@..@.@@@@.@@@...@.@.@@@@@@.@@.@.@.@@@.@@@@...@@.@@@..@@@@@@@
..@@@....@@@.@@.@@@.@@@@.@..@@@@......@@.@@@@@@.@@..@..@@@@@@@@.@@@.@..@@@@@.@@@@.@...@@..@@.@.@@@@@@.@..@....@@@.@@@@@@.@@@@...@...@.@
@@.@@.@@.@.@@@@@@@.@@@@@@@@@@.@@@@.@@@.@@@@.@@@@.@@.@@.@@@@@@@.@.@@@@@@@.@.@@@@.@@@..@...@@@@@@@@@..@@@@...@@@@@@@.@@@@@@@@@@@@@@.@@@@@
.@@.@@.@.@@@@@@@@.@..@@@@.@@@@@@@.@@.@..@@@@@@.@.@.@@@@@..@.@.@..@@..@@..@@@@@@@.@@@..@@.@.....@@........@@@@@@@@.@@.@.@@@..@@@@.@@@@.@
..@@@.@..@@@.@.@@.@@@@@@...@@.@@@@@.@@.@@@....@.@@@@@..@@@.@@@...@@@.....@..@@@@@@@@@@....@.@.@.@@@..@@@.@@.@.@.@@.@@.@.@@...@@.@..@@.@
@.@..@@.@.@..@@@@@@.@@@@..@...@.@@@@@.@@@.@.@@@@@@@@@@@@@@.@@@@..@@.@@.@.@.@@@@@.@.@.@...@@@.@....@.@.@..@@..@@.@..@@.@@.@..@.@@@@@.@.@
.@.@.@.@@..@@@@@@@.@@@@@.@@@@@.@@.@.@@@@..@@.@@@@.@.@@@.@..@@.@@.@.@@@.@.@@@@.@@@..@@@@@@@.@..@@..@@@@.@@...@@@@@@@@@.@@@.@.@...@@@..@@
@@@@@.@@@@.@.@@@.@...@@@.@.@@@@.@.@@@@@@@.@@@..@@.@@@@@..@@@@@@@@@@@.@.@@@..@.@.@@@.@.@@.@@@..@@@.@@@@@@.@@@@@.@@.@@..@@@@@@.@@.@@@.@@@
@.@@@.@@@@@.@@.@.@.@.@@@@@@..@.@.@...@.@@..@@...@@..@@@...@...@.@@@@.@@@@@@...@...@..@@.@@..@@@.@@@.@@.@@.@..@@.@@..@@@@@...@@..@@.@@@@
@@..@@.@@@@@@@...@....@@@@@.@@@...@@@@.@@@@...@@@.@@@@.@@..@@@@..@..@..@@@@@@@@@@.@..@@@@@@@@.@@@@@@@.@...@.@@@@@@@.@.....@.@@@.@.@.@@@
@.@..@@..@@@.@@..@@..@.@.@...@.@@@@@..@..@.@@..@@@.@@@@.@.@...@@@@..@..@@@@@@@@@@.@..@@.@@@@@@.@.@.@@@@@.@....@@@.@@@@..@....@.@@@.@@.@
.@.@@.@.@@@.@.@.@.@@@@.@.@@@@@.@@.@@.@....@@.@@.@@..@@@@.@.@.@@@@@.@@@@@@@@..@@@....@@@@@..@@@@@@@.@.@.@@..@.@@@..@@@@@@@@@...@@@@@@.@@
@.@@.@@@@@@.@@@.@@..@.@@.@@.@@..@@@@.@@.@@@@@.@.@@@.@...@..@.@@.@@@@@..@.@...@@@@.@.@@.@@@@@@@@@@..@.@@@@.@.@@.@@@@.@@@@@.@@@@@@@.@@@@@
.@.@..@@....@@@@@.@@@....@.@..@.@@.@@.@..@.@.@...@.@@@@.@..@.@@.@@@@@@@@@..@@@@@@@@@@@@.@..@@.@@.@@..@.@@.@@.@@@@@@@.@@@@..@@.@.@@.@@@@
.@@..@@@@@@@.@@.@.@@@...@.@@.@.@@@@@@@.@@....@@@@..@.@@..@@@@..@@@@@...@@.@@.@@@@.@@@..@@.....@.@@@@@..@@.@@@.@@@@@.@@.@..@...@..@.@@.@
.@@.@.@.@@@@@..@.@@.@@.@@...@@@..@@@@@.@.@@@@@@@@@.@@@@.@@@..@@@@@@@@@.@.@..@.@.@@@@.@@@.@@@.@@.....@..@@..@.@..@.@@@@.@@.@@.@@@@.@.@@.
.@@@.@@@.@.@..@@.@.@.@.@@....@.@.@..@..@@@@@...@@@@@@@@@@.@.@@@@@@.@.@@..@@@...@@@.@@..@@@@@.@..@..@@.@.@.@@@..@.@@@@@@@.@@@.@@...@@@@@
.@..@@@.@.@@@@@@@.@@.....@.@@@.@@.@@@@@@@@..@.@@@@.@@...@@@...@@@@.@@@@@@@@@......@..@@.@@@@@.....@@@...@@.@.@@@@.@..@@.@@@@@.@@@@@@@@@
@@.@.@..@@@@@@@.@@@@@@@.@.@.@.@@..@@@......@@.@.@@@@@@..@.@@@..@@@.@@@.@.@@@.@@@@@@@@@@.@.@@@@@.@..@@..@@...@@@...@..@@..@@@.@@@.@@.@@.
@@@@@.@@.@.@.@@..@@@@.@@@@@@..@@@@@.@..@@.@..@@@@@.@.@..@@.@@@@.@@@..@@@..@@@@@@@@@@@@@@@.@.@@..@.@@@@@@@@.@@...@@.@@..@@..@@@.@....@.@
@..@@@@@@.@@..@.....@@@..@@@..@..@..@@@@@@.@@@@.@.@@@@@@@@@@.@@..@@.@@@@.@@@@.@..@.@.@@@.@.@.....@@@@..@@@@.@@@@..@@@.@.@@@@.@@@@@.@@.@
..@.@@.@@....@.@@....@@..@@@.@@.@@.@@@..@.@@.@@@..@@@@@@.@@.@@.@@@.....@..@@@@.@.@@@@@@.@@.@@@.@@....@@.@@@@..@.@@@.@@@@...@@.@@@@@@.@@
@.@@.@@...@@..@@@@...@..@@@@@@@@@@@.@@@...@@@.@@.@.@.@...@@..@@@@@.@@@@@@@@@@@@@@.@...@@.@..@@@.@.@@.@.@@@@@@..@@..@@@.@@@.@@@....@@@@.
@.@@@@@@@@@@.@@....@@@@@.@...@@.@@@@....@.@.@@@@.@@@..@......@..@@..@..@@@@@.@.@@@@@@.@@@@@@...@@..@@@@@.@...@@..@.@@@@@.@@@@.@@..@@@@.
@.@@@@@@@.@@@@@@..@..@@@@..@.@@@..@.@@@.@.@.@.@@.@.@...@@@.@@@@@..@.@@@@@@@@.@@@..@@@@@..@@....@@@.@.@....@.@@...@.@@@..@.@@.@.@@.@..@@
@@@@@@@@.@@@@@...@@@@.@@@.@@...@.@@@@@@@@...@@@@..@@.@@@.@@@.@@@.@@@@..@@@@@@@@.@@.@.@.@@@@@@..@.@.@.@.@@@.@@.@@@@@@@@@@@@.@.@@@@@@..@@
..@..@@@@@@..@.@@@@.@@@@@....@@@.@.@@..@.@@.@.@.@@@@@@@.@@.@@@..@....@.@@@..@@.@.@@@.@@@@@@.@.@@@@@@@@@@.@..@@@@..@@.@@@@.@.@@@@.@@@@.@
@.@@.@@@@@.@@@@.@.@@@.@.@@@@@....@...@@@@@.@@.@@@@.@.@@@...@.@...@@@@@@.@@.@@@@@@.@@....@@..@@@@@@..@@@@@.@...@@@..@@..@@@@...@.@@@@@.@
.@@@@.@.@@@@@@@@@@.@@@.@@@..@.@@@@@@@@@@@.@@@@@.@..@@@.@.@@.@@..@@@@@@@@@@@.@.@..@@@.@.@.@..@@@.@@...@@@@@..@.@.@.@@@@@@.@@@@@@@.@@@@@.
@.@@@@.@@@@@@@.@@@.@@.@..@@.@.@@@.@.@....@.@@@@@@....@..@@@@.@@.@.@..@@@@@@.@.@@@@..@@@.@.@@@@.@@@.@.@@@.@@.@@...@@.@@.@...@.@....@@..@
..@.@.@..@@.@@@.@@@@@@@@.@.@.@@@@@@@.@.@@.@@@@@@@...@@@.@.@@@..@@@@..@@@@..@.@.@.@@.@.@@@@@..@.@@.@@@@.@@.@@@.@@..@@@@.@.@@@@@..@..@@@.
@@@@@.@@@@.@@@@@@@@@@@....@@.@@@@@@@@.@..@.@@.@@@...@@.@@@.@@...@@@@@@@@..@.@@.@.@.@@@@.@@...@...@.@@@@..@@.@.@.@@@@@@.@@.@@...@..@....
@.@@@@@.@.@..@@.@@.@.@.@@@@@.@@@@..@@.@@....@@..@.@@@..@.@@@.@.@@@..@.@.@@@@@@..@@.@@.@@@.@@@@@.@@@.@@@@@@@@.@@.@@@@@.@@@@@@@@...@...@.
@.@@@@@@@@.@@@@..@@@@@@.@@@@@@@@@@@@@.@@.@@@@@@@@@@.@@@@@.@.@@.@@@.@@@.@.@.@@@.@.@@..@@.@@@.@@.@.@...@@@.@@@@@@@@....@@@@@..@.@@@@@@.@@
@@@@@@....@..@@...@@@@..@.@@@....@@..@@@@.@@.@@..@@@@@@@..@..@.@..@@..@@@@@@@.@.@@.@@@@.@@..@@@@@.@@@@.@@@..@@@.@...@@@@@..@..@.@@@@@@.
@@..@.@.@@@@@..@@.@@@.@@.@@@@@.@@@@@@.@@.@....@.@@@.@.@....@.@@..@...@@@.@@@@...@@@@....@@.@@@..@...@..@..@@@@@..@@....@.@@@@@.@.@..@@@
.@@@@@@.@@@.@.@@@@......@@@..@.@.@@@.@@@.@.@@.@@@@.@@@.@@.@@@@@@@@@@@.@@.@@@@@@@.@@@.@..@@@@@...@@@@@@@.@..@.@@@@.@@.@@..@@..@@@@@@@@.@
@@@@..@@@@@@@..@@@@@@.@.@@@@@.@.@@...@@@...@@@@.@.@@@.@@@@..@..@.@@.@..@@...@.@.@.@.@@@@.@@@@.@@@.@.@.@@@@.@.@@@@@..@@.@.@@@.@@@@..@@@.
.@@.@@@.@..@@...@@@@@@@@.@@@@.@@..@..@@@@@.@@@@.@@..@.@...@@.@.@@@@.@@...@.@.@...@.@@@@@...@@@@.@@@..@..@@@@@.@@@@@@@.@@@@@@@.@.@.@@.@@
@@.@@......@@@@@@@@.@..@@@@@..@@@.@@@.@@..@@.@@@....@@.@@@@@@@@@@....@...@@@@@@@@@@@@@@@@@..@@@@@@...@@@.@@.@@@@@..@@..@@..@.@.@@@@@.@.
@@..@@@@@....@.@@.@@@@@@.@@.@@@@..@@..@@@@..@@@@.@@.@@@@@.@@@@@.@@@@@@@.@.@@@..@@@.@@@@.@@@@@@@@@@@@@@@....@@@@@@@..@.@@.@@@@.@.@.@@@@.
@@.@@@..@.@@@@.@@....@@@@@.@@@@.@@@@@@.@..@@@@@@@@@@@@.@@.@.@@....@.@..@..@@@@@@@.@.@@@.@..@.@.@.@@@@.@@.@@@@@.@@@@@@@.@@@@@..@...@@@..
.@@.@@@.@.@@@@.@...@@..@.@.@..@@.@@.@...@@.@.@@..@.@@@@@.@@@.@.@...@.@.@@.@@@@@.@@@@.@@@@@.@..@@@@@@@.@.@..@@....@..@@...@@@@@@@...@.@@
@..@@@.@@@@@@@..@.@.@@.@@@.@@@.@@..@.@.@@@@..@.@@.@@.@@.@@.@@.@.@....@@@.@@@@@@.@..@@.@.@@@.@@@@@@@@@@@..@@@@.@.@@@.@@@@@.@.@.@@@@@..@@
.@@.@@@@.@.@@.@@..@.@.@..@@@..@.@@@.@.@...@@.@@@@@@.@@@.@@.@@.@@@@@.@@.@@@.@@@@.@..@..@.@@@@.@@@@@@@.@@@@....@@@@@.@.@@@..@.@@@.@@..@@@
@@@@@@.@.@.@@@@@@..@@@@@@.@@@@@@.@@@@..@.@@...@....@..@.@@@@@...@@..@..@.@@..@@@@.@@.....@@@@@@@.@@...@@.@@.@..@@..@@@.@.@@.@.@@..@.@@@
.@.@...@@@@@.........@@@.@@@@..@...@@@@..@@.@.@.@.@@@.@.@@@@.@@@@...@@@..@@@@@@@@@@@@@.@..@..@@@@..@@..@@.@@@@@@@@.@@@@@.@@@..@.@@..@.@
@@.@....@.@@@...@@.@@@@@@@.@@.@...@@@@@.@@@@..@@..@@@@@..@..@@@@@.@..@.@@....@@@.@@@@.@.@@..@@@@@@@@@@@..@..@..@@..@@..@@@@.@@@@.@@.@.@
.@@@@...@..@@@.@@.@.@....@@.@@@@@@@@...@.@@@...@.@.@@@.@@@.@@@@.@..@.@..@..@..@@@@@@..@@@@.@.@.@.@.@.@@@@@@@@@@.@..@.@@@.@@@@@.....@@@@
@@@..@..@.@@@@.@.@@.@@@...@@@@@@@@@.@@@@@@@.@.@.@.@@@@.@@@@.@.@@..@@@..@@@@.@@@.@@..@.@@@...@.@....@@@@@.@.@..@..@@@@..@@@@.@@.@@@@@@@.
.@@@@..@@@@@@@@@.@@@@@@@.@@@@...@@@@@@....@@@@@@@@@@@@..@@@@@@.@.@@.....@@@@.@@@@@..@@@@@@@@@@.@@@@@.@@@@@@@@@@@@@@.@.@@.@@.@..@@@.@@..
@@@..@.@.@@@@....@.@.@.@@@@@@.@@.@@..@@.....@@.@@@@@.@@..@@@.@@.@.@@@@@...@@.@@@..@@..@@.@@@...@@.....@.@@..@@@.@.@@@..@.@@@.@@@..@@@@@
@@@.@.@..@..@@@@.@.@@@.@@@@@.@.@@@@@@@@.@..@@.@...@@@....@@@.@@@@..@@@@.@@@@.@..@@...@....@@..@@@@.@@@@@@@@@@@@@@@@.@..@.@@..@@.@@.@..@
...@....@.@@@@@@@@@..@@@@@.@@@..@@@@.@...@@@.@@@.@@.@..@...@@@..@.@@.@@@@.@@.@@@.@.@@..@@@..@@.@@..@@@@.@@@@@@@@....@...@.@.@....@@@..@
@.@@@.@@@@.@@.@.@@..@@..@.@.@@@@.@..@@@.@@@.@@@......@.@.@@....@@.@.@@@@@@.@@@.@@@.@@@.@@.@@@@...@@.@@.@@.@.@@@@@@@@@@.....@.@.@..@@@@@
@.@....@@.@@@@@.@@.@@..@.@@.@@@@.@@.@.@@.@.@..@@@@@.@@@.@..@@.@.@.@@...@@.@@.@@@@.@.@@.@@@@@@@@@@@@@@@.@@@@@@@.@.@@.@@.@@.@@..@@@@@@@@@
@@.......@@.@@...@@@@@@.@@@@@@@.@.@@@.@..@@.@.@@@.@@.@@@@@.@..@@...@.@@@..@@.@@....@.@.@@@@@@@....@@@..@@@@@@@@..@.@@@@@..@@@@@.@...@@@
@...@.@..@@@@@.@......@..@.@..@..@@@..@@@@@.@@@@@..@@@@@@@..@@.@@@.@.@..@@@..@@.@.....@.@@@.@@@@.@@..@@@@@@@@.@...@@@@@@@@@@.@.@@@@..@.
@.@@.@@...@@.@@..@.@@@@.@.@@@@..@@@.@.@@.@@.@@.@@.@@.@@@@@@@@@.@@.@@.@@@..@@.@@@@.@@.@@.@@.@.@@@@@@@@@@..@@@..@@..@@@.@..@@@..@@@.@.@@@
@@.@..@@.@@@@.@@@@@@@@..@@.@@.@.@@@.@@@..@@@@.@@@.@@.@@@@@@@@@@@@@.@.@@@@.@@.@..........@.@..@@@@@@@...@..@...@..@..@@@.@@.@@.@@.@@@.@.
..@@@@@@.@...@@@..@@.@@@.@@@@@@@@......@@..@.@.@@@@@@@@..@.@@.@..@@@@@.@@.@@@.@.@.@@@@.@@@@@.@.@.@@.@@@@@.@@@@@..@..@@.@.@.@@..@.@..@.@
...@@.@@@@@@@.@@@.@@@@@@@@@@@@@.@...@@.@.@.@@@@@@@..@@@@@@@.@....@@.@@..@@..@@@.@@@..@@@.@@.@@@.@@@@@@@.@@.@..@..@.@@..@@@@@@@@..@@.@@@
.@@@@.@@@@@.@@@@...@.@.@@@@@..@.@@.@@@@.@@@@@.@@.@....@@@.@...@.@@.@.@@@@.@..@@.@@.@@@.@@@@@.@.@@@...@@..@@@@..@@@...@.@@@@@@@@@..@@.@@
..@@@.@..@@.@@@@@@@@.@.@@.@@@@@.@.@@@.@@@..@@.@@@@@@@@..@.@@.@@.@..@@@@@.@@.@@@@@@@@..@@@@.@@@.@@@.@.@..@.@@..@@@@@@@.@@@@@..@@.@@@.@@@
@@@..@..@...@@@@@@@.@@..@.@.@@@@@@@@@@.@@@@@.@.@@@@.@@@@@@@@@@@@@@@@@@@@@@@@.@@@.@@..@@@.@@.@@@.@@.@@.@..@@...@@@.@@@@@@@....@@..@@...@
..@.@..@@.@...@.@.@@@@@@.@....@.@.@@.@@@@@@@@@.@@@@@@@@@@.@@@@..@@.@@...@.@@@@@.@@..@@.@@.@@..@.@.@.@.@@@.@@@@@..@@..@.@.@@.@@@@@@@..@@
.@.@@@@..@@@.@@@.....@.@...@@.@@.@@@@.@@.@@@...@....@@@@@..@.@@@@...@@@@@.@@@..@@.@@@@@@.@@.@@@@@@.@@@...@@@@@..@.@@@@..@@@@.@@@.@@@@.@
.@@@@@@@@@.@@.@.@@.@@.@.@@.@@@@.@@.@@@.@@@@@@@@@@.@@@.@@.@@@.@@@....@@@@@@@@.@..@@.@@@@..@@....@.@.@@@@.@.@...@@.@...@@@@.@@...@@.@@@.@
@@@@@..@.@@@@@@@@.@@@@@@.@@...@.@...@@.@@@@@.@@.@@@.@@@@@@@.@.@@@@@...@@@@@..@@@@@@@@@@@@@@....@@.@@..@@@@@@@.@@@@@.@@.@@.@.@...@...@.@
@@.@...@....@@@@@@.@.@@@..@@@.@@@@@@@.@@.@@@.@@.@.@@@.@@@.@@@..@@.@@@@@.@.@@@@@.@..@@@@@@@@@.@@@@..@.@@@.@@@.@.@.@@@.@@@.@@@@.@.@..@@..
.@..@@.@.@@.@@@@.@.@@..@@@..@@@@@@@@@.@..@@.@.@@.@@@@.@..@@@@@..@.@.@..@..@@.@.@@...@.@@@.@.@@@@@@@@@@@@@@@@.@@@@.@@@.@.@@.@@@.@@@@@@@@
..@@...@.....@@@@...@@.@..@@@.@@@..@@@@.@@@.@.@@@@.@@..@@@@.@@@@@....@@.@@@.@@.@@@@@@@@@@@.@...@@..@@......@@@@.@@.@.@@...@@@@@@.@@..@.
@.@@@@@@...@@..@@.@@.@.@@@@@@.@..@@@@@@.@...@.@@@@.@@@@@@.@@@@..@@@@..@@@@@@.@@@@@..@.@@.@@@@@@@@.@@@.@.@..@@@@@.@@@@@.....@.@.@.@.@@@@
@.@@...@@@@.@@@.@@@@@.@@.@.@@@@..@@..@@@.@@@@@.@..@@@@@@..@@@@..@..@@..@@..@@@@@@@.@@@@@.@.@@@@@@..@@.@@@..@@@..@@..@..@@@@@.@@.@.@.@.@
@@@@@@@.@@@@@@@@.@@@@.@.@@@.@...@@@.@@..@@@@@@@@@.@@@.@..@@.@@@@.@.....@.@@...@.@@.@....@@@.@@..@@@@.@.@@@..@@.@@..@@@@@@@..@.@@@@@.@.@
@.@@..@@@@.@@...@@..@@@@@..@@@..@@....@@@..@.@.@@@.@.@@@.@@.@.@@@@.@.@....@@.@@@@@@..@@.@@@@@@@.@@.@@@@@@..@@...@@..@@..@@.@..@.@@@@..@
.@@@@@...@@@@@@..@@@....@@...@@@@@@.@.@.@.@..@@@@@.@@@@@@@@@@.@@@...@.@.@.@..@....@...@@@@...@.@@@@@.....@@@@@@@@@..@@@@...@.....@@@.@@
@..@.@.@@.@..@@@..@@@.@@.@@....@@@@.@@@@@..@.@..@@@@@@@@@@@.@@.@@@@@@..@@@@..@@@@@@.@..@@@@.@......@@..@@@@@@..@@@.@@@..@.@@..@.@@.@@.@
@@@.@@@@@@@@@@@..@@@@@@@@@.@...@.@....@.@.@@@@.@.@@..@.@@@@@.@@@@.@@@@@.@@@@..@.@..@.@@@..@@...@@..@@@@@@.@@@.@@.@.@@@.@@.@@@@.@@.@@@@.
.@@@.@@@.@@@.@@@@.@@@@.@...@@@@@.@....@.@@..@@@@..@.@@@@@@@@@...@@@@..@@@@@@@@@..@@@.@.@.@@@..@@.@.@@@.@..@@.@.@@@@@.@@.@.@@@@.@@@.@@.@
@@@@@@.@.@@@@@@@@..@..@@@.@@@..@@.@@@.@@@.@.@@.@@@..@@@@.@@@@.@@@@.@@@.@@@@@@..@@..@@.@@@@..@@..@.@..@@.@@@.@@.@.@.@@@@.@@@@.@@@@.@@@@@
@@@.@@@@@@@@.@@@...@@@@@@.@.@@@@@.@@.@@@..@@@@@..@..@@@@.@.@....@@.@@@...@@@.@@@..@@@@..@@@@.@.@@@..@@.@.@@@@@@.@.@@@..@.@@..@.@@@@@@@@
@@@...@@.@@@@@@.@.@@.@@...@@@@..@.@...@@@.@@.@@@.@@.@..@@...@@..@.@@@@@.@@@@.@.@@@@@@@@@.@.@.@.@..@@...@.@@@@@@@@@@@.@..@@@..@@@@@@@.@.
.@@@@@@.@@.@@@.@...@.@@.@@...@.@@@.@..@@@@.@@@@@@@@...@.@@@@.@@@.@@.@..@.@.@@.@@@@@....@.@.@@@@@@.@@@..@@@@.@.@.@.@@@@.@@@.@@.@@..@@@@.
@@@@@@@@@@@@@@@@@..@@..@.@@@.@@@.@@@@@...@@@@.@..@@@@.@@@@@@@@.@.@@.@.@@@@.@.@.@@@@...@@.@.@@@@.@@@@@..@@@@@@@..@@@.@@@@.@@@@@.@@@@@...
@@@@@@@@..@...@.@@@@@@@.@.@@@@.@..@.@@@..@@.@.@@@@..@..@@..@@.@.@@..@@@@..@@@.@@@..@@@..@@...@@@...@.@..@@@@@@...@.@@..@@.@@.@..@@@@@@@
@.@@@@@@......@@@@.@..@@@..@@.@@.@@..@@@@@@@.@.@@@@@@.@.@@@@..@@@.@@.....@..@@.@@.@.@.@.@@.@@.@.@@.@@@@@@.@@@..@.@@@.@@.@@.@.@@@...@..@
@@@@@.@@@@.@.@@..@@@@.@@..@@@.@@@.@@.@.@.@..@.@.@@@@@.@.@@@@.@.@@@@@@@@...@@@@@@@@..@@....@@.@@@.@@@@@@@@@@@@@@@@@..@@.@..@.@@@@@.@.@.@
@@@.@@.@@@@....@@@@.@@@@.@@@@.@@@.@..@@...@@.@@@@.@@@@...@@@.@@..@@@@@.@@@@@@.@@@.@@..@@@@.@@@@@@@@@@..@@@.@.@@@...@@@@@..@.@@@@.@.@...
@@@.@@@.@@.....@@.@@@@@@@.@@.@@@.@.@@.@@...@.@@.@@..@.@...@@.@.@@@...@@@.@..@@@@@.@@@@@.@@@@.@@..@@@...@.@.@@...@@@.@@@@.@@@.@.@.@...@@
@@..@...@.@@@.@@@@@@@@@@....@.@@@@..@.@@@@....@...@@@.@@.@@....@@..@......@@@..@.@@..@@.@@..@@@.@@.@....@..@@@...@@.....@@@@@@@@@.@.@@@
@.@.@.@@@.@.@@@.@@@@@@@@@@@..@@@@@@@@.@@@@@@.@@@..@@@@.@@@@@@@@@.@@@@@@@@.@@.@.@..@.@@.@@@.@.@..@@@.@.@.@.@.@@.@@..@@....@.@..@..@@@@.@
@@@@@@.@.@@@@@@..@@..@..@@@@@@@@@@@.@...@@.@@@@@@@@.@...@....@@....@@@@.@@....@@.@@..@@.@..@.@@@.@.@@@@@@@..@@@.@.@@@@@@......@.@@@.@@@
.@.@@.@@@@..@.@.@.@@@@.@.@@@@@@@.@@@.@@@..@@@.@@.@@.@@@@..@.@@@@@@@@@@.@@@@@@@@@..@@@@.@@@@@@@.@.@@.@@@.@@@@@@@@@.@@@@@@@@..@@@@@.@@.@.
..@@.@.@@@.@.@@@@@@@@.@@@..@@@@..@@.@@.@...@@@..@.@.@.@@..@@@@.@@@@..@@@@@..@..@@@@@@@@.@.@@@..@@.@.@@@.@@@@@...@@@@@@.@....@@@.@@@@@@@
@@.@@.@@@@..@@@@@@..@@..@.@@@@@@.@@@@@.@..@.....@.@.@@@.@@@@@@.@@@..@..@@@....@.@.@.@.@@..@@.@.@..@.@@@@@@@@@.@.@@@@@@.@@@@...@.@....@.
@@@..@..@@.........@@@@.....@@.@@@@@@@.@..@.....@..@...@..@@@....@..@@..@.@.@..@@@@@@.@@@@@..@@@@@...@.@@@@@@@.@@@@@..@@..@@@@.@@...@.@
@@.@@.@@@@@@@@..@@@@.@@..@.@.@@@.@@..@@.@@@@@@@.@.@@@.@@@@@.@..@.@@@@@@.@@@@.@@..@@@@@@@.@@.@@@@@..@@@@@.@@@.@@..@..@.@@@@@.@@.@.@.@@@.
.@@@@.@@@@@.@@@..@@.@@@@@@.@@@@@@.@.@@@@...@@@.@..@..@.@@@@.@@@.@.@.@.@@.@...@@@.@.@@@.@@@@.@@@@.@@@@@@@..@.@@@.@@@.@@.@@@@@@.@@@.@@@..
.@.@@@@@.@@@.@@..@@....@@.@@.@.@@@@@...@.@.@.@@@@.@.@.@.@.@.@@@@@..@@@@.......@.@@.@@..@.@@@@@@@.@.@@@@.@@...@.@@@@@.@@@..@..@....@@@@@
.@.@.@@..@..@..@@@.@@@@@@@@.@@.@@@@@@.@@.@..@.@@.@.@.@.@@@@@.@@@@@@@@@.@...@@.@...@@.@@.@..@@.@@@@@.@.@..@...@.@@...@@@@.@@@.@@@@.@@@@@
@..@@.@@.@.@@.@..@.@.@..@@....@@.@..@..@@@.@.@@@.@.@@@@.@@@@.@@..@@.@.@.@@..@@@@@@@@@@@@@@.@..@@@.@@....@@@@@@@@.@.@@.@@@@@@.@..@@@@@..
..@@@@@@@@@@@@@.@@@.@.@@.@@.@.@@@@@@.@@@.@@@@..@@@@......@...@@@@@.@@@.@..@..@.@.@..@..@..@@.@@@..@@.@@.@@@.@..@@..@@@@.@@@..@@@@..@@@@
@@@@@@@@.@@@.@@@@@..@.@@@@@.@@@@@@@.@..@@@@@@@...@@@@@.@@@@@..@....@..@......@.@@..@@.@@@@..@@.@.@.@..@..@@@@..@@.@..@@..@@@.@.@@@@..@.
@@@.@@@...@@@@@@.@@....@....@..@@@.@@.@.@.@@@@@@.@.@.@@@@...@@@@....@.@.@@.@@@@@@@@@.@@@@@@@@.@.@@.@@@@@@.@@@.@@.@@@@@..@@@.@@@.@...@..
....@@@....@@.@..@@@.@@@@..@..@@@.@@@.@.@.@@.@...@@@@@..@..@...@@.@.@@....@@@.@.@@.@..@..@@@@...@@@@@@@@@@@.@@..@@@@@.@.@.@.@@....@@@.@
@..@@@@@.@@..@@...@@@.@@.@..@@@@@@@@@@@@@.@.@@@@.@@@...@.@@..@@@.@.@@@@@....@@...@@.@.@.@@@.@@.@@..@.@.@..@.@@@.@@@@@.@...@.@@@.@@@@.@@
@@@@@@@@@..@@@@.@@.@@.@..@@@@@@@.@...@.@@@@@@@@.@@@@@@@@.@@..@@.@.@@@.@@@@.@@.@@@@@@..@@.@@@@@@@.@.@..@@@@@@.@..@@@@.@@@..@@...@@@@@@..
@@.@@.@@@@..@@.@.@.@@.@.@@.@.@@..@@@..@@.@..@@@@@...@@@@@@..@@@@@.@@.@@.@.@@@@..@.@.@.@@..@@..@.@@.@.@...@.@..@..@.@.@@@@..@.@.@@.@@...
.@@.@.@.@@.@..@@@@.@..@.@.@..@@@@@.@@@...@@.@@@@.@@..@@.@.@@@@...@@.@@.@..@@...@@.@@@.@..@@.@...@.@@.@@.@.@.@@@@.@.@@@@@@@@.@@.@@@@@@@@
@.@@@@@....@@@@.@@@@@@@@@@@@...@@@@@@@@@..@@@@..@@@@@@.@@@@.@.....@@..@@@.@@@@@@.@.@@...@@@@@@@..@@@@@@@.@@@@@@@@..@@...@@..@...@...@.@
@@@.@@.@@.......@.@@@@@@@.@.@@.@@@@.@..@@..@@@@@@@@@@@..@@@@@...@@..@@@.@@..@@@@.@.@@..@@@@@@@.@@@@@.@@@@@@.@@.@@.@@@@@@@@@@@@@@.@.@.@@
@.@@@@.@@@@.@.@@@..@@.@.@@.@@@...@@@....@@@@@.@@@..@@.@..@......@.@@@...@@@@.@@...@@@@.@..@@@@@.@@@@@@.@@..@@.@.@@@@@.@@@@@@@.@@@@..@@@
...@.@.@.@@@@.@@@@.@@@@..@@..@...@@..@@@@@@@..@@.@.@@.@..@@.@@@.@@@@.@@@.@@@@@.@@.@@@@@.@@@@.@.@@@.@@.@.@..@@@@@@@..@@@@.@@@@@@.@@@@@@@
@.@..@.@.@.@.@..@@.@.@@@@@@@@@.@@@@@@.@.@@...@.@@..@@....@@@.@@@...@..@@@@@@..@@...@@@@@.@@@@@@@@@@@@@.@@.@@@@..@.@.@..@@.@@@@@@@@@@.@@
@.@@@@..@@@@..@.@@.@@.@@@@.@....@.@@@.@@@@@@@@@..@@@.@.@@.@@..@.@@@@.@@...@@..@@@@.@.@@.@...@.....@@@@@@@@@@..@@@.@..@@@@@@@..@@.@@.@@@

10
2025/Day4/test Normal file
View File

@@ -0,0 +1,10 @@
..@@.@@@@.
@@@.@.@.@@
@@@@@.@.@@
@.@@@@..@.
@@.@@@@.@@
.@@@@@@@.@
.@.@.@.@@@
@.@@@.@@@@
.@@@@@@@@.
@.@.@@@.@.

View File

@@ -15,3 +15,10 @@ This is mostly so I can keep notes on my progress, in single markdown format so
2. Clear history so you don't accidentally cp day1 to day2 during testing. (Undo FTW) 2. Clear history so you don't accidentally cp day1 to day2 during testing. (Undo FTW)
3. Put the central check (Serial Valid/Invalid) in a function so it's easy to add self checks in the beginning 3. Put the central check (Serial Valid/Invalid) in a function so it's easy to add self checks in the beginning
## Lessons third day
1. Can't win em all
## Lessons fourth day
1. Need about an hour to do both, but also speeding up