mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
28 lines
412 B
HCL
28 lines
412 B
HCL
variable "grid" {
|
|
type = list(string)
|
|
}
|
|
|
|
variable "x" {
|
|
type = number
|
|
}
|
|
|
|
variable "y" {
|
|
type = number
|
|
}
|
|
|
|
variable "dx" {
|
|
type = number
|
|
}
|
|
|
|
variable "dy" {
|
|
type = number
|
|
}
|
|
|
|
locals {
|
|
word = join("", [for i in range(4) : var.x + i * var.dx >= 0 ? try(substr(var.grid[var.y + i * var.dy], var.x + i * var.dx, 1), "F") : "F"])
|
|
}
|
|
|
|
output "found" {
|
|
value = contains(["SAMX", "XMAS"], local.word) ? 1 : 0
|
|
}
|