adventofcode2022/day10/sol.ivy

17 lines
293 B
XML

) get "input.ivy"
op run ins =
((1 + ins != 0), 0) sel +\ 1, ins
op signal xs =
cycle = iota rho xs
i = (20 == cycle mod 40) sel cycle
+/ 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