lantunes / cellpylib

A library for working with Cellular Automata, for Python.
https://cellpylib.org
Apache License 2.0
228 stars 31 forks source link

Definition of AsynchronousRule #2

Open mvrozanti opened 5 years ago

mvrozanti commented 5 years ago

First of all thanks for this project, it's been great for beginners such as I who are getting to learn about automata!

I'm trying to understand how the AsynchronousRule works. The demo works nicely but I'm not sure how to configure it to prioritize certain neighbours over others. In the demo, the priority seems ranked by the position of the cell, right?

But what if one wanted to prioritize the neighbourhood by value instead? That is, all the combinations of ranks for the possible neighborhoods of the elementary space, which is a tuple of length 8, each element representing a rank between 1 and 7, inclusive.

I feel like it's still related to update_order parameter, but it's different in the sense that it's not the the same async-update strategy (one is positional and the other is by cell-state). Does this make sense?

lantunes commented 5 years ago

Hi, thanks for the message! If I understand correctly, you'd like the update order to be dynamic, such that it would depend on the values of the cells as the system is evolving. Is that correct? If so, then a new implementation of AsynchronousRule would likely be required. It sounds like we'd need some function that returns the new update order once all the cells have been updated at the end of a cycle. Maybe in _check_for_end_of_cycle, this "get_update_order" function would be invoked (if it is the end of a cycle), supplying the neighbourhoods given to apply_rule during the cycle (so we'd need to keep track of the neighbourhoods given to apply_rule, and clear the memory before the start of a new cycle). But it's difficult to say without more details.

Anyhow, if you would like to provide more information about the CA you're trying to implement, perhaps I can come up some more concrete ideas.