aoc2022/d12/draw.awk

21 lines
307 B
Awk
Raw Permalink Normal View History

2022-12-14 00:18:14 +00:00
BEGIN { print "P2"
print "81 41"
print "25"
}
{
split($0,arr,"")
r = ""
#for (a in arr) {
# print a, arr[a]
#}
#nextfile
for (i=1;i<=81;i++) {
c = arr[i]
if (c == "S") { v = 0 }
else if (c == "E") { v = 25 }
else { v = index("abcdefghijklmnopqrstuvwxyz", c)-1 }
r = r " " v
}
print r
}