+-- from https://stackoverflow.com/questions/12659562/insert-specific-element-y-after-every-n-elements-in-a-list
+insert :: Int -> a -> [a] -> [a]
+insert n y xs = countdown n xs where
+ countdown 0 xs = y:countdown n xs
+ countdown _ [] = []
+ countdown m (x:xs) = x:countdown (m-1) xs
+
+stringToSim :: Int -> Int -> [Char] -> Simulation
+stringToSim w h st =
+ _stringToSim st [(x, y) | x <- [0..w-1], y <- [0..h-1]] (initSimSpace w h)
+_stringToSim st grid acc =
+ if null grid || null st then acc
+ else _stringToSim (tail st) (tail grid) next
+ where x = fst $ head grid
+ y = snd $ head grid
+ next = simSet acc (charToChunk $ head st) x y
+