import System.Random
import Data.List
main
= hSetEncoding stdout utf8
>> mapM_ (christmasTree
>=> putStrLn) [1..7]
ornaments = "*NiXJo%b"
christmasTree h = do
is
<- mapM (flip replicateM
(rollIkasamaDice dist
)) ws
let body
= ["☆"] ++ map (map (ornaments
!!)) is
++ ["||"] where
dist
= 30 : replicate
(length ornaments
- 1) 1 ws = [2, 4 .. (h - 1) * 2]
spacer
= flip replicate
' '
rollIkasamaDice dist = do
r
<- getStdRandom
(randomR
(0, 1)) :: IO Double where
aW1wb3J0IFN5c3RlbS5JTwppbXBvcnQgU3lzdGVtLlJhbmRvbQppbXBvcnQgQ29udHJvbC5Nb25hZAppbXBvcnQgRGF0YS5MaXN0CmltcG9ydCBEYXRhLk1heWJlCgptYWluIDo6IElPICgpCm1haW4gPSBoU2V0RW5jb2Rpbmcgc3Rkb3V0IHV0ZjggPj4gbWFwTV8gKGNocmlzdG1hc1RyZWUgPj0+IHB1dFN0ckxuKSBbMS4uN10KCm9ybmFtZW50cyA6OiBbQ2hhcl0Kb3JuYW1lbnRzID0gIipOaVhKbyViIgoKY2hyaXN0bWFzVHJlZSA6OiBJbnQgLT4gSU8gU3RyaW5nCmNocmlzdG1hc1RyZWUgaCA9IGRvCiAgaXMgPC0gbWFwTSAoZmxpcCByZXBsaWNhdGVNIChyb2xsSWthc2FtYURpY2UgZGlzdCkpIHdzCiAgbGV0IGJvZHkgICA9IFsi4piGIl0gKysgbWFwIChtYXAgKG9ybmFtZW50cyAhISkpIGlzICsrIFsifHwiXQogICAgICBpbmRlbnQgPSByZXZlcnNlICQgbWFwIHNwYWNlciAkIFtoIC0gMV0gKysgbWFwIChgZGl2YCAyKSB3cyArKyBbaCAtIDFdCiAgcmV0dXJuICQgdW5saW5lcyAkIHppcFdpdGggKCsrKSBpbmRlbnQgYm9keQogIHdoZXJlCiAgICBkaXN0ID0gMzAgOiByZXBsaWNhdGUgKGxlbmd0aCBvcm5hbWVudHMgLSAxKSAxCiAgICB3cyAgID0gWzIsIDQgLi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