Jason Cawley
Wolfram Science Group
Phoenix, AZ USA
Registered: Aug 2003
Posts: 712 |
The class 2 glider rules are "fairest" in this sense, since they visit each cell occasionally. But they are also very low total density.
Here is some code for evolving these -
accumulate[list_]:= Rest[FoldList[Plus,0,list]]
step[rule_, maxon_, rowabove_] := Take[Last@CellularAutomaton[rule, rowabove, 1], (If[Length[#] > 0, First[#], #] &@ First@(Position[#, x_ /; x >= maxon] /. {} -> {Length[#]}) &@(accumulate@ Last@CellularAutomaton[rule, rowabove, 1]))]
evolve[rule_, maxon_, start_, t_] := With[{ragged = NestList[step[rule, maxon, #] &, start, t]}, PadRight[#, Max[Length /@ ragged]] & /@ ragged]
score[data_] := Round[100 Length[data[[1]]]*1. (Total /@ Transpose[data])/Total[data, 2]]/ 100.
score2[data_, allowed_] := Round[100 Length[data[[1]]]*1. (Total /@ Transpose[data])/(Length[data]*allowed)]/100.
The first is just a utility function that turns a list into a running total to that point in the list, which is helpful in finding the position of the nth 1.
The step function takes the previous row and calls the CellularAutomaton function for one step. Then it prunes the result by using the Take function, with the amount to take determined where the accumulated list goes over the max number argument.
The evolve function calls step over and over and pads the eventual result out to rectangular, suitable for array plotting and Transpose etc.
The score function counts 1s in each column through time, divides by the total in the whole array. The last bits on the outside are just a way of returning the integer and a couple of digits to the right of the decimal.
The numbers score gives back are thus effectively a "share" relative to a theoretical 1 everywhere if the allowed 1s were distributed perfectly evenly throughout the vertical columns.
You could get a different measure - of potential as well as fairness if you like - by dividing not by the total 1s in the array, but by the max allowed 1s times the number of steps. Then instead of measuring how evenly the 1s visit all the columns, you are doing that but also scaling by how the rule "uses" all the "allowed" 1s or not. Thus the score2 function.
Fine imaginative question. Anything clear enough has an answer.
Report this post to a moderator | IP: Logged
|