Add fast PropertyLayer implementation of Game of Life #182
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds a fast implementation of Conway's Game of Life using the
PropertyLayer
. Unlike traditional approaches, this version doesn't rely on a grid or agents, making it simpler and more efficient (in this specific case).Key features
PropertyLayer
to track cell states, removing the need for a grid or agents. In this layer, a cell value of 1 means being alive, and 0 means being dead.Performance
As benchmarked in projectmesa/mesa#1898 (comment), this models is incredibly fast, about 100x over a traditional implementation.
Structure
This PR is structures in three commits:
Dependencies
This models needs SciPy for
convolve2d
, which is added to the test dependencies.Future work
It would be nice if the PropertyLayer itself could also be visualized, so that you can see Game of Life patterns. That needs support in Mesa however (or a custom
space_drawer
implemented here).Closes: #166