mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-27 13:50:32 +01:00
day 11 part 1 in terraform
This commit is contained in:
27
2024/bonus/day11/step/main.tf
Normal file
27
2024/bonus/day11/step/main.tf
Normal file
@@ -0,0 +1,27 @@
|
||||
variable "prev" {
|
||||
type = list(number)
|
||||
}
|
||||
|
||||
locals {
|
||||
values = [
|
||||
for num in var.prev : num == 0 ? [1]
|
||||
: length(tostring(num)) % 2 == 0
|
||||
? [tonumber(substr(tostring(num), 0, length(tostring(num)) / 2)), tonumber(substr(tostring(num), length(tostring(num)) / 2, 10))]
|
||||
: [num * 2024]
|
||||
]
|
||||
}
|
||||
|
||||
# module "transform" {
|
||||
# source = "../transform"
|
||||
|
||||
# count = length(var.prev)
|
||||
# num = var.prev[count.index]
|
||||
# }
|
||||
|
||||
# output "next" {
|
||||
# value = flatten(module.transform[*].result)
|
||||
# }
|
||||
|
||||
output "next" {
|
||||
value = flatten(local.values)
|
||||
}
|
||||
Reference in New Issue
Block a user