diff options
-rw-r--r-- | simspace/Main.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/simspace/Main.hs b/simspace/Main.hs index d187975..891fcf7 100644 --- a/simspace/Main.hs +++ b/simspace/Main.hs @@ -34,6 +34,12 @@ takeWhile' p (x:xs) = x : if p x then takeWhile' p xs else [] compute :: Int -> [Int] -> [Int] compute n state = state ++ compute n (next n state) +-- Here I'm using a sequence-based computation to find the next step. There is +-- an arithmetic way to calculate it, but I can't find a good explanation of the +-- arithmetic online. So, until I get a copy of Wolfram's book, I'll just stick +-- with this; unfortunately I think the source of my bug is in the sequence +-- logic :( + next :: Int -> [Int] -> [Int] next n state = [left, center, right] where |