Orasund/elm-cellautomata/3.1.0

NOTE: the latest version is 3.1.1

CellAutomata.New

This module is the new version of the cell automata package.

type alias CellAutomata comparable state =
{ rules : Dict String (List (Rule comparable state))
, neighbors :
comparable
-> List
{ location : comparable
, direction : comparable
}
, groups : Maybe state -> String
}

This type contains the needed information to compute the next step of an automata.

new :
{ rules : List (Rule comparable state)
, neighbors :
comparable
-> List
{ location : comparable
, direction : comparable
}
}
-> CellAutomata comparable state

Construct a new cell automata

CellAutomata comparable state
-> Dict comparable state
-> comparable
-> Maybe state
-> Maybe state

Compute a step using a cell automata

(Maybe state -> String)
-> CellAutomata comparable state
-> CellAutomata comparable state

If you have a lot of rules, it might be good to group them by initial state. To do so, you have to provide a function that map the states to the names of the groups.