Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

FUQIN ABSTRACT BULLSHITE

Name: Anonymous 2007-10-09 13:46

EADYBEENANSWEREDIN>>3,4,10
R                        
L ULLSHITE''THATYOUWILLN 
A B                    E 
S T STHEWAYYOUWANTTHEM V 
A C R                T E 
H A E WHATAMANPAGEIS O R 
G R W W            S B C 
N T S O RGODFUCKIG E E O 
I S N N E        N C T M 
H B A K M INANGE D O H P 
T A L N M Q    R A N I R 
Y ` U I A U OK E M D R E 
R ` F Q R F  A D N L D H 
E D E U G UOYY A F Y L E 
V N S F O      N I , Y N 
E A U T RPTREPXE R T P D 
T Y D N          S H R A 
Y H N ODUOY,LLAFOT I O N 
H P A              S G D 
S O MEDTONOD/gorp/SI R F 
L S                  A U 
L OLIHPTUOBALLASIGNIMM Q 
U                      I 
BRUOYHTIWFFOKCUF,YLTSALN

Name: Anonymous 2007-10-17 19:00


(require (planet "aif.ss" ("schematics" "macro.plt" 1 0)))

(define (next-direction direction)
  (if (= direction 3) 0 (add1 direction)))

(define (mod-x direction x)
  (cond ((= direction 0) (add1 x))
        ((= direction 2) (sub1 x))
        (else x)))

(define (mod-y direction y)
  (cond ((= direction 1) (sub1 y))
        ((= direction 3) (add1 y))
        (else y)))

(define (get-coordinates str)
  (let loop ((i 0) (direction 0) (places 1) (remain 1) (x 0) (y 0))
    (if (< i (string-length str))
        (cons (cons (cons x y) (substring str i (add1 i)))
              (if (> remain 1)
                  (loop (add1 i) direction places (sub1 remain)
                        (mod-x direction x) (mod-y direction y))
                  (loop (add1 i) (next-direction direction)
                        (+ 2 places) (+ 2 places)
                        (mod-x direction x) (mod-y direction y))))
        '())))

(define (get-spiral str)
  (let* ((coords (get-coordinates str))
         (minx (apply min (map caar coords)))
         (miny (apply min (map cdar coords)))
         (maxx (apply max (map caar coords)))
         (maxy (apply max (map cdar coords))))
    (let loop ((x 0) (y 0))
      (if (< y (add1 (- maxy miny)))
          (if (< x (add1 (- maxx minx)))
              (aif letter (assoc (cons (+ minx x) (+ miny y)) coords)
                (string-append (cdr letter) (loop (add1 x) y))
                (string-append " " (loop (add1 x) y)))
              (string-append "\n" (loop 0 (add1 y))))
          ""))))
;; eg
;; (display (get-spiral "i can feel it coming in the air tonight. oh lawd."))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List