aoc2022/d10/part2.awk

15 lines
161 B
Awk

function inc() {
i = (c%40)
r = r ((i==x||i==x+1||i==x+2) ? "█" : " ")
if (i == 39) {
print r
r = ""
}
c++
}
{ inc() }
$1 == "addx" {
inc()
x+=$2
}