RosettaCodeData/Task/Forest-fire/JAMES-II-Rule-based-Cellular-Automata/forest-fire.james
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

17 lines
411 B
Text

@caversion 1;
dimensions 2;
state EMPTY, TREE, BURNING;
// an empty cell grows a tree with a chance of p = 5 %
rule{EMPTY} [0.05] : -> TREE;
// a burning cell turns to a burned cell
rule{BURNING}: -> EMPTY;
// a tree starts burning if there is at least one neighbor burning
rule{TREE} : BURNING{1,} -> BURNING;
// a tree is hit by lightning with a change of f = 0.006 %
rule{TREE} [0.00006] : -> BURNING;