Compare commits

...

4 Commits

21 changed files with 2169 additions and 4 deletions

2
2025/'
View File

@@ -1,2 +0,0 @@
-- Using Autorun now
print("Starting Day 5...")

24
2025/Day10/Day10.lua Normal file
View File

@@ -0,0 +1,24 @@
-- Advent of Code 2025 - Day 10 - Bas Grolleman
require("functions")
local filename = "Day10/test"
print("Day 10")
local input = {}
for line in io.lines(filename) do
local switches = string.match(line, "%[([#.]+)%]")
local buttons = {}
for b in string.gmatch(line, "%(([%d,]+)%)") do
local sw = {}
for j in string.gmatch(b, "%d+") do
table.insert(sw, tonumber(j))
end
table.insert(buttons, sw)
end
table.insert(input, {
switches = switches,
buttons = buttons,
})
end
print_table(input)

0
2025/Day10/full Normal file
View File

3
2025/Day10/test Normal file
View File

@@ -0,0 +1,3 @@
[.##.] (3) (1,3) (2) (2,3) (0,2) (0,1) {3,5,4,7}
[...#.] (0,2,3,4) (2,3) (0,4) (0,1,2) (1,2,3,4) {7,5,12,7,2}
[.###.#] (0,1,2,3,4) (0,3,4) (0,1,2,4,5) (1,2) {10,11,11,5,10,5}

47
2025/Day12/Day12.lua Normal file
View File

@@ -0,0 +1,47 @@
-- Advent of Code 2025 - Day 12 - Bas Grolleman
require("functions")
print("Day 12")
local filename = "Day12/test"
local input = file_lines_to_table(filename)
function parseInput(lines)
local packages = {}
local locations = {}
-- Parse first dataset (patterns 0-5)
local pattern = {}
local patternNum = -1
for i, line in ipairs(lines) do
if line:match("^%d:$") then
-- New pattern number
patternNum = tonumber(line:sub(1, 1))
pattern = {}
elseif line:match("^[%.#]+$") and #line == 3 and patternNum ~= -1 then
-- Pattern row
table.insert(pattern, line)
if #pattern == 3 then
packages[patternNum] = pattern
end
end
end
-- Parse second dataset (dimension and coordinate data)
for i, line in ipairs(lines) do
local x, y, coords = line:match("^(%d+)x(%d+):%s+(.+)$")
if x and y then
local data = { x = tonumber(x), y = tonumber(y), coords = {} }
for num in coords:gmatch("%d+") do
table.insert(data.coords, tonumber(num))
end
table.insert(locations, data)
end
end
return packages, locations
end
local shapes, locations = parseInput(input)
print_table(shapes)
print_table(locations)

33
2025/Day12/test Normal file
View File

@@ -0,0 +1,33 @@
0:
###
##.
##.
1:
###
##.
.##
2:
.##
###
##.
3:
##.
###
##.
4:
###
#..
###
5:
###
.#.
###
4x4: 0 0 0 0 2 0
12x5: 1 0 1 0 2 2
12x5: 1 0 1 0 3 2

44
2025/Day6/Day6.lua Normal file
View File

@@ -0,0 +1,44 @@
-- Day 6 Lua
--
local input_file = "Day6/full"
local input = {}
local rows = 0
local cols = 0
local total = 0
--
--
for line in io.lines(input_file) do
local col = {}
rows = rows + 1
for I in line:gmatch("[%d*++-%%]+") do
table.insert(col, I)
end
table.insert(input, col)
end
for _ in ipairs(input[1]) do
cols = cols + 1
end
for loop_col = 1, cols do
local calculation = input[rows][loop_col]
local output = calculation .. " "
local result = input[1][loop_col]
output = output .. " " .. result
for loop_row = 2, rows - 1 do
local num = input[loop_row][loop_col]
output = output .. " " .. num
if calculation == "+" then
result = result + num
elseif calculation == "*" then
result = result * num
else
print("Weird calculation")
end
end
output = output .. " = " .. result
print(output)
total = total + result
end
print("End Total " .. total)

45
2025/Day6/Day6_2nd.lua Normal file
View File

@@ -0,0 +1,45 @@
-- Day 6 Lua
--
require("functions")
local input_file = "Day6/full"
local input = file_characters_to_table(input_file)
local rows = tablelength(input)
local cols = tablelength(input[1])
local grandtotal = 0
local math = {}
for col = cols, 1, -1 do
local num = ""
local calc = ""
for row = 1, rows do
-- print("Checking R" .. row .. "C" .. col .. " " .. input[row][col])
v = input[row][col]
if tonumber(v) ~= nil then
num = num .. input[row][col]
elseif v == "*" or v == "+" then
calc = v
end
end
table.insert(math, tonumber(num))
-- print("Adding " .. num)
if calc == "*" or calc == "+" then
local t = 0
for k, v in ipairs(math) do
if t == 0 then
t = v
else
if calc == "+" then
t = t + v
end
if calc == "*" then
t = t * v
end
end
end
print(calc .. " " .. t)
grandtotal = grandtotal + t
math = {}
end
end
print()
print("Grand total = " .. grandtotal)

5
2025/Day6/full Normal file
View File

@@ -0,0 +1,5 @@
95 62 793 567 8181 73 5 55 76 59 3498 51 3 53 59 7821 93 45 2 5 4 8 517 341 5 472 24 55 59 6 67 525 499 4 178 323 8 9912 1 78 43 666 758 473 39 9634 96 952 5 8344 2 3 42 8 3 452 521 85 81 2 61 92 26 8683 683 99 2 11 825 4493 92 853 549 6 1 21 226 826 218 9 182 7672 88 9596 71 56 13 6146 59 41 631 751 556 373 83 1 93 158 47 9 41 67 75 7666 7936 1 8 217 3289 57 47 59 74 3 96 49 53 82 789 51 561 7 85 5 2174 6 586 6684 782 45 41 38 73 378 47 53 4 6 161 23 4331 13 384 5 19 8 2115 191 13 35 835 7 51 3 948 323 19 269 4 3 87 15 26 195 39 623 73 35 767 8292 71 29 38 2547 15 833 522 9 1281 323 6 4 285 69 234 7229 6 4 962 16 33 45 236 8 445 4337 8 21 384 7 1593 44 9 5517 18 3425 36 6 91 7 5855 311 725 25 2 2 3 753 812 978 647 29 618 95 51 8851 9 874 47 366 9 88 7 22 879 182 65 36 365 344 4799 781 25 72 714 311 69 5 27 83 769 8788 25 95 29 15 12 1 6 13 385 4354 22 73 22 587 278 17 54 13 7 2 226 849 36 16 51 333 75 27 4 5631 3 54 28 66 47 56 522 7 637 17 687 8743 76 77 196 54 3 11 317 172 2 99 6 5 14 76 368 8 1 7953 23 56 5 82 782 4 23 3693 48 34 23 16 53 61 22 474 7 8 6 912 296 8 2 19 776 19 6 317 8732 955 17 7 2 21 291 46 95 1 9 4433 617 8 14 793 3825 3864 696 44 12 96 16 78 84 73 26 88 8 96 27 4 57 27 8 556 832 53 8596 4 5 351 5888 18 141 873 87 858 891 4 699 491 82 35 9 92 9 15 3 85 11 3 4 78 21 65 5 418 867 6 84 3551 6866 7 38 32 5832 48 352 91 45 9 9 161 9338 78 783 9 514 27 345 1 39 1 218 84 4543 7 54 318 981 9 2 48 88 56 7973 9 92 5 793 27 26 39 88 62 363 97 6 865 62 14 739 553 7 72 2 6 5 67 859 963 1652 16 718 67 5 31 86 23 569 4 6 71 79 4 33 8 39 26 21 8 37 41 9 14 871 5 4 88 53 34 2 651 89 99 344 2 359 5 5 3425 235 545 13 23 9751 686 3697 68 66 63 253 1166 267 52 88 7152 57 819 245 28 2616 781 2 984 925 71 71 7 246 83 89 41 9 336 97 272 4 685 8 46 753 3 4 56 13 64 976 14 276 11 18 837 6 597 29 17 6 45 5947 3 92 7 7 5575 43 236 44 222 8 34 671 2612 18 9 235 75 269 9158 38 81 2 74 9 5 4767 336 683 1317 98 86 9227 7 2 16 8464 529 25 32 84 23 29 233 38 37 621 383 9763 171 44 489 81 75 17 59 25 12 68 655 7 93 89 71 72 8 7 6 419 7 96 652 4 3 3142 49 28 656 9498 49 582 1 884 885 85 439 6 53 22 2857 3 6 337 93 5154 94 68 659 82 8 33 73 16 13 68 862 35 81 515 48 43 1 5833 8 34 271 7 6 45 22 48 81 4 2 224 819 22 22 4 176 47 38 67 745 592 8547 758 6 75 562 24 77 43 6923 32 34 1464 461 177 898 47 2423 98 182 2491 2593 9 57 96 65 556 284 94 3 7173 8126 7345 62 77 1 2 87 12 21 1 16 1 7689 29 532 72 843 3 33 176 78 11 1813 21 94 779 86 544 398 84 6 36 28 674 37 98 363 644 37 2 96 73 91 86 58 65 6413 53 739 81 2869 135 16 93 6348 395 48 21 285 5 15 187 13 33 6862 47 592 231 9984 691 218 21 81 982 2 3 47 91 3697 819 874 638 65 11 16 375 528 47 93 77 43 48 78 83 215 75 51 88 93 24 44 2 5 395 35 68 6585 564 48 911 1616 91 83 646 328 76 5 656 166 48 21 992 3 892 894 977 18 39 85 2255 5484 2464 743 1 4 1 4 7 272 5 53 5 1 272 57 895 46 79 91 311 59 62 7743 61 457 17 395 462 11 768 99 49 431 61 558 34 2381 5463 1 384 3 34 42 185 22 591 557 36 31 419 86 134 5 2 9 622 897 354 1318 383 5 86 145 876 54 181 63 837 46 78 195 4 4 12 64 25 11 49 357 973 822 68 241 674 416 247 5458 49 3 541 54 61 553 53 36 515 478 9711 12 8 5154 93 1315 278 5 92 726 596 37 67 49 9 77 1 35 896 21 32 74 82 699 3 4 741 9 3 11 5461 688 889 9537 398 729 298 5
67 21 33 613 4255 65 5 73 69 27 2623 72 6 25 56 5812 29 76 58 73 4 65 135 139 3 797 717 212 32 44 44 712 7161 73 879 726 7 7535 1 775 92 482 572 226 82 1466 89 2971 34 2541 66 77 97 94 7 153 253 65 62 67 42 2325 35 2644 356 44 4 88 355 3629 64 977 985 43 6 13 85 163 44 7 925 915 93 5423 737 957 17 432 25 58 97 246 514 194 752 2 55 286 26 71 14 9 398 1826 8113 85 9 892 9293 22 922 2649 42 74 5759 326 41 62 186 28 259 5 35 52 8761 11 437 7389 711 51 69 75 656 649 87 94 3 6 184 91 5313 47 9564 21 14 878 9229 332 366 35 365 7 222 47 311 719 453 567 816 8 74 74 14 295 849 563 66 793 693 9877 61 56 8 7661 71 915 712 49 449 6693 25 6 438 22 114 1625 7 28 234 87 19 163 674 59 791 4994 41 39 421 88 748 92 65 4148 22 9685 5 4 36 67 1827 9552 817 54 1195 53 919 542 587 13 886 85 939 7897 24 1582 75 291 52 851 9 89 1 14 46 253 11 328 275 6 341 698 46 64 865 289 73 4 55 423 898 199 891 51 43 98 24 64 74 283 334 3712 63 75 14 931 354 51 44 38 65 64 693 762 45 93 19 57 419 65 69 6893 945 91 26 38 82 857 681 392 916 73 781 7633 64 42 623 96 85 94 179 522 97 82 55 82 84 69 245 9 5 8667 39 62 3 233 26 7 77 6289 426 77 5689 353 23 2 97 275 7 7 71 26 594 12 46 42 472 5428 81 655 2313 672 414 5 22 618 476 48 71 65 37 3114 411 2 123 361 1355 134 914 84 476 67 43 71 82 14 26 34 223 15 19 7 81 53 8 971 7789 74 2883 615 9 732 6985 1 889 783 12 925 511 69 652 392 89 819 77 65 47 62 12 19 96 97 76 66 96 66 78 599 822 96 892 8491 1368 93 89 52 411 93 247 27 26 81 2 843 2171 26 412 14 181 38 891 59 72 6 494 738 412 58 53 621 923 8 23 41 68 4 3756 414 212 3 665 21 588 26 46 95 163 926 24 76 68 61 736 514 5 77 17 56 3 67 798 56 7932 87 374 48 8 391 99 72 433 15 19 61 82 4 8 44 522 24 66 8 53 77 6431 513 978 76 9 99 98 94 574 268 39 56 194 14 323 5 264 1682 729 979 62 68 3187 394 1883 44 12 58 414 8373 969 8 882 7187 63 166 155 57 1528 66 73 642 423 52 113 48 752 87 11 31 89 245 55 991 17 259 3 2 553 6 3 97 775 59 243 56 445 222 36 455 674 459 15 668 3 12 645 14 895 62 13 1116 26 523 48 225 24 58 652 997 274 78 889 25 46 755 576 3 39 96 548 68 1252 2628 273 7414 53 126 1238 56 3 25 1457 42 65 88 83 36 53 73 28 12 997 265 8571 876 755 579 66 27 64 58 64 57 23 724 31 66 44 815 98 12 1 8 294 78 79 479 38 12 2957 77 32 557 4384 31 993 84 1142 674 52 9268 68 36 41 4856 62 98 933 797 3875 99 11 488 21 626 348 11 67 18 18 163 25 27 21 61 774 9 4451 32 15 774 58 76 86 59 37 89 5 4 895 563 44 26 9 597 54 27 6 812 355 9464 214 25 35 989 4 63 99 8958 92 9963 392 788 397 458 29 4824 71 366 5873 566 34 8519 81 36 867 662 366 913 9482 191 8272 39 89 22 25 19 225 3428 54 46 315 8788 35 346 84 441 24 56 619 58 8 1496 59 321 592 44 662 994 88 44 69 585 733 16 28 687 538 14 24 58 26 444 963 42 35 7683 442 553 21 7561 773 49 24 9565 698 59 46 993 1 248 143 73 98 1633 72 528 297 7191 48 251 4417 37 855 43 9 89 74 138 613 827 637 18 631 51 241 817 421 53 161 18 471 516 589 482 93 92 77 75 29 98 2 3 185 77 98 7965 842 68 881 4455 258 59 899 382 67 6 194 737 87 27 564 57 3359 422 159 43 78 528 6464 5329 7429 249 91 43 2 2 9 764 311 15 88 3426 165 27 559 844 31 32 466 93 56 6757 65 86 48 351 711 31 729 72 93 694 89 157 77 6466 1552 21 524 81 73 452 984 43 67 794 11 95 456 97 785 95 81 2 555 576 581 783 711 39 299 548 417 51 657 55 699 58 26 713 97 1 611 38 93 24 48 578 564 464 66 739 888 863 195 8871 797 888 313 64 783 514 41 35 162 978 2786 86 4 9423 896 2546 93 2 494 157 523 52 1811 72 89 99 33 32 933 85 79 818 83 655 32 1 791 1 49 999 2691 423 237 1966 235 227 789 3
47 46 5 57 416 83 9 62 9769 29 8739 4 784 43 6 4593 48 83 33 41 84 71 83 616 254 181 874 865 691 63 367 447 5358 77 579 179 76 6671 61 796 66 829 46 868 19 5774 52 2421 11 56 19 99 576 264 5 445 113 45 55 62 73 1319 94 6221 417 66 93 9 34 4711 58 614 195 637 71 13 2 855 78 95 713 349 6 1442 371 185 114 772 62 53 26 31 426 681 949 56 1 22 32 56 5 8 889 765 2159 19 56 13 613 3 611 1998 69 13 9777 4979 33 61 968 35 971 55 8673 44 614 11 56 1975 4237 56 69 486 173 377 886 32 89 64 311 2 152 49 9898 12 18 543 6731 589 689 33 494 25 996 99 24 675 8542 116 788 82 27 75 2 57 295 2 644 731 886 119 29 75 5 17 75 7911 367 96 631 1269 971 42 127 74 95 7963 23 348 814 27 9 161 922 88 687 3179 512 95 96 73 128 81 43 9739 837 6987 7 852 391 8878 156 5896 72 773 8125 42 3568 429 461 95 43 96 598 8551 14 993 88 276 49 827 25 9 16 67 35 83 13 184 169 2 7 189 27 11 6797 893 55 654 32 828 451 532 6241 78 46 46 4 54 562 526 317 145 941 39 27 254 87 64 396 6 73 839 125 23 53 67 431 32 669 166 64 17 787 279 39 11 16 168 434 866 268 53 54 8569 42 269 953 5 65 85 98 168 95 4 68 913 83 91 437 42 61 1172 86 36 39 854 92 63 75 593 782 29 9112 174 928 8 16 197 44 64 27 24 88 74 876 85 966 8883 83 63 727 292 163 62 43 114 157 99 25 66 18 1932 178 3 6549 78 5561 896 336 62 729 49 63 832 38 92 98 99 265 6 39 96 65 65 69 597 2825 8 8148 875 377 72 7534 8 355 541 46 3981 958 87 838 129 93 357 89 68 476 29 65 39 29 546 122 75 37 24 21 792 769 73 537 9834 687 977 48 12 987 47 41 75 9629 65 84 513 8417 37 458 86 28 58 744 83 358 63 35 159 161 98 65 65 63 595 91 45 69 9 733 482 257 57 684 39 767 76 58 47 618 386 325 21 14 7 483 291 88 62 61 132 3 6 72 73 2722 62 728 79 863 1915 15 73 76 54 18 78 77 15 3 976 711 82 8 86 13 67 1594 841 655 26 63 14 48 94 567 14 794 2 8 57 21 615 521 4781 18 168 394 62 913 937 5235 93 97 313 6842 5146 616 9 178 217 46 448 76 83 166 33 92 733 491 77 248 51 556 67 2 567 62 51 43 313 646 743 74 5 56 19 62 1 1845 29 65 477 56 951 49 74 961 428 662 226 73 17 754 579 624 15 68 839 1 791 11 487 836 2 211 364 131 298 414 83 42 952 679 1 42 43 3492 22 368 2468 49 63 7 883 2444 849 69 85 4469 38 58 12 9 1 81 52 881 68 287 771 8292 783 112 426 84 24 5 9371 44 1 75 73 82 86 572 613 7 25 212 52 723 35 21 18 746 224 7726 38 1 852 755 275 628 44 3238 735 46 3118 841 16 57 411 391 847 134 5118 89 72 7 559 13 361 843 17 81 92 1 832 66 53 1 64 3757 28 9283 63 13 792 987 272 912 51 22 99 65 59 48 476 44 43 69 575 61 21 6 73 46 65 261 592 13 188 5 43 55 2253 87 1761 753 28 646 866 78 123 39 953 4283 26 42 5838 2 85 32 61 7424 9494 86 947 265 59 56 333 6773 65 452 6267 89 38 485 237 6 558 94 488 463 77 533 12 6 946 16 192 947 46 7 227 5 82 33 114 492 38 63 126 36 92 455 26 82 589 319 75 66 762 779 1151 16 23 271 23 94 13 59 62 78 5 83 621 24 64 56 339 35 998 26 7917 77 674 9523 66 179 87 15 87 322 86 845 135 252 51 6189 61 475 57 973 71 758 8 722 4147 246 948 133 331 55 16 837 33 73 412 411 27 71 667 27 38 929 7596 487 54 843 3485 67 66 37 59 93 55 647 57 4185 454 396 689 99 385 331 642 7679 748 123 21 66 8 91 936 8715 13 19 3549 22 97 857 6496 263 83 839 57 51 5236 78 68 87 443 778 28 553 36 54 814 34 561 272 477 9589 17 9354 73 86 765 811 21 66 22 61 97 643 23 657 51 663 2 537 756 63 518 447 992 244 335 8 23 25 93 521 79 4 785 42 4 691 85 929 43 84 632 55 84 2279 78 362 863 775 5443 475 2799 248 19 356 326 6 49 64 879 7437 37 3 378 863 3866 42 994 1851 48 46 4 3491 27 94 46 945 246 23 1 33 533 39 734 73 93 625 143 317 991 639 897 669 8621 9922 162 733 8
35 73 1 3 2 52 76 15 5435 5 1352 4 355 31 6 55 99 41 75 79 93 96 66 72 694 378 431 498 254 77 298 94 3299 47 838 158 21 367 94 137 17 865 87 4 75 666 84 2424 13 3 44 51 353 6115 72 56 186 64 366 817 85 4987 998 318 359 7 65 7 34 5166 92 6 252 326 31 34 9 9 6 88 456 659 9 17 539 418 386 598 47 34 8 43 29 96 254 69 7 96 5 95 8 4 1348 5 14 41 55 53 25 6 245 8867 57 22 9696 5687 2 32 198 7 43 92 6494 76 113 77 56 551 8359 55 3 317 912 159 355 42 96 48 772 7 94 98 5598 97 74 691 253 56 856 85 389 47 483 94 4 345 5273 796 378 12 6 94 8 6 934 9 276 516 564 392 3 15 8 27 52 2794 25 273 577 7714 186 94 56 37 33 688 72 668 137 958 6 951 97 14 227 6641 281 6 59 468 74 2 75 48 171 56 2 9822 817 7273 99 6162 31 214 8833 49 2847 49 768 8 37 41 721 7638 59 813 51 77 35 917 12 9 95 3 13 92 3 675 79 2 7 1 64 79 9482 328 68 351 358 165 33 91 9858 64 828 53 5 89 176 311 399 731 163 75 94 83 2 27 372 5 43 544 87 37 1 71 731 9 277 856 11 4 414 213 15 31 54 843 161 674 23 11 7 45 15 235 9 9 89 777 9 558 93 6 27 327 16 34 98 97 86 53 394 32 11 695 6 95 28 715 416 71 9227 528 714 7 34 867 47 985 32 46 26 65 798 63 539 2641 59 61 17 61 418 52 24 738 43 89 9 61 77 387 62 22 1698 4 2978 28 1 54 181 2 56 578 69 36 33 62 514 1 95 55 19 85 65 74 3275 2 5167 174 468 35 6378 4 7537 19 93 6563 118 74 61 939 647 592 66 18 6328 66 44 75 68 813 373 82 57 66 42 787 511 19 531 999 2 6536 2 53 38 1 8 76 9659 78 87 6878 7219 87 666 46 6 75 439 32 227 88 45 631 54 17 32 81 2 275 12 7 6 7 44 998 922 495 97 25 614 36 95 87 83 296 493 9 41 9 767 252 24 42 64 255 61 5 45 6 57 46 89 57 986 4663 4 53 3 847 51 65 78 13 4 423 374 89 6 81 5 18 9191 259 485 28 36 8 88 584 757 9 653 3 7 15 24 1549 818 973 5 328 587 16 675 644 2328 81 76 9981 2684 39 461 6 668 3 177 282 29 68 38 7 65 936 69 73 156 375 76 8 7 783 83 4 8 7 341 91 41 5 82 38 97 4 9876 15 3 514 76 353 84 29 913 83 192 939 28 45 54 861 373 223 92 884 3 331 7 3 476 7 816 573 999 746 872 88 57 23 6628 1 41 23 9274 711 35 3767 46 8 4 5868 64 574 68 67 9668 92 94 95 9 9 88 2 556 423 121 729 829 286 4617 253 62 2 7 3694 74 1 93 1 74 96 629 895 6 78 2963 66 521 48 92 68 769 889 594 9 8 3 745 291 5 71 9252 38 7 1346 998 76 83 12 127 346 99 5217 3 6 8 79 44 395 734 29 1 67 2 11 55 71 3 2 9849 38 8325 44 66 55 446 816 945 6 716 68 43 91 5 894 9 16 25 26 57 64 5 42 6 7 465 212 4 18 7 43 648 1454 19 2922 3 66 83 253 1 68 83 2 318 52 71 2248 3 14 53 95 1827 3515 71 94 8 6 74 287 8924 84 668 8777 17 14 131 68 4 328 63 2 823 25 971 2 5 137 37 777 2 68 6 25 4 763 52 483 583 34 2 9 36 67 555 81 81 955 239 59 3 26 261 1641 7 38 914 48 4 17 12 28 4 4 13 593 9 16 49 28 3 939 47 281 7 649 2367 58 72 395 31 4 114 9 361 43 37 28 6914 5 881 2 993 54 637 1 3392 8142 828 9 885 982 1 75 694 31 355 859 936 71 656 76 55 98 368 629 895 48 33 4434 66 25 8 54 35 11 93 34 4995 378 373 554 6 639 465 439 6313 712 491 682 23 52 66 19 6258 18 65 6678 93 5 725 3643 458 95 24 88 89 235 15 6 3 91 211 38 75 36 91 85 56 74 331 292 25 65 4558 349 49 431 494 64 21 15 97 9 51 43 24 62 948 48 32 985 24 4 66 973 456 8 1 99 56 1 82 49 4 57 66 279 795 7 273 2 39 42 64 9 7448 5 492 794 6 855 127 8163 38 9 198 268 2 395 8 29 347 68 46 462 977 6832 9 312 5169 56 72 5 5121 32 46 71 968 892 7 3 8 125 72 462 22 73 581 264 263 829 245 6 851 16 6411 175 62 31
* + + + + + + * + * + + + * + + + + + * + * + + * * + * + + + * + + + * * + + + * * + * * + * + + + * * * + * + * * + + + + * + + + * * * + * * + + * + * + + * + + * + + * * + + * * * + + * * + * + * * * + + + + * + + + * + + + + + * + * + + * + * + * * + + + * * * * * * + * + * + * + * * * + * + + + * + + + * + * * + * * * + * * + + + + * * + + * + * * + + + * + + * + * * + * * * + + + + + * + * + * * + * + * + * + + + * * + * + * * * * * + + + + + * + * + * * * * * * + * + + * + + + + * * + * * + + * * * * + * * * + * * + * + + + * * + + + + * * * * * * + * * * + + + + * + + + + * + * * + * + * * + + * * + + * * + * + + * * * * + + * + * + + + * + + * + + + * + + + * + + * * * * * * + + + + + * * + * + + * * * * + * * + + * + * * + + + + + + + + * * * + * + + * + + + * * * + * * + * + * * + * + + + * * * + + + + + * * + + + + + + * + + + + * + * + + + * * + + + * * + * * + * * + * * + * + * * + * * + * * * + * * + + + * + + + + + * * + * + * * * * * + * * + + + * * * + + + * * * * + * * * * * * + * * + * + * * + * + * + + * + + + * + * + * * * + + * + + + * * * + + * + + * * * * * + * + + + + + + * * * + + * * + * + + * + * * * * + * * * * + * * + * * + + * + + + * * + * + + + + + + + + + + + * + + + + * * + + * * + + + + + + * + * * + * * * * + + + + * + + * * * * + + * + + * + + + * * + * + * + * * * + + * * * * + * * * * + + + * * + + * + * * + * * + * + * * * * + + * + + + * + * + + * + + * * * * + + + + + * * * + * + + + + + * * * + + + + + + + * * + + * + + + * + * + * * * * + * * + + * + * * + * * * * * * + + * + + + + + * * * + * + * + + * * + + * * + * + + * * + * * + + * * + + + * * + * + + + * * + * + + * + * + + + * * * * * + * * * * * + * + * + + + * * * + * + + + + * * + + * * + * + + + + * * + * + + + + * * + * * * + + * * + * + + + + * + * + * * + * + * + + * + + * + * * * * + + + * * * + * * + * + + + * * + * * + * + + * + * * + + * * * * + + * + * + + + + * * + + + * * * + + * + * + + * + * + * + + * * + * * * * * * + + * + * + * + * * + + + * +

4
2025/Day6/test Normal file
View File

@@ -0,0 +1,4 @@
123 328 51 64
45 64 387 23
6 98 215 314
* + * +

80
2025/Day7/Day7.lua Normal file
View File

@@ -0,0 +1,80 @@
-- Day 7 - Advent of Code 2025 - Bas Grolleman
require("functions")
local input_file = "Day7/test"
local input = file_characters_to_table(input_file)
local rows = tablelength(input)
local cols = tablelength(input[1])
local splits = 0
local quantumsplits = 0
print("Rows " .. rows .. " Cols " .. cols)
print(table.concat(input[1]))
for R = 2, rows do
for C = 1, cols do
if input[R][C] == "." then
if input[R - 1][C] == "S" or input[R - 1][C] == "|" then
input[R][C] = "|"
end
elseif input[R][C] == "^" and input[R - 1][C] == "|" then
if input[R][C - 1] ~= "|" then
input[R][C - 1] = "|"
end
if input[R][C + 1] ~= "|" then
quantumsplits = quantumsplits + 2
input[R][C + 1] = "|"
end
splits = splits + 1
end
end
print(table.concat(input[R]) .. " " .. quantumsplits)
end
print("Total splits " .. splits)
print("Total quantumsplits " .. quantumsplits)
-- Okay, time to learn how to make a tree node
-- Great, I learned how to try a brute force (that will obviously never work)
function createNode(col)
local node = {
col = col,
childeren = {},
}
return node
end
local root = createNode(math.ceil(cols / 2))
local active_nodes = { root }
for row = 2, rows do
for k, n in ipairs(active_nodes) do
if next(n.childeren) == nil then
if input[row][n.col] == "^" then
local a = createNode(n.col - 1)
local b = createNode(n.col + 1)
table.insert(active_nodes, a)
table.insert(active_nodes, b)
n.childeren = { a, b }
end
end
end
end
local gt = 0
function count_table(t, indent)
indent = indent or ""
print(indent .. "c" .. t.col)
if next(t.childeren) ~= nil then
for k, v in pairs(t.childeren) do
count_table(v, indent .. " ")
end
else
gt = gt + 1
end
end
count_table(root)
print("Grand Total " .. gt)

142
2025/Day7/full Normal file
View File

@@ -0,0 +1,142 @@
......................................................................S......................................................................
.............................................................................................................................................
......................................................................^......................................................................
.............................................................................................................................................
.....................................................................^.^.....................................................................
.............................................................................................................................................
....................................................................^.^.^....................................................................
.............................................................................................................................................
...................................................................^.^...^...................................................................
.............................................................................................................................................
..................................................................^.^.^.^.^..................................................................
.............................................................................................................................................
.................................................................^.^...^.^.^.................................................................
.............................................................................................................................................
................................................................^.^...^.^.^.^................................................................
.............................................................................................................................................
...............................................................^.^.^.^.^.^.^.^...............................................................
.............................................................................................................................................
..............................................................^.^.^.^.......^.^..............................................................
.............................................................................................................................................
.............................................................^.........^.^.^...^.............................................................
.............................................................................................................................................
............................................................^.....^.^.^.^...^...^............................................................
.............................................................................................................................................
...........................................................^.^.^.^.^.^.^.^.^.^.^.^...........................................................
.............................................................................................................................................
..........................................................^.^.^.^.^.^...^.^.^.^.^.^..........................................................
.............................................................................................................................................
.........................................................^.^.^...^...^...^.^.....^.^.........................................................
.............................................................................................................................................
........................................................^.^.^.^.^.^.^.^...^.^.^.^.^.^........................................................
.............................................................................................................................................
.......................................................^.^.^.^.^.^.^...^.^.^.^.^.^.^.^.......................................................
.............................................................................................................................................
......................................................^...^.......^.^.....^.^...^.^.^.^......................................................
.............................................................................................................................................
.....................................................^.^.^.......^.^.^.^...^.^.^.^.^.^.^.....................................................
.............................................................................................................................................
....................................................^...^.^...^.^.^.^.^.^.^.^.^.......^.^....................................................
.............................................................................................................................................
...................................................^.....^.^.^.^.^.^.^.^.^.^...^.^...^...^...................................................
.............................................................................................................................................
..................................................^.^.^...^.....^.^.^.^.^...^.^.^.^.......^..................................................
.............................................................................................................................................
.................................................^.^.^.^...^.^.^...^.^...^.^.^.^.^.^.^.^...^.................................................
.............................................................................................................................................
................................................^.^...^...^.^.^...^.......^...^.^.^.....^...^................................................
.............................................................................................................................................
...............................................^.^.....^...^...^.^.^.^.^.^...^.^.^.^.^.^.^.^.^...............................................
.............................................................................................................................................
..............................................^.^.^.^...^.....^.^.^...........^.^.^.^.....^...^..............................................
.............................................................................................................................................
.............................................^.^.....^...^.^.^.^.^...^...^.^...^.^.^.^...^.^.^.^.............................................
.............................................................................................................................................
............................................^.^.^...^.^.^.^.^.^.^...^.^...^.^.^...^.^.^.^.^.....^............................................
.............................................................................................................................................
...........................................^.......^...^.^.^.^.^.^.^...^.^...^.^.^.....^.^.^.^.^.^...........................................
.............................................................................................................................................
..........................................^.^.^.^.......^...^.....^.^.^.^...^.^...^.^.^.......^.^.^..........................................
.............................................................................................................................................
.........................................^.^.^...^.^...^.^.^...^.^.^.^.^.....^.^...^.....^.^.^.^.^.^.........................................
.............................................................................................................................................
........................................^.^.^.^...^.^.^.^.^.^.......^...^.^.^.....^.^.....^.^...^.^.^........................................
.............................................................................................................................................
.......................................^.^.^.^.^.^.^.......^.^.^.^...^...^...^.^.^.^...^.^.^.^.......^.......................................
.............................................................................................................................................
......................................^.^.^.^.^...^...^.^.^.^.^...^...^...^.^...^.^.....^.^.^.^...^.^.^......................................
.............................................................................................................................................
.....................................^.^.....^...^.^...^.^.^.^.........^.^...^.^.^.^.....^.^.^.^.^...^.^.....................................
.............................................................................................................................................
....................................^...^.^.^.^...^...^...^.^.^.^.^.^.^...^.^.^.^.^...^.........^...^.^.^....................................
.............................................................................................................................................
...................................^.....^.^...^.^.^...^.^...^.^.^.^.^.^...^...^.....^.^.^.^.^.^.....^.^.^...................................
.............................................................................................................................................
..................................^.^.^...^.^.^.^...^.^.^...^.^...^.^.........^.^.^.^...^.....^...^.....^.^..................................
.............................................................................................................................................
.................................^.^.^.^.^.^.....^.^.^.^.^...^.^.^.^.^...^...^.....^.......^.^.^.^.^...^.^.^.................................
.............................................................................................................................................
................................^...^...^.^...^...^.^.^.^.^.^...^.^...^.^.^.^.^.^.^.^...^.^...^.^.^...^.^.^.^................................
.............................................................................................................................................
...............................^.^.^.^.^.^.^.....^.^.^.^.......^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.^.^.^.....^.^.^...............................
.............................................................................................................................................
..............................^.^.^.....^.^...^.^.^.......^.^.^.^.^...^.^.^...^.^.^.^.^.^.^.^...^.^.^.........^..............................
.............................................................................................................................................
.............................^...^...^...^.....^.^...^.^.^.^.......^.^.^...^.^...^.^.^.....^.^.^...^.^.^...^.^.^.............................
.............................................................................................................................................
............................^.^.^.^.....^...^...^.^.^...^.^...^...^.^...^.......^.^.^.^.^.^...^.^.^.^.^.^...^.^.^............................
.............................................................................................................................................
...........................^...^.^.^.^.^.^.^.^.....^...^.^.^.^.^.^.^.^.^.^.^.^.^.^.^...^.^...^...^.^.^.^.^.^...^.^...........................
.............................................................................................................................................
..........................^.^.^.^...^.^.^.^...^.^...^.^.^...^.^.^.^.^.^.^.^...^.^.^.^.^...^.^.....^...^.^...^.^...^..........................
.............................................................................................................................................
.........................^.....^.......^.^.^.^.^.....^.^.^.^...^.^...^.^.^.^...^.^.^.^.^.^.^.^.^.^.^.^.^.^...^.^.^.^.........................
.............................................................................................................................................
........................^.^.^.^.^.^.^.^.^.^.^.^.......^.....^...^.^.^...^.^.....^.^.......^.^.^.^.^.^.....^.^.....^.^........................
.............................................................................................................................................
.......................^...^.^.^.^.....^.^.^.^.......^.^...^.^.....^...^.......^...^.^...^.^.^.^.^.^.^.^.^.^...^.^.^.^.......................
.............................................................................................................................................
......................^.....^.^.^.^.^.^...^.^.^.^...^.....^.^.^.^...^...^.^.^.^.^.^...^.....^.^.^.^...^.^...^...^.^.^.^......................
.............................................................................................................................................
.....................^.....^.^...^.....^.^.^...^.^...^.^.^...^.^.^.^...^.^...^...^.....^.^...^...^.^.^.^.^.^...^.^.^.^.^.....................
.............................................................................................................................................
....................^.^.......^.^.....^.^.....^.^.^.^.^.^.^.......^.^...^...^...^.....^.^.^.^.....^...^.^.^.^.^.^.....^.^....................
.............................................................................................................................................
...................^.^.^.^.^.^.^.^.^...^.^.^.^.^...^.^.^.^.^.......^.^.^.^.^...^.^.^.^.^...^.^.^.^...^.^.^.^.^.^.....^.^.^...................
.............................................................................................................................................
..................^.^.^.^.....^.^.^...^.^.^.^.^...^.^...^...^.^.^.^.^.....^.^.....^.^.^.^...^...^.^...^...^.^.^...^.^...^.^..................
.............................................................................................................................................
.................^.^.^.^.^.^...^...^...^.^.^.^.^.....^...^.^.^.^.^.^...^.^.^...^.^.^...^.^...^...^...^.^.....^.^.^.^...^.^.^.................
.............................................................................................................................................
................^.....^...^.^.^.^.^...^.^.^.^...^.^...^.^.^.......^.^.^.....^.^.^.^.^.^...^...^.^...^.^.....^.^.^.^.^.^.^.^.^................
.............................................................................................................................................
...............^...^.^.^...^.^.......^.^...^.^...^.^...^.....^...^.^.^.^...^...^.^.^.^.^...^...........^.^.^.^.^.^.....^.^.^.^...............
.............................................................................................................................................
..............^.^.^.....^.^.....^.^.^.^.^...^.^.^.^.^.^.^...^.^.^...^...^.^...^.^.^.^.^.^...^.^.^...^.^.^.^.^.^.^.^.^...^.^.^.^..............
.............................................................................................................................................
.............^...^.......^.....^.^...^...^.^.^.^.^...^.^...^...^.^.^...^.^.^.^.^.^...^.^.^.^.....^.^...^.^.......^.^.^.^...^.^.^.............
.............................................................................................................................................
............^.^.^.^...^.^...^...^.^.^.^.^.^.^.^.^.^...^...^.^.^.^.^.^.^.^.^...^.^.^.^.....^.^.^.^.^.^.^.^.^.^.^...^...^.^...^.^.^............
.............................................................................................................................................
...........^.^...^.....^.......^...^.^.....^...^.^.^.^.^.^.^...^.^.^.^.^.^.^...^.^.^...^.^.^.^.^.....^.^.^.^.^.^...^.^.^.^.....^.^...........
.............................................................................................................................................
..........^.......^...^.....^...^...^.^...^.^...^...^.^.^.^.^.^.^.....^.....^...^.^.^.^.^...^.^.^...^.....^.^.^.^.....^...^.^.....^..........
.............................................................................................................................................
.........^.......^.^.^.^.^.^.^...^.....^.^.^.^.^.^.^.....^...^.^.^.....^.^...^.^.^...^.^.^.^.^.^.^...^.^...^.^...^...^.^.^...^...^.^.........
.............................................................................................................................................
........^.^.^.^.....^.^.^.^.......^.^.^...^.......^.....^...^.....^.^.^...^...^.^...^...^.^.^.^.....^.^.....^.^.^.^.^.^.^.^...^.....^........
.............................................................................................................................................
.......^.^.^.^.^.....^...^.^.....^...^.^.^...^.^.^.^.^.^.^...^.^.^.^.^.^.^...^.^...^.^.^.^.^.^...^.^.^.^.^.^...^.^...^.^.^...^.^.^.^.^.......
.............................................................................................................................................
......^.^...^.^.....^.^.....^.^.^.....^.^.^.^...^.^...^...^...^...^.^...^.....^.^...^.^.^.^...^.^.^...^.^.^.^...^.^.^.^...^...^.....^.^......
.............................................................................................................................................
.....^.^.^.^...^.^.^...^.^.....^.^...^.^...^...^.^.^.^...^.^...^...^.^.^.^.....^...^.^.^...^...^.^.^...^.^...^.^.^...^.^.^.^.^.^.^.^.^.^.....
.............................................................................................................................................
....^...^.^.^.^...^...^.^.^.......^.^...^.^...^.^.^...^.^...^.^.^.^.^.^.^.^.^...^...^.^...^.^.^.^.^.^.^.^...^.^...^...^.^.^...^.^.^.^.^.^....
.............................................................................................................................................
...^...^.^.^.^.^.^.^.^.^...^.^...^.^.^...^...^.^...^.^.....^...^.^.^.^...^...^.^.^.^.^.^.^...^.^.^...^.^.^.....^...^...^.^.^.^.^.^.^.^.^.^...
.............................................................................................................................................
..^...^.^.^.^.^.^.^...^.^.^.^.^.^.^...^.^.^.^.^...^...^.^.^.^...^...^.^.....^.^.^...^.^.^.....^...^.^.^.^.^.^...^...^.^.^...^.^.^.^.....^.^..
.............................................................................................................................................
.^.^.^.^.^.^.^...^...^.^.^.^.^...^.^.^.^.....^...^...^.^.^.^.^.^.....^.....^...^.^.^.^.^.^...^...^.^.^.^...^.^.^...^.^.^...^.......^.^...^.^.
.............................................................................................................................................

16
2025/Day7/test Normal file
View File

@@ -0,0 +1,16 @@
.......S.......
...............
.......^.......
...............
......^.^......
...............
.....^.^.^.....
...............
....^.^...^....
...............
...^.^...^.^...
...............
..^...^.....^..
...............
.^.^.^.^.^...^.
...............

121
2025/Day8/Day8.lua Normal file
View File

@@ -0,0 +1,121 @@
-- Advent of Code 2025 - Day 8 - Bas Grolleman
require("functions")
-- Variables
local boxes = {}
local inputfile = "Day8/test"
local limit = 11
function distance(p1, p2)
return math.sqrt((p2.x - p1.x) ^ 2 + (p2.y - p1.y) ^ 2 + (p2.z - p1.z) ^ 2)
end
function boxes.find(id)
for i, box in ipairs(boxes) do
if box.id == id then
return box
end
end
end
local id_counter = 0
for line in io.lines(inputfile) do
local x, y, z = line:match("(%d+)%,(%d+)%,(%d+)")
id_counter = id_counter + 1
local box = {
id = id_counter,
x = tonumber(x),
y = tonumber(y),
z = tonumber(z),
xyz = x .. "," .. y .. "," .. z,
}
table.insert(boxes, box)
end
local distance_table = {}
for i, box1 in ipairs(boxes) do
for j, box2 in ipairs(boxes) do
if box1.id ~= box2.id then
table.insert(distance_table, {
id1 = box1.id,
id2 = box2.id,
d = distance(box1, box2),
})
end
end
end
table.sort(distance_table, function(a, b)
return a.d < b.d
end)
local circuit = 0
for i, dt in ipairs(distance_table) do
box1 = boxes.find(dt.id1)
box2 = boxes.find(dt.id2)
if limit > 0 then
io.write(string.format("%2d Linking %2d <-> %2d %.0f", limit, box1.id, box2.id, dt.d))
if box1.c == nil and box2.c == nil then
circuit = circuit + 1
box1.c = circuit
box2.c = circuit
limit = limit - 1
print(" C=" .. circuit .. " BOTH")
elseif box1.c ~= nil and box2.c ~= nil then
if box1.c == box2.c then
print(" C=" .. box1.c .. " ALREADY")
else
-- Oh look, we merge 2 circuits!
print(" Merging " .. box1.c .. " and " .. box2.c)
local remove = box2.c
for k, uc in ipairs(boxes) do
if uc.c == remove then
uc.c = box1.c
end
end
limit = limit - 1
end
elseif box1.c == nil then
box1.c = box2.c
limit = limit - 1
print(" C=" .. box1.c .. " HOOK BOX1")
elseif box2.c == nil then
box2.c = box1.c
limit = limit - 1
print(" C=" .. box1.c .. " HOOK BOX2")
end
end
end
for k, box in ipairs(boxes) do
if box.c == nil then
circuit = circuit + 1
box.c = circuit
end
end
table.sort(boxes, function(a, b)
return a.c < b.c
end)
local lc = 0
local circuit_size = {}
for k, box in ipairs(boxes) do
if lc ~= box.c then
circuit_size[box.c] = 1
print()
else
circuit_size[box.c] = circuit_size[box.c] + 1
end
print(string.format("Box %2d Circuit %2d", box.id, box.c))
lc = box.c
end
print()
local circuit_size2 = {}
for k, v in pairs(circuit_size) do
circuit_size2[#circuit_size2 + 1] = v
end
table.sort(circuit_size2, function(a, b)
return b < a
end)
print_table(circuit_size2)
local total = circuit_size2[1] * circuit_size2[2] * circuit_size2[3]
print("Total size " .. total)

1000
2025/Day8/full Normal file

File diff suppressed because it is too large Load Diff

20
2025/Day8/test Normal file
View File

@@ -0,0 +1,20 @@
162,817,812
57,618,57
906,360,560
592,479,940
352,342,300
466,668,158
542,29,236
431,825,988
739,650,466
52,470,668
216,146,977
819,987,18
117,168,530
805,96,715
346,949,466
970,615,88
941,993,340
862,61,35
984,92,344
425,690,689

38
2025/Day9/Day9.lua Normal file
View File

@@ -0,0 +1,38 @@
-- Advent of Code 2025 - Day 9 - Bas Grolleman
require("functions")
local filename = "Day9/full"
local grid = {}
for line in io.lines(filename) do
local y, x = line:match("(%d+),(%d+)")
table.insert(grid, {
x = x,
y = y,
})
end
function size(p1, p2)
width = math.abs(p1.x - p2.x) + 1
height = math.abs(p1.y - p2.y) + 1
-- print(p1.x .. "," .. p1.y)
-- print(p2.x .. "," .. p2.y)
-- print(width .. " " .. height .. " " .. (width * height))
return width * height
end
testsize = size({ y = 2, x = 5 }, { y = 9, x = 7 })
print("Testing size function 24=" .. testsize)
local distance = {}
local biggest = 0
for k1, p1 in ipairs(grid) do
for k2, p2 in ipairs(grid) do
if k1 ~= k2 then
local cs = size(p1, p2)
if biggest < cs then
biggest = cs
end
end
end
end
print(biggest)

496
2025/Day9/full Normal file
View File

@@ -0,0 +1,496 @@
97729,50076
97729,51296
98101,51296
98101,52489
97579,52489
97579,53685
97384,53685
97384,54923
97657,54923
97657,56098
97277,56098
97277,57409
97852,57409
97852,58618
97645,58618
97645,59701
96827,59701
96827,60852
96428,60852
96428,62206
96833,62206
96833,63257
96052,63257
96052,64547
96106,64547
96106,65579
95339,65579
95339,66656
94752,66656
94752,67793
94338,67793
94338,68893
93832,68893
93832,70114
93592,70114
93592,71373
93395,71373
93395,72293
92512,72293
92512,73343
91897,73343
91897,74242
91030,74242
91030,75264
90388,75264
90388,76716
90396,76716
90396,77746
89728,77746
89728,78469
88640,78469
88640,79328
87763,79328
87763,80435
87203,80435
87203,81197
86222,81197
86222,82422
85771,82422
85771,83450
85076,83450
85076,83997
83888,83997
83888,84863
83033,84863
83033,85583
82044,85583
82044,86146
80930,86146
80930,87054
80114,87054
80114,88207
79476,88207
79476,88953
78507,88953
78507,89100
77121,89100
77121,89998
76268,89998
76268,90730
75296,90730
75296,91491
74334,91491
74334,91877
73156,91877
73156,92965
72355,92965
72355,93193
71101,93193
71101,93307
69814,93307
69814,94481
69003,94481
69003,94404
67654,94404
67654,94590
66433,94590
66433,94972
65291,94972
65291,95684
64252,95684
64252,95764
63015,95764
63015,96481
61954,96481
61954,97016
60830,97016
60830,96824
59544,96824
59544,96933
58333,96933
58333,97466
57193,97466
57193,97519
55974,97519
55974,98063
54809,98063
54809,98051
53581,98051
53581,97553
52334,97553
52334,97651
51130,97651
51130,98457
49921,98457
49921,98089
48703,98089
48703,98198
47477,98198
47477,98066
46261,98066
46261,98211
45018,98211
45018,97340
43893,97340
43893,96940
42731,96940
42731,97610
41387,97610
41387,97167
40227,97167
40227,96442
39144,96442
39144,96129
37976,96129
37976,96233
36690,96233
36690,95418
35669,95418
35669,95333
34422,95333
34422,94652
33380,94652
33380,94747
32041,94747
32041,93698
31163,93698
31163,93766
29805,93766
29805,93324
28661,93324
28661,92231
27853,92231
27853,91580
26833,91580
26833,90938
25812,90938
25812,90666
24561,90666
24561,90109
23472,90109
23472,89249
22587,89249
22587,88900
21338,88900
21338,87845
20608,87845
20608,86871
19836,86871
19836,86651
18433,86651
18433,85795
17555,85795
17555,85033
16590,85033
16590,83979
15910,83979
15910,82931
15244,82931
15244,82259
14177,82259
14177,81450
13244,81450
13244,79962
13133,79962
13133,79066
12324,79066
12324,78215
11445,78215
11445,77562
10264,77562
10264,76568
9545,76568
9545,75571
8826,75571
8826,74348
8484,74348
8484,73127
8174,73127
8174,71929
7853,71929
7853,71119
6768,71119
6768,70177
5898,70177
5898,69010
5503,69010
5503,67775
5291,67775
5291,66490
5254,66490
5254,65440
4588,65440
4588,64229
4390,64229
4390,63161
3719,63161
3719,61906
3707,61906
3707,60884
2748,60884
2748,59625
2777,59625
2777,58428
2533,58428
2533,57250
2158,57250
2158,56013
2166,56013
2166,54801
2012,54801
2012,53548
2396,53548
2396,52345
2224,52345
2224,51147
1656,51147
1656,50072
94821,50072
94821,48704
1947,48704
1947,47473
1714,47473
1714,46314
2606,46314
2606,45085
2429,45085
2429,43818
2078,43818
2078,42673
2686,42673
2686,41423
2588,41423
2588,40315
3254,40315
3254,39122
3467,39122
3467,37842
3353,37842
3353,36687
3756,36687
3756,35489
4009,35489
4009,34425
4674,34425
4674,33261
5026,33261
5026,32299
5893,32299
5893,30932
5763,30932
5763,29853
6339,29853
6339,28853
7065,28853
7065,27792
7653,27792
7653,26722
8221,26722
8221,25751
8958,25751
8958,24347
8992,24347
8992,23553
10012,23553
10012,22792
11043,22792
11043,21448
11249,21448
11249,20320
11784,20320
11784,19298
12470,19298
12470,18383
13291,18383
13291,17538
14186,17538
14186,16973
15368,16973
15368,16305
16413,16305
16413,15189
17016,15189
17016,14061
17635,14061
17635,13278
18578,13278
18578,12499
19523,12499
19523,11649
20413,11649
20413,11087
21522,11087
21522,10687
22731,10687
22731,9652
23501,9652
23501,8892
24469,8892
24469,8416
25611,8416
25611,7694
26607,7694
26607,7717
27999,7717
27999,7221
29101,7221
29101,5974
29857,5974
29857,6014
31208,6014
31208,5324
32237,5324
32237,4797
33341,4797
33341,4546
34545,4546
34545,4275
35734,4275
35734,3822
36867,3822
36867,3473
38033,3473
38033,3316
39245,3316
39245,3285
40478,3285
40478,2410
41549,2410
41549,2176
42752,2176
42752,2354
44009,2354
44009,2339
45230,2339
45230,1651
46396,1651
46396,2515
47668,2515
47668,2238
48866,2238
48866,1731
50077,1731
50077,1760
51300,1760
51300,2114
52505,2114
52505,1767
53751,1767
53751,2525
54904,2525
54904,2175
56169,2175
56169,2272
57390,2272
57390,2287
58630,2287
58630,2843
59770,2843
59770,3189
60941,3189
60941,3339
62161,3339
62161,3636
63346,3636
63346,4379
64394,4379
64394,4452
65650,4452
65650,5365
66612,5365
66612,5912
67693,5912
67693,6101
68922,6101
68922,6848
69911,6848
69911,7300
71030,7300
71030,7134
72478,7134
72478,8240
73266,8240
73266,8910
74277,8910
74277,8894
75713,8894
75713,9778
76601,9778
76601,10262
77753,10262
77753,11519
78351,11519
78351,12051
79472,12051
79472,12886
80361,12886
80361,13859
81126,13859
81126,14157
82487,14157
82487,15284
83106,15284
83106,15908
84201,15908
84201,17230
84585,17230
84585,18173
85341,18173
85341,18808
86452,18808
86452,19633
87364,19633
87364,20943
87663,20943
87663,21458
89000,21458
89000,22587
89520,22587
89520,23435
90448,23435
90448,24516
91031,24516
91031,25468
91826,25468
91826,26924
91732,26924
91732,27979
92322,27979
92322,28858
93275,28858
93275,29960
93800,29960
93800,31074
94298,31074
94298,32188
94798,32188
94798,33493
94789,33493
94789,34651
95141,34651
95141,35573
96241,35573
96241,36887
96106,36887
96106,38070
96380,38070
96380,39184
96949,39184
96949,40315
97514,40315
97514,41545
97610,41545
97610,42787
97591,42787
97591,44060
97244,44060
97244,45256
97407,45256
97407,46404
98233,46404
98233,47631
98240,47631
98240,48860
98007,48860
98007,50076

8
2025/Day9/test Normal file
View File

@@ -0,0 +1,8 @@
7,1
11,1
11,7
9,7
9,5
2,5
2,3
7,3

View File

@@ -4,8 +4,9 @@ vim.api.nvim_create_autocmd("BufWritePost", {
group = vim.api.nvim_create_augroup("AutoRunCode", { clear = true }), group = vim.api.nvim_create_augroup("AutoRunCode", { clear = true }),
pattern = "*.lua", pattern = "*.lua",
callback = function() callback = function()
local bufnr = 21 local day = 12
vim.fn.jobstart({ "lua", "Day5/Day5.lua" }, { local bufnr = 43
vim.fn.jobstart({ "lua", "Day" .. day .. "/Day" .. day .. ".lua" }, {
stdout_buffered = true, stdout_buffered = true,
on_stdout = function(_, data) on_stdout = function(_, data)
if data then if data then

40
2025/functions.lua Normal file
View File

@@ -0,0 +1,40 @@
function file_lines_to_table(filename)
local file = {}
for line in io.lines(filename) do
table.insert(file, line)
end
return file
end
function file_characters_to_table(filename)
local file = {}
for line in io.lines(filename) do
local lineelements = {}
for I = 1, string.len(line) do
c = string.sub(line, I, I)
table.insert(lineelements, c)
end
table.insert(file, lineelements)
end
return file
end
function tablelength(T)
local count = 0
for _ in pairs(T) do
count = count + 1
end
return count
end
function print_table(t, indent)
indent = indent or ""
for k, v in pairs(t) do
if type(v) == "table" then
print(indent .. k .. ":")
print_table(v, indent .. " ")
else
print(indent .. k .. ": " .. tostring(v))
end
end
end