Make tweaks to day 10 code to make it clearer

This commit is contained in:
Danila Fedorin 2022-12-12 10:16:46 -08:00
parent 76705dc6fb
commit efa81418eb
1 changed files with 6 additions and 5 deletions

View File

@ -13,11 +13,12 @@ iter ops() {
}
}
const deltas = ops();
const states = + scan deltas;
const indices = 20..220 by 40;
writeln(+ reduce (states[indices-1] * indices));
const deltas = ops(),
cycles = deltas.size,
states: [1..cycles] int = + scan deltas,
interesting = 20..220 by 40;
writeln(+ reduce (states[interesting] * interesting));
const pixels = [(x, pc) in zip(states[0..<240], 0..)]
const pixels = [(x, pc) in zip(states[1..240], 0..)]
if abs((pc % 40) - x) <= 1 then "#" else " ";
writeln(reshape(pixels, {1..6, 1..40}));