1   Introduction

This project is about some first and experimental attempts to implement a framework that can be used to more easily implement CAs (cellular automata). The project attempts to achieve the following goals:

  • Enable the CA to run as a process in an OTP supervision tree.
  • Implement the cells (or nodes) in a CA as Erlang processes so that they can model complex behavior and activities.
  • Enable each cell to run in an OTP supervision tree.

In order to do the above:

  • The grid itself will be implemented by a module that uses the gen_ca behavior.
  • Each agent will be implemented by a light-weight supervised process.

[to be continued ...]

Some preliminaries:

  • By default, the grid will be rectangular and will be represented by a list of lists.
  • Each cell of the grid will be implemented by an Erlang process. This will allow us, someday, to make the behavior of individual cells complex, to have cells that run concurrently, and to have different types of cells (each cell type implemented by a different process implementation).

Difficulties and challenges:

  • This support is implemented by implementing a new Erlang OTP behavior that is built on gen_server behavior, which adds difficulty. However, see my Blog post titled "Implement a new Erlang OTP behavior" for help with that.
  • Getting the division of responsibilities between the behavior (gen_ca) and it's clients is difficult. We'd like gen_ca to take work off the client's shoulders, but in order to do that gen_ca has to make assumptions about the shape and representation of the grid, how to walk it, etc., and that reduces flexibility and possible options on the part of the client. See below for some strategies that I used in an attempt to solve this dilemma.

2   Acknowledgements

I learned a lot by studying the organization and the code in the Petri Net library gen_pnet. Thanks much to Jörgen Brandt. You can find gen_pnet here: https://github.com/joergen7/gen_pnet.