Slightly better performance

This commit is contained in:
2024-12-05 22:18:26 +01:00
parent ecfe5e9f20
commit f7af07a631
2 changed files with 4 additions and 3 deletions

View File

@@ -22,8 +22,6 @@ locals {
"UL" = [-1, -1]
"U" = [0, -1]
"UR" = [1, -1]
"L" = [-1, 0]
"R" = [1, 0]
"DL" = [-1, 1]
"D" = [0, 1]
"DR" = [1, 1]

View File

@@ -6,6 +6,9 @@ locals {
grid = split("\n", chomp(var.input))
height = length(local.grid)
width = length(local.grid[0])
lr = length(regexall("XMAS", var.input))
rl = length(regexall("SAMX", var.input))
}
module "check_point" {
@@ -20,7 +23,7 @@ module "check_point" {
}
output "part1" {
value = sum(module.check_point[*].xmas)
value = sum(module.check_point[*].xmas) + local.lr + local.rl
}
output "part2" {