adventofcode2022/day10/sol.ivy

17 lines
289 B
XML

) get "input.ivy"
op run ins =
((1 + ins != 0), 0) sel +\ 1, ins
op signal xs =
n = rho xs
i = (20 == (iota n) mod 40) sel iota n
+/ xs[i] * i
op render xs =
px = 2 > abs xs - ((-1 + iota rho xs) mod 40)
6 40 rho '.#'[1 + px]
signal run input
render run input