blob: 78e6264a1db29d990cc0ac4402cc2c14d58faef6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
{-# OPTIONS_GHC -fno-full-laziness #-}
module Main where
import Control.Monad (unless)
import Data.Time.Clock
import System.IO
data AppState = AppState [Int]
cycleState :: [Int] -> [Int]
cycleState w = filter (check w) w
check :: [Int] -> Int -> Bool
check world pos = pos `elem` world
initialSet :: [Int]
initialSet = [1]
main :: IO ()
main = appLoop 24 (AppState initialSet)
appLoop :: Int -> AppState -> IO ()
appLoop n s
| n == 0 = return ()
| otherwise = do let AppState state = s
print state
appLoop (n-1) $ AppState (cycleState state)
|