summaryrefslogtreecommitdiff
path: root/simspace
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2018-06-30 10:28:21 -0700
committerBen Sima <ben@bsima.me>2018-06-30 10:28:21 -0700
commit781400254cf01bc564ddf96b68a4ba690424a264 (patch)
treefd0810bf5658c804b0d554e31510e18c4c54301b /simspace
parent43e9b23678f297c1983c50a1115ddfce89feed08 (diff)
Add comment
Diffstat (limited to 'simspace')
-rw-r--r--simspace/Main.hs6
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