[ prog / sol / mona ]

prog


The Forced Indentation Of Code

93 2022-05-17 11:24

>>91 >>92
You can take advantage of quadrant symmetry using a coordinate transform. The incoming coordinates of the back lambda are zero-based row and column indices, so the first thing it does is switch from [k, j] to [(abs (- n 1 k)), (abs (- n 1 j))] in a square field of size (- (* 2 n) 1), after which it only has to consider one quadrant because the other three will be symmetrically filled in for free by the coordinate transform. The remaining task is to assign zero-based class numbers to the quarter-cross shapes that should be painted with the same character, then use the class number as a cycling index into the chosen string of characters. A moment of reflection will show that after the coordinate transform the class number of any point is simply the smaller of its two coordinates.

267


VIP:

do not edit these