Repotomata.Rule
— TypeAn automata rule
The rule is applied to all the image pixel for each epoch.
Fields
neighbours
: the pixels (relative positions) observered when applying the contidtion.condition
: this function is called for each pixel and must return the new color.extent
: the image padding needed by the neighbours.
Repotomata.Rule
— MethodRule(neighbours, condition)
The rule constructor. It will automatically create the extent
.
Repotomata.getcolor
— Methodgetcolor(rule, image, position)
Computes the colors of the neighbours around position
. Calls the rule
's condition function and return its result.
Repotomata.chromatic_rule
— Methodchromatic_rule(palette, background_color)
Create a "Chromatic rule" with the following condition:
if current == background_color
3 OR 4 neighbours ≠ background_color > neighbours' color of the "smaller" in the palette
else > background_color
else
7 OR 8 neighbours ≠ background_color > background_color
3 OR 4 neighbours ≠ background_color > current
1 OR 2 neighbours ≠ background_color > previous color in palette or reset to the middle
5 OR 6 neighbours ≠ background_color > next color in palette or reset to the middle
Repotomata.game_of_life
— Methodgame_of_life(color, background_color)
Create a "Game of life rule" with the following condition:
if current = background_color && 3 neighbours ≠ background_color > color
if current ≠ background_color && 2 OR 3 neighbours ≠ background_color > color
else > background_color