woonie

Untitled

Aug 14th, 2011
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 1.18 KB | None | 0 0
  1. ; I know it's not the most efficient of codes but...
  2.  
  3. ; n is the fixed side-length
  4. ; m is the current count
  5.  
  6. ; maps out both top and bottom of the square                                  
  7. (define (sides n m pic1)
  8.   (if (= m 1)
  9.       (side n pic1)
  10.       (side n (stack-frac (/ 1 n) (side n pic1) (middles n (- m 1) pic1 blank-bb)))))
  11.  
  12. ; maps out all non-top/bottom lines
  13. (define (middles n m pic1 pic2)
  14.   (if (> m 1)
  15.       (stack-frac (/ 1 m) (middle n pic1 blank-bb) (middles n (- m 1) pic1 pic2))
  16.       (sides n 1 pic1)))
  17.  
  18. ; maps out single line on top/bottom
  19. (define (side n pic1)
  20.   (quarter-turn-left(stackn n (quarter-turn-right pic1))))
  21.  
  22. ; maps out single line on non-top/bottom
  23. (define (middle n pic1 pic2)
  24.   (quarter-turn-left (stack-frac (/ 1 n) (quarter-turn-right pic1) (empty n (- n 1) pic1 pic2))))
  25.                                              
  26. ; maps out blank space in single non-top/bottom line
  27. (define (empty n m pic1 pic2)
  28.   (if (= m 1)
  29.       (quarter-turn-right pic1)
  30.       (stack-frac (/ 1 m) pic2 (empty n (- m 1) pic1 pic2))))
  31.  
  32. ; from persian input
  33. (define (persian-hole pic n)
  34.   (sides n n pic))
  35.  
  36. (show (persian-hole (make-cross rcross-bb) 5))
Advertisement
Add Comment
Please, Sign In to add comment