From 781400254cf01bc564ddf96b68a4ba690424a264 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sat, 30 Jun 2018 10:28:21 -0700 Subject: Add comment --- simspace/Main.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'simspace') 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 -- cgit v1.2.3