Crates.io | lenia_ca |
lib.rs | lenia_ca |
version | 0.1.1 |
source | src |
created_at | 2023-05-28 16:42:25.303739 |
updated_at | 2023-05-31 19:27:05.410524 |
description | A library for simulating the Lenia system of cellular automata. |
homepage | |
repository | |
max_upload_size | |
id | 876605 |
size | 301,372 |
This crate has the core functionality for simulating the Lenia system of cellular automata. For more comprehensive documentation, please visit the docs.rs page for this crate.
At the time of publishing of this repository and crate, docs.rs does not allow embedding of images (not easily, anyways) in the documentation, and as a result, below are a few graphics viewable on Github showing the working principle of the two types of Lenia that the lenia_ca
crate is able to simulate.
StandardLenia
is the following:channel
and kernel
of the convolution_channel
growth_function
of the convolution_channel
.dt
and added onto the original values in the channel
.0..1
. This result is the next time-step of the channel
, and would be used as the next iteration's channel
values.use set_kernel()
to change how the kernel looks.
use set_growth_function()
to set a specific growth function for the convolution result.
use set_dt()
to change the integration-step of the simulation.
ExpandedLenia
is the following:convolution_channel
, perform a convolution operation (implemented as a FFT-based convolution) between a source channel
and the convolution_channel
's kernel
. Notice how each convolution_channel
takes input from only one channel
.convolution_channel
, pass the convolution results into the growth_function
of the convolution_channel
.channel
, perform an elementwise multiplication between the corresponding convolution_channel
results and weights of the channel
channel
, perform a weighted-sum on the results of the weight-convolution multiplicated results.channel
, multiply the weighted-sum by the integration step dt
and add it to the original values in the channel
.channel
, clamp the resulting values to be in range 0..1
. This result is the next time-step of the corresponding channel
, and would be used as the next iteration's channel
values.use set_channels()
to set the number of channels in the simulation.
use set_convolution_channels()
to set the number of kernels and the associated growth functions.
use set_convolution_channel_source()
to set the channel which will be convoluted by a particular kernel.
use set_kernel()
to change how a convolution_channel
's kernel looks like.
use set_growth_function()
to set a specific growth function for the convolution result.
use set_weights()
to set a channel's weights for the corresponding convolution channel results.
use set_dt()
to change the integration-step of the simulation.