function inc() { i = (c++%40) printf "%s", (i==x||i==x+1||i==x+2) ? "█" : " " printf "%s", (i==39) ? "\n" : "" } { inc() } $1 == "addx" { inc() x += $2 }