adventofcode2022/day10/sol.ivy

17 lines
293 B
Plaintext
Raw Normal View History

2022-12-10 19:46:41 +00:00
) get "input.ivy"
op run ins =
((1 + ins != 0), 0) sel +\ 1, ins
2022-12-10 19:52:08 +00:00
op signal xs =
cycle = iota rho xs
i = (20 == cycle mod 40) sel cycle
2022-12-10 19:46:41 +00:00
+/ 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