diff options
| author | ame <[email protected]> | 2025-12-04 03:18:09 -0600 |
|---|---|---|
| committer | ame <[email protected]> | 2025-12-04 03:18:09 -0600 |
| commit | 22a92ee2ed33a5f2246f1c6498714ead9b9c65cf (patch) | |
| tree | 493b24f114d9496a5636e96aa0659c74eefeb714 | |
| parent | 430bc7a3f5b1065099716ef54a8130430fccc60a (diff) | |
day 4
| -rw-r--r-- | src/day-4/input.txt | 136 | ||||
| -rw-r--r-- | src/day-4/part-1.zig | 53 | ||||
| -rw-r--r-- | src/day-4/part-2.zig | 59 |
3 files changed, 248 insertions, 0 deletions
diff --git a/src/day-4/input.txt b/src/day-4/input.txt new file mode 100644 index 0000000..3b3f24a --- /dev/null +++ b/src/day-4/input.txt @@ -0,0 +1,136 @@ +.@.@@@@@@@@@@@@.@.@..@@.@@@.@@.@@@@@@@.@.@@@@...@..@@.@@@.@@@@@@@@@...@@..@...@@...@..@.@.@.@.@.@@@@@.@..@@.@.@.@@@@.@@.@@@@..@@@@.@..@@ +@@@@@.@@@.@@@.@@@@..@@@..@@@.@@@...@@@@@..@.@@@@@..@.@@.@@@.@.@.@@.@@.@@@@@.....@@..@@.@.@@.@@@@@@@@@@@@@@@.@@@@.@..@@@.@.@@@@@@.@@.@..@ +@.@..@@@@@.@@@.@.@@.@@@@@@@..@@@@@@@..@@@@@@@.@@@@.@@.@@@.@.@@@.@@@.@@.@.@.@@.@@@.@.@@@.@..@@..@..@@..@@@@@@.@@...@@.....@@@@@@@..@@..@@ +@.@@.@..@..@@@..@@@.@.@@.@.@@@@@.@@......@@@.@@@.@@@@@@.@.@.@@@@..@.@.@..@.@..@.@@.@...@@..@@@@@.@...@@@..@.@.@@@@@@@.@@@@@.@@@..@@@@.@. +.@.@..@.@@.@@@@.@@.@.@.@@@@@@.@@@@.....@@..@@.@.@@@@@@@@.@.@@@...@.@@...@@@@@@@@.@@...@@.@@@@@.@...@..@.@..@.@@@@@@@@@@@@@@@@@@@@.@@.@.. +@@@@@.@@@@@.@@.@@@@@@@@.@@@.@..@@.@.@@@@@.@@@@.@..@.@@.@@@.@@.@@@@@.@.@@@.@@@..@@.@@@..@@@.@@@..@@..@@.@..@@@@.@.@@@.@.@@@@@.@@@@@@.@@.. +@.@@@..@@@.@@@@@@@.@@@.@.@@@@@...@.@@@@@@@.@@.@.@@..@@@@.@.@.@.@@@@@@@@.@@@@@@@@.@.@@@.@@@@.@@@@.@@.@@@..@@@@.@@@@.@@@@@@..@@.@@.@@@@@.@ +@@@.@@.@@@.@...@@@@...@.@@@..@@@@@@..@.@@@@@@.@..@@.@@@@@@@@@.@.....@@@@@@@@@@.@@..@@@.@@@.@.@@@@.@@..@@.@@.@@@@@..@@@@.@..@@.@.@...@@.. +@@@@@.@.@..@@@@.@@@@@.@@.@.@..@@..@@@@@@.@@@@@@..@.@@@@@@..@@@.@@@@@@.@.@.@@@.@@..@@@@.@.@@@@.@@@@@@@.@@@@@@@@.@.@@@@...@@@.@@@@@@@...@@ +.@.@@@..@@@.@@@.@@@@@..@.@.@..@..@@@....@@.@@.@@@.@.@@..@.@@@.@@@.@..@.@..@@@@@@@..@.@.@@@@@.@@@@.@.....@..@@@@@@@.@@.@@@@@.@..@@@@@@.@@ +.@@..@@@.@@....@@@@.@@@@@.@@@@.@...@.@...@@@@@.@@@@@@.@@@@..@@.@@...@@@@@@@..@@@..@.@.@.@.@..@.@.@@..@@@@@@.@@@@@@.@.@@.@@@@.@.@@...@.@@ +.@@.@@.@@@@@@.@@.@.@.@@@@.@@.@@.@@@@@@.@@@@@@@@@@.@@.@@.@@.@...@@@..@@@.@@.@@@@@.....@@@..@@.@@@@.@@.@.@@@@@@@@@@..@@..@.@.@.@@..@.@@@@@ +@@@@@@@@@.@@@.@.@@@@@@@.@@@@@@@@@.@.@@@..@@@@.@..@@@....@...@..@@....@@@@@@@@.@@.@@..@@@@@@.@@@@.@@@@@@@@.@@@@...@.@.@@@@@.@@@..@@@@@@@@ +@.@@@@@..@@.@@@@@.@..@@@@.@.@@@@..@.@..@@@@@@@@@@.@..@@.@..@.@.@..@.@@@@@@@@@.@@@.@@@@@@@@@@.@@@@@@..@@@...@@@@@@@.@@.@@@.@.@...@@....@@ +@@@@@.@@..@@..@.@@@..@.@.@@@@@@..@@@@@@@@..@..@@@@@@@@@...@@@@@@@@@@@@..@@..@.@.@.@.@@.@@.@.@@..@@@@@@@.@@@@.@@@@@@@@..@@@@@.@.@@..@@@.. +..@.@@@.@@@.@@.@@@@@@..@.@@@@@@.@.@@@@@@@@@@@@@.@...@.@...@@@@.@.@@@@@@@@..@@@@.@..@.@@.@@@.@@@@@@.@@@.@@@@@.@@@@.@@@@.@.@.@@..@@@@@.@@@ +@@@.@@@@.@@@..@.@@.@@@@.@.@@@@@@.@@@..@@@@..@@.@.@@@@.@@@@.@.@@@..@@@@@@@@.@...@@@@@@@@@@@@@@@@@@@.@.@@.@@@.@.@@..@..@.@....@.@@.@..@..@ +@.@@@@..@.@@.@@@@.@....@@@.@@.@.@@@.@.@@..@@.@@@.@@.@@@@@@@..@.@@@@@@@@@@..@@@@.@.@.@@@@.@@@@@.@@@...@@@@....@.@.@.@@@@@@@@@.@@@.@@.@@.@ +.@@@..@@@....@@.@.@@@@@.@@.@@@@@@...@@.@@@@@@@@.@.@@@@@.@@.@.@@@@.@@.@@@@.@@.@@@@@...@.@@.@@@@@@@@.@.@.@@.@@..@.@.@@.@@.@.@@@@@.@.@.@@.@ +@.@.@.@@@.@@@.....@.@@@@.@@@@.@@@@@...@.@@@.@@@@@@@@@.@@.@.@@@.@@@@.@@@@@@@..@.@@.@@@...@.@@@.@@@@.@@@@@@..@@@@@...@..@.@@@.@@.@@@@@@@@@ +.@@.@.@@@.@@.@@@@@.@.@.@@.@@@@.@..@@@@..@@@@.@@@@.@@@@.@@..@@....@@@@@@..@@@.@@@@.@.@@..@.@@@@..@@@@@@@@@@.@@@.@@.@@@@..@@@.@@@.@@@@@..@ +@@@@..@@@.@@.@@@@.@@@..@.@.@.@@@@@.@..@@@@.@@..@@@@.@@@@@@@@@@@@@.@..@@@@.@@@@@@@..@@.@@@@@@@.@@.@@@@@.@....@.@..@@@@@.@..@@...@.@@@.@@. +.@..@@.@@.@@@...@@@.....@@@...@@@@@@@....@.@@@.@@@..@@@@@@.@@@...@@@@@@..@@.@@@.@.@.@.@@@...@..@@@@.@@@.@..@@@@.@.@@@.@@@@@..@.@@@@..@@. +@@@@.@@@@..@@.@@..@@@.@.@@.@.@.@@@.@@.@@....@.@@...@@...@@@@@.@.@.@@@@.@@@@@@@.@.@.@@.@..@@@@.@..@..@@.@.@..@@@...@.@@@@@@@@@@@@@@@@.@@@ +@@@@@..@.@@..@@@.@@.@@@@@.@.@@@@@.@..@@.@@@.@...@@@@@@@@.@@.@@..@@.@@@@@@@@.@..@@..@@..@.@@.@@...@.@.@@@@@@@@@@..@@@@@@@.@@@@.@@@@.@@@@. +@@@@@.@@@@@@.@@@@@..@@.@..@@@@@@.@.@@.@@@@@.@@@.@@.@@.@@..@...@@.@.@@@@@.@@@.@@@.@@.@@@@.@@@.@@@...@.@...@..@@@@@..@.@@@@.@@@...@@...@@. +@..@.@@.@..@@....@.@@@.@@@@@@@@.@@@..@.@@@@@@.@...@@.@@@..@......@.@@.@@....@.@@..@@@@@@@@@@@@@@..@@.@@.@@.@@@..@@@@@@@@..@.@@@@@.@@.@@@ +.@@.@@@..@@@.@@@@@..@.@.@@.@@@@@@@@@.@@@.@@@@@..@@..@@@@.@..@...@@.@@..@...@@.@@@@@@.@..@@@.@.@@@@.@.@@.@.@@@@.@@@@@@@@.@.@@.@@@@@.@@... +@@@..@.@@....@@..@...@@.@..@@.@.@@..@@@@....@.@@@@.@@@@@@.@@@@.@@@.@@@@@@@@@@@.@..@@@@@@@@@@.@@@.@@@@@@@..@...@.@@@.@@.@.@@@....@@@.@@@@ +.@@.@@@@@.@@.@@.@@..@@@@..@.@@...@..@@@@@.@.@@.@..@.@@@@@@.@@.@@...@.@@@@@@@@@.@.@.@...@.@.@@@...@.@@@@@@@@..@@...@.@@@@@@...@@.@@@@...@ +@@@@@...@...@@@@..@@@@@.@@@@..@@@@@@@.@.@@@@@@.@@@@@@@@@@@@.@@@.@@@@.@@@.@.@@@@@.@..@@...@...@.@@..@@@.@.@@..@..@@@@@@...@@@@@@@@@@.@.@. +@.@@.@@@@@@@@@..@@@@@.@.@@@@.@....@@@@.@@@@..@..@@@.@@@@@@@..@@@@@@@..@.@...@@....@@@@@@@@@.@@@.@@@..@@@@@...@.@@@..@@.@@.@.@@@.@.@@.@@@ +@@.@@@@@@@@@@@@@@@.@@@@@@..@..@.@@...@.@.@@@@@@@@@@@.@.@@@@@@.@.@@@@@@.@@@@.@@@...@@@@@@@.@@@..@@@@@@@@@@.@@@@@..@@.@@..@...@.@@@@@.@@@@ +..@...@.@@@@@@..@@@.@@@@@@@@@.@@.@@@.@.@@.@@@.@.@@@.@.@@@@@@..@@.@.@@....@@@...@@@@@@@@@@@@@@@@@@@.@@@@@@.@@.@@@@@@@...@@@@@@@@@@.@..@@@ +@@@.@@.@@.@.@@.@@.@@@@...@@@@@.@...@@.@.@.@.@@@.@.@.@@@@@@..@@..@...@.@@@.@.@@@@.@@@...@@@@@@.@@@@@@@@@.@@..@.@..@..@@.@.@@@@@@...@@..@@ +@.@@.@@@@.@@@@@@@@@@.@@@.@@@.@@@@@@@@@@.@@@..@.@@......@.@@@@@@@@@@@@@....@@@@.@..@.@...@@@@@@.@..@@..@@@.@.@@@.@.@@.@..@..@@@.@..@@..@@ +@@@@@@.@.@@@...@@.@@@@...@@@@@@..@@@@.@.@.@..@@@@.@..@@@@.@.@...@@@@@@@@@..@@@.@.@.@@@..@@@@@@@..@@@@@@@.@.@@@..@@.@@@..@@.@@@..@@.@@.@@ +@@..@@@@.@.@.@@@@.@@.@@...@@@.@@@@.@@.@@@@@.@@@@.@.@.@@.@@@@@..@..@@@.@..@.@..@@.@.@@@@@@.@.@@@@@@@@.@@@@@@@@@.@@.@@.@..@....@@@@@@@@.@. +.@@.@.@@..@.@.@@@@@.@@@@@@.@@@.@@.@@@@.@.@@@@@@@@@@.@.@@@@@.@..@.@@.@.@....@.@.@@.@@.@..@@@@@@@@@@@@@...@@@@.@...@@@@.@@@@..@@..@.@.@@.@ +@.@@@@@@@@@@@@@@.@.@@@.@.@.@@.@..@@@...@@.@@.@.@@.@@.@@@@@@@.@.@..@@...@@@@.@.@.@@.@...@@@@@..@@@@@@@@@..@@.@....@@@@@@@@.@@...@@@@@.@@. +..@@@.@@@@@@.@.@@@@@@@@@@@@@.@.@.@@@.@...@.@@@...@@.@@@..@@...@@..@.@@.@@@@@@@.@.@@@@@@.@.@@.@@.@@@@@@...@@@.@@@.@.@.@@.@..@.@@..@@@@@@@ +...@.@.@.@.@@..@@.@@.@.@@.@..@@@.@.@..@@..@@@..@@@.@@.@...@@.@@.@@@@....@.@.@@.@@.@.@.@.@@.@@.@@@....@@@@@.@@@.@.@.@@@.@.@..@@..@@@@.@@@ +@@@@@@@@@@@@@.@.@@@.@..@@@.@.@.@.@@..@..@@@@@@@@@..@.@..@.@@..@.@@@@.@@@@@@@@@@@@..@..@@@.@..@@..@..@@@@.@@@@@.@@..@.@@@@.....@@..@..@@@ +@@.@..@@.@..@@.@@.@..@@...@@.@.@@...@.@..@@@@@@@@..@@@.@@@@@@@@.@@...@@..@@@@@@@@@.@@....@@...@.@@.@@.@.@@@@@.@@@@.@@@..@...@.@.@@.@@@@@ +@@.@@@@@@..@.@@@@@.@@@@.@@..@@@@@@@.@@@.@.@.@@@@@@@@.@.@@@@..@..@.@.@@@...@@@@@.@@.@.@@..@.@.@.@@.@@.@@....@@..@@.@.@@@@@@....@.....@@.. +@@@@@.@@.@.@@@.@@@..@@@@@@@@@@@.@.@..@@@@@@..@.@@@@@@@.@@@@@.@@@@@@@@@@@@.@.@@@...@@...@.@.@@@.@@@@.@.@.....@@@@@@..@@@@@@@@..@..@@.@@@@ +@.@.@@@@@.@@..@@@@@@.@.@@.@@@@@.@.@@.@@@.@@.@.@....@@@.@@.@@@.@@.@@@@@.@.@@@.@...@@@.@.@@@@@@@.@...@.....@..@@@.@@...@@.@.@@.@.@.@.@.@@@ +@@@@.@@@@.@.@.@.@@@@@@@@@@.@@@@@@@@@@@.@.@@.@.@@@...@@@..@@.@..@.@@@@..@..@.@@..@.@@@@@.@@@@@.@.@@...@@@@@@@.@@.@@@@@.@.@@@.@...@...@@.@ +@@@.@@@.@@@@..@@...@@.@@@@@@@.@.@.@.@.@.@..@..@@..@@@.@@@@@..@.@@.@@...@.@@..@@@.@@....@@.@@..@@@@.@@.@@@@..@@..@@@@..@@@.@.@@@@.@@@@@.@ +@@..@@.@.@@@@.@@@@@@@@.@@@@@.@@@.@.@.@.@.@@@@..@@@@.@@@..@..@..@@@@@@@@@@.@.@.@@@@..@@@@@..@@@@..@..@@@@@@@@...@@.@.@@@@@@@@@@@...@@@.@. +@@.@@@@@.@@@.@@.@.@...@@@.@.....@@@@.@..@@..@..@@@@@.@@..@@@@@@@@@@@.@@.@@.@@..@.@@@@@.@@@@@@@@..@@@....@@@.@@@.@.@....@@.@@.@@..@.@@@.. +@@@.@@@.@@.@.@@@@@@@..@@@..@@..@@@..@@@.@.@@.@@@@.@.@@@.@@....@@@.@@.@.@@.@..@....@.@@@@@@@@@.@...@@.@@.@@@@@.@....@@.@..@.@.@@@@@.@.@@. +.@..@@@@.@@@@.@@@@.@.@..@.@....@@@.@@@.@@.@.@..@@@.@@.@.@@.@@@@..@@@@@@@@@.@@@@@@@..@.@@@@@@..@@@@@.@.@@@@@@.@@@.@@@@@@@@@..@@.@@@@@@..@ +.@@@.@@...@@@@@..@@..@@@@@@@@@.@@@.@.@@.@@@.....@@.@.@@@@@...@@.@..@@..@@.@@...@@.@...@...@@.....@@@.@..@@@..@@@@@@..@@.@@..@@@.@@@.@@@@ +@@@@@@@@@@@@@@@@..@...@..@@.@@@@@..@.@@@@@.@@@@@..@.@@@@@@@.@@@@@...@@@@@@.@...@@@.@@@.@.@@@@.@.@@.@.@..@@.@@@...@@@@@@.@...@.@@@@.@@@@@ +.@.@@@@@@.@..@@@@@@@@.@@..@@@@@@...@..@@@@..@@@@.@@.@@@@.@.@@@@.@@@..@@@@@.@@@@@@@..@.@@@.@@@@.@.@@@.@@@.@@@@.@@....@.@..@.@@...@.@..@.@ +.@.@.@@.@@@..@@.@@@@@@@@@@@@@@...@@.@@@@@@@..@..@.@@@@@@.....@@.@@.@.@@.@@@@@..@@@@@.@@@..@@.@@.@@@.@.@@@@..@@@.@@@.@@@@@@@.@@.@.@@@@.@. +@.@@@..@@.@.@.@.@@.@..@.@@@.@.@@.@@@@@@@@@.@@@@@@@..@@..@@.@@..@.@@@.@.@@.@.@@@..@..@@@@.@...@..@@@.@@@@.@@@@@.@@.@.@@@@.@@@@@@@..@@@@.. +@@@.@@@.@@.@@@@@@@......@.....@.@..@..@@@..@.@@@@..@@.@...@.@@.@@@..@@@@@.@@.@@@.@@@..@.@@..@.@@@@@.@@@@@.@@@.@@@@....@@@@@@.@@.@@@....@ +..@@@@@.@@@@.@@..@@@@@@.@.@@.@@@@.......@..@..@.@@@.@@@@@@@.@@@.@@@.@.@..@@@@@.@@@@@.@@.@..@@@@@...@.@..@@@@@.@@@@.@...@@@@@@.@.@@.@@@@@ +..@@@@.@.@@@@....@.@@@..@@....@@.@@@.@@@@@.@@@@@@@.@@.@@..@@..@..@@..@@@.@@@@.@.@.@.@@@@.@@.@.@@@..@.@..@@@@@...@.@@..@@@@@..@@@@@..@..@ +.@@.@@.@@@@@..@@@@@@@@.@@@@@@@@@.@@.@.@..@@@@..@@..@@.@@...@.@@@@@@@.@@@.@@@..@.@@@.@@@.@@@@@@@.@@.@.@@.@.@@@.@.@.@@@.@@.@...@@@@...@@@@ +@@.@@@.@.@@@@@@@...@.@..@@@.@@@@.@.@.@@@@...@@@@@.....@@...@@@@@..@.@@..@@@.@@@.@....@@...@@@.@.@@@@@@@..@@@.@.@@@.@.@..@.@.@@@@....@@.. +.@@@@.@@..@.@.@@@@.@@.@@.@@@.@@@.@@..@@@@.@@.@...@@@@@@@@.@@@@....@@@@...@@...@@@...@.@.@@.@..@@@@.@@@.@@@.@@@.@@@@@@@@@@.@@..@.@@@.@@@. +@.@.@@@.@.@.@@@@@@@@..@@@.@.@@@.@@@.@@.@@@..@@@@..@.@..@@@@@.@....@@@@@.@@@@@@.@@@@@.@.@@@@@@@.@@...@.@@@@@@@@.@@@@@.@@..@.@...@.@..@.@@ +@..@..@@@@.@@@@@@@.@@@@@@.@@.@@..@.@@@.@@@@@.@@@@@@@.@@@.@@@.@@.@..@@@@@.@...@.@..@.@@.@...@@@.@@.@@.@@@@@@.@@@@@@@@@..@@.@.@@.@@.@..@@@ +@.@.@@....@@@.@@@.@.@@...@.@.....@@@@.@.@@.@..@@@.@@@.@@@...@..@@@@.@@@@.@@@@..@@@..@@@@..@@.@@@@.@@@@@@@@@.@@...@..@.@..@@.@@...@@@.@@. +.@@@.@.@@@@@@@..@.@@..@.@..@@@@..@@.@@@.@@.@.@...@.@@@@@..@@.@@.@@@@@..@@...@@@@@@.@@@@@.@....@.@..@@@.@@.@..@.@@@@.@.@@@..@@@@.@@....@@ +@@@@@.@.@@@@@@@@@@..@@@@.@@.@@.@.@@@@@@@@@@@@..@@@@@..@@.@..@@@@@.@@...@@@@@@@@@@@@@.@@@@.@@.@@@@@.@@..@@...@@@@.@@@@@@@@@.@.@@@.@@...@@ +.@..@@@.@.@@@@.@@@..@@.@....@@@@.@..@.@@..@@@@@@@@.@@..@..@@@@@@@@.@@.@@@.@.@@.@.@.@...@.@.@@.@..@.@@.@.@@@@@@....@@.@@.@@@@@.@@@@@.@@@@ +...@.@@@@..@@...@..@@.@@@@@@@@..@@..@@@.@@...@@.@.@.@@@@.@@@.@...@.@@.@@@..@@@@@@@@.@@@@@@..@.@@..@@..@@...@@@......@.@@@.@@.@@@@@@..@@. +@@@@@..@.@.@.@@.@@@.@.@@.@@@@@.@@@@@@@@@@@...@@@@.@@@@@.@@@@@@@..@@@@.@@.@.@..@@..@@..@@@.@@.@@@.@.@@@.@@.@.@@@@.@@@.@@.@@@.@.@..@.@.@@@ +.@@@@.@@...@@@@@@@@@..@@@.@..@.@@@@@@@@@.@@.@.@@@.@@.@.@.@@@@@@@.@@@@@@@@@@@....@@@@.@.@.@@@@..@@@@@@.@..@.@@@@.@@@@@@.@@@....@.@@.@...@ +@@@@.@...@@@@.@..@.@@.@@.@@@@@@.@@.@@.@@@@@@@@@@@..@..@@.@.@.@@@@.@@@@..@.@@.@@@@...@@@@..@...@.@@@@@@..@.@@.@...@@..@@@@.@.@@@@@@@@@.@. +.@.@@@..@@@..@@.@.@@@@@@@@@.@@.@@@@@@.@@...@.@@@@@@@@@@.@@@@.@.@@..@@@@@.@@.@@@..@@@@@@@@.@@..@..@@@@@@..@.@@.@..@.@.@.@..@@@..@.@@@@.@@ +@@......@@@.@@@.@@@.@.@@@@@@.@.@@@@@@@.@@@@@.@.@@@@@.@@.@@@@@.@.@.@@@@@@@@.@@@@@@@.@......@@@.@@@@.@.@@@@@@@.@@@@.@@.@@@.@@.@@@@@@@@@@@@ +@@.@@..@....@@.@.@@@@@@@@@@@@..@@.@..@.@@.@@.@.@@.@.@@@.@@..@..@.@@@..@@@.@.@@@..@...@@@@...@@@@@@....@.....@@@@@.@.@@@@.@@@@@.@@@@..@.@ +...@..@.@@@.@.@@@...@.@@@@.@.@@.@@.......@@@..@@@@.@.@@@@..@.@@@.@@@@@@@.@.@@@.@@@@.@@@@@@.@..@@@..@..@..@..@@@@@.@@@...@...@@@.@.@.@..@ +@@@..@@@.@.@@@..@@...@@.@.@.@@@@@@@.@@@@@..@@@@@@@.@@.@@@.@@@@@@.@.@@@@..@.@..@@@@@@@@@..@.@.@..@@@@@.@@@@@@.@@@@@..@.@@..@.@@@@@@@@@@.@ +...@@..@.@@@@@@@.@...@@.@@@@@@@@@@.@.@.@@@@.@@@@@@@.@..@.@@@@...@@@@@.@@@@...@@@@@@@.@...@@@@..@@..@@@..@@.@@@@...@@.@@@@...@@@.@@.@@@@. +.@@.@.@.....@@@@@@@@...@@.@@@...@@@@@.@@@@.@@@..@@@.@.@@@@.@.@@@@@...@@.@@@.@.@@@@..@@@@@@.@.@.@@@.@@@..@..@.@.@@@.@.@..@@@.....@..@..@. +..@.@@@@.@...@.@@@.@@...@.@@@.@..@....@@@@@@..@@@@@.@@.@@@@...@@@..@@@...@.@@@..@@@@@..@@.@@..@...@@..@@@@.@@.@@@.@.@@@@.@@@@@..@@@@@@@. +@..@.@@....@..@@@.@@.@@@..@@@.@@@@@.@@@@..@@.@.@@.@@@@@@@@@.@@@..@@@@@.@@@.@.@@@.@....@@@@@@@@@...@@@@@@@@@@@@.@@@.@@.@@@@....@@@.@@.... +@@.@@..@@..@@..@.@@@@@...@...@@..@@@@@.@@.@@@@....@@@.@@@..@@.@@@@@@.@@..@..@.@@.@@@@@..@.@@@.@@.@@.@@.@@.@@@@@@@..@@@@@@.@@.@@@@@..@.@. +.@@.@@....@@..@..@@@.@@.@.@.@..@@@@.@@@.@@@@.@@@..@@@...@..@..@..@@@@@@..@@.@@@@@@@@@@.@@@@..@@.@@@..@.@@@@....@@@@@@.@..@.@@.....@.@@@@ +@@@.@@...@@..@@@@.@@@@@@@..@...@@@@.@@@.@.@@@.@@@@@@@@..@.@@.@@@..@..@@@@..@@.@@@@@.@@.@@.@@@@@@@@@@..@.@.@.@@@.@.@@..@.@.@@@@@.@@.@@.@@ +@@@.@.@@@@@@@.@@@@.@@@@@@@@.@@@@@.@@@@.@@@.@.@@@.@@@@@@@@@@.@@.@...@@@@..@@@@.@..@@@@@..@@.@@@.@@...@@..@.@.@@@@@@@..@@.@@.@..@..@@@@.@@ +.@@.@@.@@@.@.@@@@@.@@.@@@.@.....@@@@@@....@@@@@.@@.@.@@@@@.@@..@..@..@......@.@@@.@@@@..@@..@@@.@...@@.@@@.@@@@@@@.@.@@@.@@@.@@@@@.@@@@. +@@@@..@..@@@.@@.@.@@@@....@...@@.@@.@..@.@@.@@@..@.@.@@@..@.@..@@.......@@@.....@@@@.@.@@@.@.@@..@.@@.@.@..@.@...@.@.@.@@@@@@@@@@@@@.... +@@@@@@.@@@@.@....@@.@@@@@@@@@@.@@.@@@..@...@.@@@.@@...@@..@@@@@.@@.@.@@@@@@@@@@.@...@.@@...@..@.@...@.@@@@@@@@@@@..@@...@@@@..@.@@....@@ +@@@.@@.@@@@..@@..@.@@.@.@@.@..@.@@@@@..@.@.@@@.@.@..@@@@@@@@@@@..@.@.@.@@.@@@@@@@...@@@.@@.@..@@.@@@@@@@.@@@@@@@@@@@@@@.@@@@.@@@.@.@@@.. +@@@.@@@@@.@@@@@@@@@@@@@@..@@.@@.@@.@.@...@@@@@..@@.@@..@..@.@@@..@..@.@@.@@@.@@@@.@@@..@@.@@@@.@.@.@@.@.@@.@@@@@@.@@@@@.@@..@@@@@@@.@.@@ +..@@...@@@@@@@.@.@@.@.@@@@@@@.@.@@@@@@@@.@@.@@@@@@@@@.@@@@..@@@@@....@.@@@.@@@@.@@@@@.@...@.@@@@@@@@@.@.@.@.@@@....@@@@.@@.@...@@@@@.@.@ +.@...@..@..@@.@@@@@.@...@.@@@.@@@@@.@@@@...@.@.@@@@.@@..@@@@.@@@@.@.@.@..@@.@@.@@........@@.....@.@@@@.@@...@..@@@@@..@@@.@.@@@.@@@.@@@. +..@@@@@@...@@@@@.@@.@@@..@@@@@@@..@@@@.@@@@..@.@@@@@@.@@@@.@@..@@@@@@@.@@.@.@.@@@@.@...@@.@.@@@@.@@@@.@..@@.@@@.@@@@.@.@.@@@@@..@.@....@ +@@.@......@@@@@@@@.@.@@@@@@..@..@@.@.@@....@@.@@@@@..@.@@....@.@@@@@.@..@@@.@@..@@@@@@.@@@@.@.@@@@.@.@.@.@@@@.@@@@@.@@.@@@@..@@@.@@@@..@ +.@@@@....@....@@@...@@@.@@@@.@@.@@.@..@.@.@.@.@@@.@@...@.@@.@@.@..@@..@.@.@@....@..@@.@@@@@@.@@@..@@...@@.@@@.@@...@@...@@.@@@@@.@@.@@.. +@@.@.@@@@@..@...@@@@.@.@@@.@@@@@@@@@@@.@@.@.@.@@.@@.@@@@.@.@.@.@@@...@@@@@.@@..@@@..@@@@@@@@@.@@@@.....@@@@.@@.@@..@..@..@@.@.@@@@@...@. +@.@.@@@@...@@@@.....@@@.@.@@@..@@..@.@@@@.@@.@@@@.@@..@@.@@@@@@@..@.@..@@@.@..@@@@@.@.@.@..@@.@@@.@@@@@....@@@@@.@@@@..@@.@@@@...@..@@.@ +@...@@...@@@@.@@@@@.@..@@@...@.@@@..@@...@.@.@@@@@..@..@.@@..@@.@@.@@@.@@.@@@@@.@@@@@..@@@@@@@.@.@@@@.@@@@..@@.@@@.@@@@@@.@@@@@@.@@@@.@@ +.@@.....@.@@.@@..@@@@@.@..@@@..@.@@@@@@...@.@@@...@.@@@@@@..@@....@..@.@@.@@.@@@.@@.@..@.@@.@@.@@@@@@@@@@.@@..@@@@@@...@.@@@.@@.@@.@..@@ +.@@.@.@.@@@@@.@@@@@@.@.@@.@@.@@.@@@@.@@@@@@@@.@@@@.@@.@....@.@@@@@@.@@.@.@@@.@@@..@.@@.@@@@.@@@@.@.....@.@.@@.@@.@@....@@.@..@.@@.@@@.@@ +@.@@.@@..@@@@.@@@@.@@@@..@@@.@@@@@@.@@@@@.@@@..@@@..@@.@..@@@.@@@..@@@@@.@@..@@@@...@@@@@@@@@.@.@.@..@@@.@.@@.@.@@@..@@@@..@@.@@@@@.@@@@ +.@@..@.@@..@..@@@@@.@@.@@@.@.@.@@.@@@.@@@.@.@.@@.@.@.@@@.@.....@@.......@.@@@@@.@@@@@..@@.@@..@@@@@.@@.@.@@@@.@@.@@@@@@@@.@.@@.@.@...@@. +@@@.@.@@.@@@@@@.@@@.@.@@@..@@@@@.@@@@.@@.@@.@@.@.@@@.@@@@.@@@@..@@@@@.@@@..@@@.@@@.@.@.@@@@..@@@@.....@.@.@.@@@.@.@..@@.@@@@@.@@@@@@.@@@ +....@@@@..@.@@.@@.@@@.@@@.@@..@@@.....@..@...@@@@@.@....@@..@.@@@@@@@@@..@@@@@@.@@@.@@@@@@@@@.@.@@..@@@@@@@@@@@.@@@...@@..@@@@@@@@..@@@@ +..@@@@@@@.@@@@.@....@...@@@@@.@.@@..@.@@@@@.@@@@..@.@@.@.@@@@@@@.@@.@.@@@....@@..@@@@@@@@.@@.@.@@.@@.@@.@@.@@@..@@@@@@@@@@@.@.@...@@@@@@ +@@@@@.@.@@@@@..@@@@@@@.@@@@@@.@@...@.@..@@.@@@@.@@@@@@@@@@..@...@@.@@@@@@..@@@..@@@.@@@.@@@@@@@@..@@.@@@@..@@.@.@@@...@@@@..@@.@@..@@@@@ +...@@...@@@@@..@.@.@..@@.@@.@@.@@@..@@@@@.....@@@@@@@@@@.@..@.@@@@..@@@.@@.@..@@....@.@@@@@@@@@@@@.@@.@@.@@@@@..@@@@@@@@@@@@@..@.@@@@@@@ +..@@@..@@@@@@.@@@@@@@.@@@@@@@.@@@@@@...@.@@.@.@.@..@.@@@..@@@@@@.@@@@@@..@@.@@@....@@.@.@.@.@@@@@@@@@.@@@.@.@@@.@@@@.@....@@...@@@@...@@ +.@@.@.@..@@@..@@@@@.@@@@@@@@@.@.@..@@@@@@@@@@.@@@@@@@@.@@..@@.@..@@.@..@@.@@...@@@@.@@..@.@.@@@.@@@..@.@@..@@.@@@@...@@.@@@@@@@@.@.....@ +@.@.@@@@@.@.@@@@@@..@@@@@@...@@@@@@@@@..@@@.......@.@@@@@@@.@@@@@@@@@@@@@@@.@.@@@@@@@@@@@..@@..@@@@@@@@.@@..@@@@@.@.@@@@@@@@@@@@@@@@@@@. +@@.@.@@..@@@@.@@@@.@.@@@@...@@@..@@@.@@@@.@..@@...@@.@@.@@.@.@..@.@@@@..@@@@@@@@@@@@.@@@@@@@..@@@@@@@@@@.@.@.@@.@@@@@.@.@..@@@..@@.@@@.. +..@@@...@@@@@@.@.@@.@@@@@...@.@@@.@@....@@@@@@@@@@.@@.@@@.@@..@@@@@.@..@@@@@.@@@@@.@.@.@@...@.@@.@.@@.@@@@@.@@@@..@@@@@@..@@..@@@@@@@@@. +@@..@@.@@@@@@@@@@@.@.@@@@@.@..@@@.@@@@@@@@@@..@@@@.@..@@@@@.@.@@@.@.@....@@.@..@..@@@@@@@@@@.@@..@@@..@.@@.@@.@.@@@@@...@@@.@@@.@@@.@@@@ +@@.@@.@.@@.@@@@@@@@..@@@@@@@.@@@..@@.@..@@.@..@@@@@@.@@@@@@.@@@..@..@@@@..@@.@@@@@@.@@.@@.@@@.@@.@@@.@...@.@@.@.@@.@@....@@@@@...@@..@.@ +@...@@@@..@..@@.@@@.@@@@@@@@@..@.@@...@@@@@@@....@@.@...@@.@@.@@.@@.@@@@@@@.@@@..@.@@@@@.@@..@@@@@@@.@@@.@@.@@@.@@@..@...@@...@@@@@@.@.. +@..@..@.@@@@@..@@@@.@@@@@@.@@..@@..@@.@..@@.@@.@@@.@.@.@@..@@...@@.@.@@.@..@@@...@@.@@@.@@@@.@@.@@@...@@@.@@@.@@@.@@@.@@@@@@.@@@..@@@@@@ +.@@.@@@@@@@@@@@.@.@@@@@.@.@.@@@@.@@.@@..@@@.@@@@..@@...@@..@@@@@@.@@.@@..@@@@@.@...@.@@@@@@@.@@...@@@.@@...@@@@...@@.@@.@.@..@.@@@.@@@@@ +@.@..@@.@@..@@@@@@@@@@@@..@..@@@@@@@@.@...@..@@@..@@@@.@@@@@..@@@@@@.@@@@@@@@@.@@@.@@@.@@......@@@..@@@.@..@.@@.@.@@.@....@..@@@.@@@.@.@ +..@@@.@@@@.@@@@.@@@@@@@@@@@@@@@@..@..@@@..@@@..@@@@@.@@.@...@@.@@@@..@@..@@.@.@.@@..@.@@@@@@.@.@.@..@@@.@@.@@.@..@@@@@.@..@@@@@@@@@.@.@@ +@.@@.@@@@.@@@@@@@@@@.@.@@@@@@@@@.@.@@@@...@....@@@@@@@@.@@..@@@..@@.@@@@@@@@@@@.@@@@..@@.@.@@..@@@.@@@@@@@..@...@@..@@@@.@@@@@.@.@@...@. +.@.@@@@..@@@@@.@..@@.@@.@@@@..@@..@.@@@..@.@.@@@@@.@..@@@..@.@@@.@@@@..@.@.@@@@@@...@..@@@...@.@..@@@@......@@@@.@@@@@@.@@@..@..@@@@@@.@ +.@..@.@.@..@.@@@.@.@@.@.@@.@.@@.@@@@@.@@@@@@@...@@@@@.@.@.@@.@@.@.@@.@@.@..@@.....@@@@@.@.@...@.@.@@@.@@@.@..@@@@.@.@.@@@@@..@@@.@@@.@@@ +@@..@@.@.@..@.@@@@.@@@@.@@@@@@..@@@@.@.@@..@@@@..@@.@@@@@@@@@...@@.@@.@.@@@@@@.@@@.@@@@@@@@@.@@.@@@@@@.@@@@@@.@@@@@@@@@@.@@...@.@.@@...@ +.@.@@@@@@@.@.@@.@..@.@.@@@@@@@.@.@@@@@@.@@....@@@@.@@.@@..@.@@..@@@@@@@....@@@..@@.@..@@@.@@.@...@@@@..@..@@@@@...@@..@@@.@@@..@@@..@@@. +@..@@@@.@..@@@@@.@@.@@.@@@@.@@@..@@.@@@@@.@@@@@.@@@@@@.@..@@...@@...@.@.@@.@@@....@....@@@@@..@@@@@@.@@@@@.@.@@.@@@.@@.@.@.@@@@@@@@@.@.. +@..@@.@.@.@@@.@..@@@.@.@.@@@@..@@....@@@.@@@@.@@...@@.@@@....@..@.@..@.@@...@@.....@...@@@@.@..@.@.@..@@...@@.@....@@@@@@@@@@@@@@...@@.@ +@@@..@.@....@@@@.@@@.@@@.@@@@@@@@@@.@@...@@@..@@.@.@@.@..@@@.@@..@.@.@@@@@@...@@..@@@@...@@.@@@@...@.@.@@@@@.@@@@.@@@@..@@..@..@@@.@...@ +@@.@@.@@.@..@@@..@@@@..@@@@.@@@.@.@@@@.@@.....@.@@@.@.@..@@.@@@@@@@.@@@.@.@@@@@@@@@@.@@@.@.@@@.@@@@@@.@.@..@@@..@@@.@@.@..@@..@@@@@@@@@@ +@@@...@.@...@@.@@@.@@..@@@.@@@@.@@..@@.@.@.@@.@@.@@.@@@@@@@@.@.@@@@.@.@@..@@.@.@@@@@.@..@@@@@@@@......@@@@@@@@@@.@....@..@@@.@.@@@@.@..@ +.@@@@@@@@.@@@@@.@.@@@@@@@@@.@@@.@@@.@@@.@.....@@@@@@@.@@@@@@.@@@@@@.@@@@.@.@.@.@@@@.@@@@@@.@@@@..@@@.@@@.@.@@@.@@@@@@@@@@@.@.@.@...@...@ +...@@@@@.@.@..@@.@@@@.@@@@@@@.@@@@.@@@..@.@@@@@@@.@.@@..@@..@@.@@@@@@.@@@@.@.@..@@@.@@.@@@@..@.@@@@@@@@@@@.@@.@@@...@@@@@.@@.@.@@@.@@@.@ +..@.@@@@@@.@.....@.@@..@...@..@@@@@@.@..@@@.@.@.@@.@.@@@@..@@@..@@@@@@@.@@@.@.@@@@@@..@@...@.@@.@..@@@@@.@..@@@..@@@.@@@@.@.@@...@@@.@@@ +@@@.@@@@@@@@@....@@@.@@@@@@...@@@.@@@.@.@@@@@.@@@@...@@.@@@...@@@@@@@@@@@@@@@.@.@@@.@@@@@@@@@@.@@@@@@..@@.@.@@@..@@@.@@@@@@@.@@@@@@@@..@ +@.@@@@@.@..@..@@@.@@..@@@@@@@@@.@@@@@@@@.@..@@.@@@.@@.@.@@@@.....@.@@.@.@@@.@.@@@...@@@.@.@.@.@..@.@@@@.@@...@@..@@..@.@@.@@.@@@@.@.@@@@ diff --git a/src/day-4/part-1.zig b/src/day-4/part-1.zig new file mode 100644 index 0000000..01173c3 --- /dev/null +++ b/src/day-4/part-1.zig @@ -0,0 +1,53 @@ +const std = @import("std"); + +pub fn adj(list: std.ArrayList([]u8), x: usize, y: usize) u8 { + var count: u8 = 0; + + if(y > 0 and list.items[y - 1][x] == '@') count += 1; + if(y < list.items.len - 1 and list.items[y + 1][x] == '@') count += 1; + if(x > 0 and list.items[y][x - 1] == '@') count += 1; + if(x < list.items[0].len - 1 and list.items[y][x + 1] == '@') count += 1; + + if(y > 0 and x > 0 and list.items[y - 1][x - 1] == '@') count += 1; + if(y < list.items.len - 1 and x > 0 and list.items[y + 1][x - 1] == '@') count += 1; + if(y > 0 and x < list.items[0].len - 1 and list.items[y - 1][x + 1] == '@') count += 1; + if(y < list.items.len - 1 and x < list.items[0].len - 1 and list.items[y + 1][x + 1] == '@') count += 1; + + return count; +} + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer _ = gpa.deinit(); + const alloc = gpa.allocator(); + + const path = "input.txt"; + const fp = try std.fs.cwd().openFile(path, .{.mode = std.fs.File.OpenMode.read_only}); + defer fp.close(); + var reader = fp.reader(); + + var buffer: [256]u8 = undefined; + var list = std.ArrayList([]u8).init(alloc); + defer list.deinit(); + defer for(list.items) |i| alloc.free(i); + + while(try reader.readUntilDelimiterOrEof(&buffer, '\n')) |line| { + var linec = try alloc.alloc(u8, 256); + + @memset(linec, 0); + @memcpy(linec[0..line.len], line); + try list.append(linec); + } + + var count: u64 = 0; + + for(0..list.items.len) |y| { + for(0..list.items[0].len) |x| { + if(list.items[y][x] == '@' and adj(list, x, y) < 4) { + count += 1; + } + } + } + + std.debug.print("{d}\n", .{count}); +} diff --git a/src/day-4/part-2.zig b/src/day-4/part-2.zig new file mode 100644 index 0000000..a6793d7 --- /dev/null +++ b/src/day-4/part-2.zig @@ -0,0 +1,59 @@ +const std = @import("std"); + +pub fn adj(list: std.ArrayList([]u8), x: usize, y: usize) u8 { + var count: u8 = 0; + + if(y > 0 and list.items[y - 1][x] == '@') count += 1; + if(y < list.items.len - 1 and list.items[y + 1][x] == '@') count += 1; + if(x > 0 and list.items[y][x - 1] == '@') count += 1; + if(x < list.items[0].len - 1 and list.items[y][x + 1] == '@') count += 1; + + if(y > 0 and x > 0 and list.items[y - 1][x - 1] == '@') count += 1; + if(y < list.items.len - 1 and x > 0 and list.items[y + 1][x - 1] == '@') count += 1; + if(y > 0 and x < list.items[0].len - 1 and list.items[y - 1][x + 1] == '@') count += 1; + if(y < list.items.len - 1 and x < list.items[0].len - 1 and list.items[y + 1][x + 1] == '@') count += 1; + + return count; +} + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer _ = gpa.deinit(); + const alloc = gpa.allocator(); + + const path = "input.txt"; + const fp = try std.fs.cwd().openFile(path, .{.mode = std.fs.File.OpenMode.read_only}); + defer fp.close(); + var reader = fp.reader(); + + var buffer: [256]u8 = undefined; + var list = std.ArrayList([]u8).init(alloc); + defer list.deinit(); + defer for(list.items) |i| alloc.free(i); + + while(try reader.readUntilDelimiterOrEof(&buffer, '\n')) |line| { + var linec = try alloc.alloc(u8, 256); + + @memset(linec, 0); + @memcpy(linec[0..line.len], line); + try list.append(linec); + } + + var count: u64 = 0; + + var y: isize = 0; + while(y < list.items.len) : (y += 1) { + var x: usize = 0; + while(x < list.items[0].len) : (x += 1){ + if(list.items[@intCast(y)][x] == '@' and adj(list, x, @intCast(y)) < 4) { + list.items[@intCast(y)][x] = '.'; + if(y != 0) y -= 1; + y -= 1; + count += 1; + break; + } + } + } + + std.debug.print("{d}\n", .{count}); +} |
