fork download
  1. -- http://c...content-available-to-author-only...e.com/questions/49050/tiling-a-2n-by-2n-grid-with-l-shaped-trominoes#59330
  2.  
  3. import Control.Applicative -- not needed in GHC 7.10
  4.  
  5. g n s x y|n<1=[s]|x>k=r<$>g n s(2^n+1-x)y|y>k=r$g n s x$2^n+1-y|0<1=zipWith(++)(h s x y++h"-"k 1)$h"|"1 k++h"+"1 1 where m=n-1;k=2^m;h=g m
  6. f n x=unlines.g n"O"x
  7.  
  8. main=putStr(f 5 10 15)
Success #stdin #stdout 0s 4700KB
stdin
Standard input is empty
stdout
+--++--++--++--++--++--++--++--+
|+-||-+||+-||-+||+-||-+||+-||-+|
||+--+||||+--+||||+--+||||+--+||
+-|+-|-++-|-+|-++-|+-|-++-|-+|-+
+-||+--++--+||-++-||+--++--+||-+
||+-|+-||-+|-+||||+-|+-||-+|-+||
|+-|||+--+|||-+||+-|||+--+|||-+|
+--++-|+-|-++--++--++-|-+|-++--+
+--++-||+--++--++--++--+||-++--+
|+-|||+-|+-||-+||+-||-+|-+|||-+|
||+-|+-|||+--+||||+--+|||-+|-+||
+-||+--++-|-+|-++-|-+|-++--+||-+
+-|+-|-++--+||-++--+||-++-|-+|-+
||+--+|||-+|-+|||-+|-+||||+--+||
|+-||-+||O|||-+|-+|||-+||+-||-+|
+--++--++--++--+||-++--++--++--+
+--++--++--++-|-+|-++--++--++--+
|+-||-+||+-|||+--+|||-+||+-||-+|
||+--+||||+-|+-||-+|-+||||+--+||
+-|+-|-++-||+--++--+||-++-|-+|-+
+-||+--++-|+-|-++-|-+|-++--+||-+
||+-|+-|||+--+||||+--+|||-+|-+||
|+-|||+-|+-||-+||+-||-+|-+|||-+|
+--++-||+--++--++--++--+||-++--+
+--++-|+-|-++--++--++-|-+|-++--+
|+-|||+--+|||-+||+-|||+--+|||-+|
||+-|+-||-+|-+||||+-|+-||-+|-+||
+-||+--++--+||-++-||+--++--+||-+
+-|+-|-++-|-+|-++-|+-|-++-|-+|-+
||+--+||||+--+||||+--+||||+--+||
|+-||-+||+-||-+||+-||-+||+-||-+|
+--++--++--++--++--++--++--++--+