Code Monkey home page Code Monkey logo

pentagrid's Introduction

Hyperbolic Cellular Automation Simulator

This program is a simulator of totalistic 2-state cellular automata on hyperbolic tiling {5,4}. Simply speaking, it's a Game of Life in the hyperbolic space.

Screenshot

Usage

To run the program, execute pentagrid.jar:

$ java -jar pentagrid-0.1.jar

The GUI shows field {5;4} hyperbolic tesselation. Use mouse to toggle cell states.

Hotkeys

For now, there is no GUI controls, only hotkeys are used.

Simulation

  • SPACE - simulate one step
  • ENTER - start/stop continuous simulation
  • d - clear field
  • x - set new rule (see Rules)
  • r - create random field of some small radius

Navigation

  • c - jump to the center (useful if you have got lost far away)

  • arrow keys - move through the hyperbolic space

  • [, ] - rotate view

  • z - run search for the cell clusters

  • o,p - go to the next/previous cell cluster (from the found previously)

View

  • g - toggle grid visibility
  • a - toggle anti-aliasing

Files

  • s - save field
  • l - load field
  • e - export current view as PNG image
  • t - edit settings (for now, only "Export image size" option is working)
  • n - export multiple frames (animation). Several files with numeric indices are generated.
  • m - export multiple frames with offset. Useful for making smooth animations of moving spaceships. Allows to specify total number of gernations, number of frames per generation and amount of vertical offset (in pentagon side lengths).

Rules

Supported automata are binary (cells are either dead or alive) and totalistic. The latter means that the next state of the cell depends only on the total number of alive neighbors. This program uses 10-cell neighborhood (analogous to the Moore neighborhood in regular CA).

Rules are specified in the standard B/S notation. For example, "B3/S23" describes the following rule:

  • Cell "born" (i.e. changes state from 0 to 1), if it has 3 alive neighbors.
  • Cell "survive" (i.e. holds state 1), if it has 2 or 3 alive neighbors.
  • In the all other cases, cell "dies" (its state becomes 0).

To denote 10 alive neighbors, use letter "a". Rule strings are case-insensitive, "/" is optional.

Generally, rules containing B0 can not be simulated by this program since they produce infinite amounts of alive cells. The only exception are the Strobing rules, which have B0, but not have Sa. In such rules, empty space changes to filled space, and filled space changes to empty space back. This allows to represent such rules as combination of 2 normal rules. Interestingly, there are rules in this class, that support gliders and not explosive.

Technical characteristics

Field size is limited only by computer memory. However, note that in hyperbolic space, number of cells grows exponentially with area size. In addition to this, algorithms are not very memory-effective. On default settings, you can catch memory exception when cell count reaches 150'000. By increasing Java heap space (run java --help for options), you can increase this limit to 300-400k cells. However, simulation is very slow for such sizes.

Supports infinite-sized field!

Compilation

Depends on the Google GSON library, used for data serializaiton. From it, only google-gson-stream library is needed (object mapper is not used).

pentagrid's People

Contributors

dmishin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

imclab undeadinu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.