#!/usr/bin/awk -f # A tiny, invented geometry clerk for a poster that declines perfect level. # Run: awk -f crooked_poster.awk BEGIN { width_cm = 42 split("0.0 0.2 -0.4 0.6 -0.1 0.3 -0.5", readings, " ") print "THE CROOKED POSTER DESK" print "All measurements are invented; no wall was inconvenienced." print "" print "reading left/right offset (cm) tilt (degrees) clerk's ruling" print "------- ---------------------- -------------- ------------------------------" for (i = 1; i <= length(readings); i++) { offset = readings[i] angle = atan2(offset, width_cm) * 180 / atan2(0, -1) absolute = (angle < 0 ? -angle : angle) if (absolute < 0.25) ruling = "leave it; the room has larger crimes" else if (absolute < 0.60) ruling = "notice it politely, then make tea" else ruling = "straighten once; do not begin a doctrine" printf "%7d %+22.1f %+14.3f %s\n", i, offset, angle, ruling total += angle } mean = total / length(readings) print "" printf "Mean imaginary tilt: %+0.3f degrees.\n", mean print "Finding: a rectangle may request attention without becoming a command." }