Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to define a new Cellular Automata rule as follows

{{1, _, 1} -> 0, {1, _, 0} -> 1, {0, _, 1} -> 1, {0, _, 0} -> 0}

where _ represents Blank in mathematica.

How can I code this in mathematica?

share|improve this question

closed as unclear what you're asking by Pickett, Öskå, RunnyKine, rasher, m_goldberg Jun 11 at 22:34

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

It's odd that examples using rules such as these haven't been included in the docs. Anyway, you just have to plug it in and go:

init = RandomChoice[{0, 0, 0, 1}, 100];
ArrayPlot@CellularAutomaton[{
{1, _, 1} -> 0, {1, _, 0} -> 1, {0, _, 1} -> 1, {0, _, 0} -> 0
}, init, 50]

automaton result

share|improve this answer
    
Thank you. I actually want to convert ElementaryRule [num_Integer] := IntegerDigits[num, 2, 8] in list form with my above rule asked in the question. Anyway to do this? –  user15883 Jun 10 at 21:45
    
@user15883 I'm sorry I don't follow. You've defined a function ElementaryRule, what do you mean "in list form"? –  Pickett Jun 10 at 21:51
    
@user15883 I'm sorry, I think we should keep it on the site. You can update your question and put more code in it. Actually I would say it's good if you rewrite the question to reflect what you actually want. Another option is to post code to pastebin.com. ElementaryRule is still not used in your code so I don't know how you're currently using it, so I cannot tell you how to replace it with those rules. Also I note that you implemented a cellular automaton yourself. You don't need both your implementation and CellularAutomaton. –  Pickett Jun 10 at 22:12
    
I have pasted the code here pastebin.com/xTTHkAZD –  user15883 Jun 10 at 22:27
    
@user15883 Is this the output you're looking for? ArrayPlot@CAEvolveList[{{1, _, 1} -> 0, {1, _, 0} -> 1, {0, _, 1} -> 1, {0, _, 0} -> 0}, CenterList[103], 50] –  Pickett Jun 10 at 22:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.