Skip to main content

Lattice gas automata implemented in Python.

Project description

Lattice Gas Cellular Automata

This project contains Python implementation of the popular Lattice Gas Cellular Automata, listed below.

  • HPP
  • FHP I
  • FHP II
  • FHP III

[!WARNING] Work in progress...

Installation

Clone or download current project

git clone https://github.com/siciarek/lgca.git

go to the main project directory

cd lgca

and install it locally (using a Python virtual environment is strongly recommended).

python -m venv .venv
. .venv/bin/activate
pip install '.[dev]'

[!NOTE] The project will be available via PyPI after full implementation of FHP III, at the moment is available only as described above.

Usage

To get some information about the application just run:

lgca --help

and You should see something like below.

pygame 2.5.2 (SDL 2.28.3, Python 3.12.7)
Hello from the pygame community. https://www.pygame.org/contribute.html
Usage: lgca [OPTIONS]

  Lattice Gas Cellular Automata [X] HPP [X] FHP I [X] FHP II [ ] FHP III

Options:
  -v, --value INTEGER RANGE       Content value.  [default: 0; 0<=x<=255]
  -n, --model-name [HPP|FHPI|FHPII|FHPIII|hpp|fhpi|fhpii|fhpiii]
                                  Model name.  [default: HPP]
  -w, --width INTEGER             Lattice window width.  [default: 300]
  -h, --height INTEGER            Lattice window height.  [default: 200]
  -s, --steps INTEGER             Number of steps.  [default: -1]
  -r, --run                       Run immediately.
  -d, --deterministic             Generate the same randomized result for the
                                  same params.  [default: True]
  -p, --pattern [wiki|random|alt|single|obstacle|test]
                                  Select initial state pattern.  [default:
                                  wiki]
  --help                          Show this message and exit.

So the sample usage can look like this

lgca --run

The above command should display the HPP model visualization, identical to the one on Wikipedia.

https://en.wikipedia.org/wiki/HPP_model

  • To start/stop the application just press the space button.
  • To reset app to the initial state press the S button.
  • To quit the app pres ESC button or quit the window.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lgca-0.1.1-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file lgca-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lgca-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for lgca-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 913f0c61ec00092002ec5251e1d59a3f16c978a16c2c0e1fe25cac3daedebbc9
MD5 9658fdb88974743ecd19e7907bd86280
BLAKE2b-256 bd16c36a6dbe4e5879c93febda25a11b2a8712a496808a87e51ffb3d8ebcb952

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page