An open API service indexing awesome lists of open source software.

https://github.com/8nhuman8/nebular-automata

The program for visualizing a probabilistic cellular automata
https://github.com/8nhuman8/nebular-automata

cellular-automata probabilistic-models python stochastic-simulation visualization

Last synced: 5 months ago
JSON representation

The program for visualizing a probabilistic cellular automata

Awesome Lists containing this project

README

          

# Nebular Automata

The program for visualizing a probabilistic cellular automata

![intro_gif](docs/README/intro.gif)

## Table of contents

- [Idea](#idea)
- [Installation](#installation)
- [Usage](#usage)
- [Command-line arguments description](#command-line-arguments-description)
- [Credits and references](#credits-and-references)
- [License](#license)
- [Gallery](#gallery)

## Idea

> The original idea was found [here](https://vk.com/math_dosug?w=wall-149993556_46382), and the author is this [person](https://vk.com/id504076319).

Let a square be surrounded on each side by a new square of the same size with a chance of **q**. Newly formed squares reproduce other squares and so on, to infinity.
We will limit the growth of the population by setting a certain maximum allowable number of squares, upon reaching which the program will be completed.

As you probably noticed when looking at the images [below](#gallery), the edges of the shapes have a different color, into which the initial color smoothly flows. This was done not only to illustrate the process of structure development, but also for greater saturation and prettiness of images.

## Installation

Install/upgrade required packages with `pip install -r requirements.txt --upgrade`.

## Usage

1. Check out all the command-line parameters [below](#command-line-arguments-description).
2. Then you can specify the colors and allowed reproduction directions in the [`config.json`](configs/config.json).
3. Run the `renderer.py` with `python src/renderer.py [parameters you need]`.

## Command-line arguments description

```console
usage: renderer.py [-h] [-sp Y X] [-p FLOAT] [-mc INT] [-minp FLOAT] [-maxp FLOAT] [-rc] [-rbg] [-cn INT] [-s INT] [-o] [-fi] [-t] [-si] [-pi PATH] [-dsi] [-sv]
[-pv PATH] [-vfps INT] [-vs INT] [-sg] [-pg PATH] [-gd INT]
width height

options:
-h, --help show this help message and exit

Required options:
width The width of the image.
height The height of the image.

Basic options:
-sp Y X, --start-point Y X
The coordinate of a starting point. Default value: middle of the image.
-p FLOAT, --probability FLOAT
The probability that a square will multiply in a one direction. Default value: 0.51
-mc INT, --max-count INT
The maximum number of squares in the image. Default value: (width * height) // 2.
-minp FLOAT, --min-percent FLOAT
The program will work until the nebula is filled with a chosen or greater percentage.
-maxp FLOAT, --max-percent FLOAT
The program will work until the nebula is filled with a chosen percentage.

Coloring options:
-rc, --random-colors All colors will be chosen randomly.
-rbg, --random-background
The background color will be chosen randomly.
-cn INT, --colors-number INT
The number of colors to use in the image. Default value: 3. Use with: -rc.

Additional options:
-s INT, --seed INT The program will generate the nebula based on the entered seed. In this case, the generation time is significantly increased.
-o, --opaque All colors will be opaque including background.
-fi, --fade-in Starting color is white. The color of each new generation will fade into the specified color. Use with: -rc -cn 1
-t, --torus The nebula will develop on a grid with toroidal topology.

Image options:
-si, --save-image The rendered image will be saved.
-pi PATH, --path-image PATH
The path where the image will be saved. Default path: output/
-dsi, --dont-show-image
Do not show image in the end.

Video options:
-sv, --save-video The rendered video will be saved.
-pv PATH, --path-video PATH
The path where the video will be saved. Default path: output/
-vfps INT, --video-fps INT
The frame rate of the video. Default value: 60.
-vs INT, --video-size INT
The size of the video in MB to which the size of the original video will be reduced using compression.

GIF options:
-sg, --save-gif The rendered GIF will be saved.
-pg PATH, --path-gif PATH
The path where the GIF will be saved. Default path: output/
-gd INT, --gif-duration INT
The display duration of each frame of the GIF in milliseconds. Default value: 30.
```

## Credits and references

The original idea was found [here](https://vk.com/math_dosug?w=wall-149993556_46382), and the author is this [person](https://vk.com/id504076319).

## License

[Nebular Automata](https://github.com/8nhuman8/nebular-automata) specific code is distributed under [MIT License](https://github.com/8nhuman8/nebular-automata/blob/master/LICENSE).

Copyright (c) 2022 Artyom Bezmenov

## Gallery

![gallery_image_1](docs/README/1.png)
![gallery_image_2](docs/README/2.png)
![gallery_image_3](docs/README/3.png)
![gallery_image_4](docs/README/4.png)