Index of /xtras/cells_xtra

Icon  Name                    Last modified      Size  Description
[PARENTDIR] Parent Directory - [DIR] mac/ 2010-02-19 18:48 - [DIR] win/ 2015-09-10 15:38 - [TXT] readme.txt 2011-04-10 23:45 2.1K
Cells Xtra v0.2 (c) 2004 Valentin Schmidt
contact: fluxus@freenet.de

Cells Xtra is probably my least usefull Xtra. It's a scripting Xtra for creating 
cellular automata in director. I had found out that imaging lingo was too slow for exploring 
such automata, especially when using a big "world matrix" and more than 2 states, so I came 
up with this xtra. It's quite simple to use, it only has 2 methods:

----------------------------------------
new()
----------------------------------------
as usual
  
----------------------------------------
step(imageObject, stateCount, ruleList)
----------------------------------------
calculates the next step for the cellular automat and changes the image accordingly.

parameters:
imageObject: 8 bit-image object which only uses the first 'stateCount' colors in the palette. 
             e.g. a 2-state automat only uses paletteIndex(0) (=off) and paletteIndex(1) (=on).

stateCount:  number of states that the cellular automat can have, and therefor also number 
             of different colors that pixels in the image can have. the value of a cell 
             (and the corresponding paletteIndex of the pixel) lies inbetween 0 and 
             (stateCount-1).
             
ruleList:    rule for the automat as lingo list. the nth value in the list describes the state 
             of a cell if the sum of it's 8 neighbour-states is n-1. an automat with sc states
             (=stateCount) therefor needs a rule list with (sc-1)*8 + 1 elements. if the list
             is longer, additional elements will be ignored by the xtra. so, for example, if the
             first value in the ruleList is 0, that means that a cell will have state 0 (off) 
             when the sum of the states of its neighbour cells is 0, or in other words, when all
             its neighbour cells are off.
             
example:
John Conway's Game of Life is a 2-state automat with the rule [ 0, 0, 2, 1, 0, 0, 0, 0, 0 ]. 
to find the next step of a Game of Live-automat call:

cellObj.step(member("canvas").image, 2, [0,0,2,1,0,0,0,0,0])


see demo.dir for example usage.