Skip to content

A Python cellular automata simulation that evolves a 2D terrain grid and exports an animated HTML visualization.

Notifications You must be signed in to change notification settings

danboy-lab/cellautopy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Cellular Automata Terrain

Python program that runs a cellular automata simulation on a 2D grid and exports the result as an animated HTML visualization.


FILES

automata.py

  • Runs the simulation
  • Defines tile types and rules
  • Prints the grid in the terminal
  • Controls timestep delay
  • Exports frames to HTML

export_html.py

  • Takes simulation frames
  • Generates an HTML file with a colored grid animation

REQUIREMENTS

  • Python 3.x
  • Web browser (to open the exported HTML file)

No external libraries are required.


USAGE

Run with default settings:

python automata.py

Run with custom parameters:

python automata.py <rows> <cols> <steps> <delay> <seed>

Example:

python automata.py 30 80 400 0.1 42

Arguments:

  • rows : grid height
  • cols : grid width
  • steps : number of simulation steps
  • delay : time between steps in seconds
  • seed : random seed (optional)

OUTPUT

  • Terminal output: ASCII grid updated every timestep
  • File output: automata.html

Open automata.html in a browser to view the animated grid.


TILES

Symbol Meaning

' ' Empty '#' Wall 'T' Tree '~' Water '.' Grass '^' Mountain

Tile behavior is defined in automata.py.


CONTRIBUTING

  1. Fork the repository
  2. Make changes in a separate branch
  3. Submit a pull request with a short description

NOTES

  • All simulation updates are synchronous
  • HTML export does not affect simulation logic
  • Changing tile colors only requires editing export_html.py

About

A Python cellular automata simulation that evolves a 2D terrain grid and exports an animated HTML visualization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published