summaryrefslogtreecommitdiff
path: root/simspace/README.md
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2018-06-29 19:36:08 -0700
committerBen Sima <ben@bsima.me>2018-06-29 19:36:08 -0700
commite81da383d908d4b7597cb73dc489f5162fcf19bf (patch)
treec4ac7ea73b180a533937cb26787ce4f095a690b7 /simspace/README.md
parent66e6b47737a9e6411f430a5cd169315f04dcd078 (diff)
Add simspace
Theres a bug, need Wolfram's book to get into the math of it, I can't find a good explanation of the actual math anywhere (the wikipedia page is pretty bad)
Diffstat (limited to 'simspace/README.md')
-rw-r--r--simspace/README.md35
1 files changed, 35 insertions, 0 deletions
diff --git a/simspace/README.md b/simspace/README.md
new file mode 100644
index 0000000..d97846e
--- /dev/null
+++ b/simspace/README.md
@@ -0,0 +1,35 @@
+We're going to simulate "Rule 110", which is essentially a way of turning one
+string of bits into another string of bits. (You won't need any background
+knowledge to complete the problem, but if you're curious, check out
+https://en.wikipedia.org/wiki/Rule_110)
+
+The program should take one argument N on the command line, and should then
+display a possibly-infinite sequence of rows of N digits each. A digit may be
+either zero or one.
+
+Create the first row randomly. Then, to construct the digit at position x of row
+y, consider the digits at positions (x-1), x, and (x+1) of row (y-1), and select
+the new digit according to the following table:
+
+| Pattern | New Digit for Center Cell |
+| ------- | ------------------------- |
+| 111 | 0 |
+| 110 | 1 |
+| 101 | 1 |
+| 100 | 0 |
+| 011 | 1 |
+| 010 | 1 |
+| 001 | 1 |
+| 000 | 0 |
+
+Wrap around at the edges, so the pattern for position 1 is obtained by looking
+at positions N, 1, and 2.
+
+Stop after printing a row consisting entirely of zero or ones. Note that
+depending on your random initial row, this might never happen!
+
+For example, if N is 3, an example run might be:
+
+001
+011
+111