Tag Info

Hot answers tagged

11

Unfortunately, the approach of using Apply[Plus, Flatten[nbhd]] is fatal to your algorithm because summing up the cell-values introduces ambiguities. As an example take these rules from your excel file (White (0), Red (1) and Black (2)). This is in the Excel-file at A43: {{2,2,2},{2,2,0},{0,0,0}} -> 2 And this is in A179: {{1,1,1},{1,2,1},{1,1,1}} ...


9

Conway's game of life is a 2D, two-state, outer totalistic, cellular automaton. I guess the natural thing is to try such CAs in 3D. Here's the evolution of one such CA: twos = Array[2 &, {3, 3}]; twosWithOne = twos; twosWithOne[[2, 2]] = 1; outerTotalisticCA3D[ruleNumber_Integer, duration_Integer, init_List] := CellularAutomaton[ {ruleNumber, ...


8

This is a sample problem that I hope can be helpful; a fire that can spread in four directions (the Von Neumann neighborhood). Only trees can catch fire though. A typical fire looks like this: Any of the methods below can generate it. There appears to be a name collision between method 1 and 2, so you may need to restart the kernel before you can try the ...


7

Given the rule as explained by Halirutan... If the number of Red cells is equal to the number of Black cells, then the center cell gets White. Otherwise the center gets the color Red, if we have more Red cells and Black if we have more Black cells. ...it's interesting to note how things work if we use the following mapping of colours to numbers: ...


5

Here's a way to model @Anon's forest fire with image processing. ImageFilter is not very fast, of which the documentation warns you. However it's acceptable, especially because it makes a nice Dynamic animation. Perhaps it could be adapted - certainly if any of Anon's methods can - to the OP's question. One difference is that in the OP's problem, the ...


4

Here's a code that seems a bit more in the functional-programming spirit of Mathematica. I divide the tree into active and inactive components to save time that might be wasted updating already-fruited branches. Then I can use a very simple rule to grow the tree. I use a Sow/Reap to quickly scan the tree for collided branches. root={{},{{e},{w}}}; ...


3

More an extended comment than a complete answer or "how to". Vialiy's comment and the few pages Stephen Wolfram writes on the subject in A New Kind of Science, certainly provide a good place to start. Adding some basic understanding of types of participants might improve your chances of analyzing this problem with CellularAutomaton. Within any ...


3

The "rule" for CAs defines the mapping that is used to calculate successive generations. When you have 3-neighborhoods (one to each side of the current element) there are 8 patterns that can occur: 111, 110, 101, 100, 011, 010, 001, 000. Each of these patterns must be mapped to some binary value. For example the rule that takes 111->0, 110->0, 101->0, ...


3

According to this Wikipedia entry (also A New Kind of Science), the number system used by CellularAutomaton is called Wolfram Code. Inspired by the 1D system, this is how I think the 2D system works. First we generate all 2D 9-neighbor cases: baseSet = Tuples[{1, 0}, {3, 3}]; Then we apply the transformation rules on the baseSet one-by-one, and combine ...


3

No, the CelluluarAutomaton command works is specifically designed to model cellular automata on grids. It's certainly feasible to roll your own, though. Your example using GraphPlot3D I generated the following graph using your code. rules = {1 -> 5, 1 -> 1, 1 -> 8, 1 -> 6, 1 -> 2, 2 -> 5, 2 -> 2, 2 -> 7, 2 -> 7, 2 -> 5, 3 ...


2

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]


2

Please read Documentation HERE - especially Details section and all the examples. Not enough specification: is it general, totalistic or outer totalistic rule CA? What is the rule? By 4 neighbors you mean Von Neumann neighborhood? 100 colors are too many - hard to find interesting rules. Perhaps you want continuos color CA? Well, assuming Von Neumann ...


2

Here is a visualization of what bill s told: GraphicsRow[ GraphicsColumn[ {Style[2^#, Medium], ArrayPlot[ {#, {0, CellularAutomaton[30, #, {{1}, {1}}][[1, 1]], 0}}, Mesh -> All] &@IntegerDigits[#, 2, 3]} ] & /@ Range[0, 7]] First row of cells represents eight 3-bit binary values from 0 to 7. The middle cell ...


1

My final solution After working on the code a little bit more, I've come up with a much better way to tackle the problem that I will leave here for posterity First I define the size of the simulation, create the seed and launch kernels if they aren't already running. (*Define some variables, generate the seed and launch the kernels.*) gridSize = 50; ...


1

Is this what you want? MatrixPlot /@ CellularAutomaton[{100 (4 (100 - 1) + 1), {100, 1}, {1, 1}}, Table[RandomInteger[], {20}, {20}], 1]


1

The answer is "yes," any function you can represent in a computer can also be represented by a cellular automata. This is because some CAs are "universal Turing machines," which means that anything that can be computed algorithmically can be computed by the CA. Perhaps the best known example is a CA called the game of life. This is only an existence ...



Only top voted, non community-wiki answers of a minimum length are eligible