Created
May 18, 2016 01:28
-
-
Save tusharm/2c22a6858e19eeca475db5761836f0ee to your computer and use it in GitHub Desktop.
Daily.Prog.213
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Data.List | |
xor :: [Char] -> Char | |
xor ['x',_,'x'] = '.' | |
xor ['.',_,'.'] = '.' | |
xor [_,_,_] = 'x' | |
transform xs = unlines $ take 25 $ iterate step xs | |
step xs = map xor $ map (take 3) (filter (\x -> length(x) >= 3) $ tails $ "." ++ xs ++ ".") | |
main :: IO () | |
main = putStrLn $ transform ".................................................x................................................" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment