[ prog / sol / mona ]

prog


The Forced Indentation Of Code

35 2022-02-18 12:42

https://en.wikipedia.org/wiki/Sauwastika

The compact swastika can be seen as a chiral irregular icosagon (20-sided polygon) with fourfold (90°) rotational symmetry. Such a swastika proportioned on a 5 × 5 square grid and with the broken portions of its legs shortened by one unit can tile the plane by translation alone.

scheme@(guile-user)> (display ((lambda (rec xjoin reduce symbol home moves cell chars n) ((lambda (xjoin reduce cycle) ((lambda (chars) (xjoin (- (* 2 n) 1) (lambda (k) (string-append (xjoin (- (* 2 n) 1) (lambda (j) (symbol (reduce k j) chars cell cycle)) "") "\n")) "")) (xjoin (* cell cycle) (lambda (k) ((lambda (idx) (substring chars idx (+ idx 1))) (quotient k cell))) ""))) (lambda (n fun sep) (rec xjoin n fun sep "")) (lambda (k j) (rec reduce home moves (- k (- n 1)) (- j (- n 1)) 0)) (string-length chars))) (lambda (f . args) (apply f (cons f args))) (lambda (self n fun sep acc) (if (<= n 0) "" (if (= n 1) (string-append (fun 0) acc) (self self (- n 1) fun sep (string-append sep (fun (- n 1)) acc))))) ((lambda (done last move) (lambda (self home moves k j acc) (if (done k j) (+ acc (last home k j)) (apply (lambda (dk dj) (self self home moves (+ k dk) (+ j dj) (+ acc 1))) (vector-ref moves (move k j)))))) (lambda (k j) (and (<= -2 k) (<= k 2) (<= -2 j) (<= j 2))) (lambda (home k j) (if (logbit? (- 2 j) (vector-ref home (+ k 2))) 1 0)) (lambda (k j) (if (zero? k) (if (positive? j) 1 2) (if (zero? j) (if (positive? k) 0 3) (+ (if (positive? k) 0 1) (if (positive? j) 0 2)))))) (lambda (count chars cell cycle) ((lambda (idx) (substring chars idx (+ idx cell))) (* cell (modulo count cycle)))) #(19 26 0 11 25) #((-3 -2) (2 -3) (-2 3) (3 2)) 2 "█░" 10))
██░░░░░░░░░░████░░██░░██░░░░██████████
██░░██░░████░░░░░░░░░░████░░██░░██░░░░
██████░░░░██░░██░░████░░░░░░░░░░████░░
██░░░░██████████░░░░██░░██░░████░░░░░░
████░░██░░██░░░░██████████░░░░██░░██░░
░░░░░░░░░░████░░██░░██░░░░██████████░░
░░██░░████░░░░░░░░░░████░░██░░██░░░░██
████░░░░██░░██░░████░░░░░░░░░░████░░██
░░░░██████████░░░░██░░██░░████░░░░░░░░
██░░██░░██░░░░██████████░░░░██░░██░░██
░░░░░░░░████░░██░░██░░░░██████████░░░░
██░░████░░░░░░░░░░████░░██░░██░░░░████
██░░░░██░░██░░████░░░░░░░░░░████░░██░░
░░██████████░░░░██░░██░░████░░░░░░░░░░
░░██░░██░░░░██████████░░░░██░░██░░████
░░░░░░████░░██░░██░░░░██████████░░░░██
░░████░░░░░░░░░░████░░██░░██░░░░██████
░░░░██░░██░░████░░░░░░░░░░████░░██░░██
██████████░░░░██░░██░░████░░░░░░░░░░██
scheme@(guile-user)> 

pointwise generation by walking to the home position, for memes over efficiency

old vertical gaps: >>28

267


VIP:

do not edit these