Hashlife

Hashlife

Hashlife is an algorithm for computing the long-term fate of a given starting configuration in various Life rules. The algorithm was invented by Bill Gosper in the early 1980s while he was engaged in research at the Xerox Palo Alto research center. Hashlife was originally implemented on Symbolics Lisp machines with the aid of the Flavors extension.

Hashlife

Hashlife is designed to exploit large amounts of spatial and temporal redundancy in most Life rules. For example, in Conway's Life, the maximum density of live cells in a region is only 1/2, and many seemingly random patterns end up as collections of simple still lifes and oscillators.

Representation

The field is typically treated as a theoretically infinite grid, with the pattern in question centered near the origin. A quadtree is used to represent the field. An update operation takes the square of 22"k" cells, 2"k" on a side, at the "k"th level of the tree, and computes the next generation of the 2"k"-1-by-2"k"-1 square of cells in the center.

Hashing

While a quadtree trivially has far more overhead than other simpler representations (such as using a matrix of bits), it allows for various optimizations. As the name suggests, it uses hash tables to store the nodes of the quadtree. Many subpatterns in the tree are usually identical to each other; for example the pattern being studied may contain many copies of the same spaceship, or even large swathes of empty space. These subpatterns will all hash to the same position in the hash table, and thus many copies of the same subpattern can be stored using the same hash table entry. In addition, these subpatterns only need to be evaluated once, not once per copy as in other Life algorithms.

This itself leads to significant improvements in resource requirements; for example a generation of the various breeders and spacefillers, which grow at polynomial speeds, can be evaluated in Hashlife using logarithmic space and time.

uperspeed and caching

A further speedup for many patterns can be further achieved by evolving different nodes at different speeds. For example, one could compute twice the number of generations forward for a node at the ("k"+1)-th level compared to one at the "k"th. For sparse or repetitive patterns such as the classical glider gun, this can result in tremendous speedups, paradoxically allowing one to compute "bigger" patterns at "higher" generations "faster", sometimes exponentially. To take full advantage of this feature, subpatterns from past generations should be saved as well.

Since different patterns are allowed to run at different speeds, some implementations, like Gosper's own hlife program, do not have an interactive display, but simply compute a preset end result for a starting pattern, usually run from the command line. More recent programs such as Golly, however, have a graphical interface that can be driven by a Hashlife-based engine.

The typical behavior of a Hashlife program on a conducive pattern is as follows: first the algorithm runs slower compared to other algorithms because of the constant overhead associated with hashing and building the tree; but later, enough data will be gathered and its speed will increase tremendously - the rapid increase in speed is often described as "exploding".

Drawbacks

Hashlife can consume significantly more memory than other algorithms, especially on moderate-sized patterns with a lot of entropy, or which contain subpatterns poorly aligned to the bounds of the quadtree nodes (ie. power-of-two sizes); the cache is a vulnerable component. It can also consume more time than other algorithms on these patterns. Golly, among other Life simulators, have options for toggling between Hashlife and conventional algorithms.

Hashlife is also significantly more complex to implement. For example, it needs a dedicated garbage collector to remove unused nodes from the cache. While an amateur programmer might be able to write a simple Life player over an afternoon, few Hashlife implementations exist.

ee also

* Conway's Game of Life
* Optimization
* Functional data structures, of which the hashed quadtree is one

References

* "Exploiting Regularities in Large Cellular Spaces", Bill Gosper. 1984, pp. 75-80 from Volume 10 of "Physica D. Nonlinear Phenomena"

External links

* [http://www.ericweisstein.com/encyclopedias/life/HashLife.html HashLife from Eric Weisstein's Treasure Trove of Life]
* [http://tomas.rokicki.com/hlife/ Tomas Rokicki's implementation of hashlife]
** [http://golly.sourceforge.net/ Golly] -(cross-platform Windows/Linux/Mac successor program)
* [http://www.argentum.freeserve.co.uk/lex_h.htm#hashlife Entry] in the [http://www.argentum.freeserve.co.uk/lex_home.htm Life Lexicon]
* [http://www.ddj.com/dept/ai/184406478 Explanation of the algorithm] from Dr Dobb's Journal


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • Hashlife —  Ne doit pas être confondu avec HighLife ni Halflife. Demande de traduction …   Wikipédia en Français

  • Hashlife — Es un algoritmo de largo plazo para computadoras destinado a una determinada configuración a partir de diversas formas de vida. El algoritmo fue inventado por Bill Gosper en la década de 1980 mientras se encontraba dedicado a la investigación en… …   Wikipedia Español

  • Conway's Game of Life — Conway game , which redirects to here, can also refer to games as defined by surreal numbers, which John Conway also developed …   Wikipedia

  • Bill Gosper — Pour les articles homonymes, voir Gosper. Bill Gosper en 2006. Bill Gosper (nom complet Ralph William Gosper, Jr.) est un mathématicien et informaticien …   Wikipédia en Français

  • HighLife — Cet article concerne un automate cellulaire. Pour le genre musical africain, voir highlife (musique).  Ne doit pas être confondu avec Hashlife. HighLife est un automate cellulaire similaire au jeu de la vie. Il fut inventé en 1994 par Nathan …   Wikipédia en Français

  • Jeu de la vie — Un canon à planeurs de période 30. Le jeu de la vie, automate cellulaire imaginé par John Horton Conway en 1970, est probablement, à l’heure actuelle, le plus connu de tous les automates cellulaires. Malgré des règles très simples, le jeu de la… …   Wikipédia en Français

  • List of programmers — This list is incomplete; you can help by expanding it. This is a list of programmers notable for their contributions to software, either as original author or architect, or for later additions. Contents: A B C D E F G H I J K L M N …   Wikipedia

  • Bill Gosper — Infobox Person name = Ralph William Gosper, Jr image size = 150px birth date = 1943 birth place = occupation = Programmer employer = residence = nationality = American field = computer scientist, mathemtician work institutions = Xerox PARC,… …   Wikipedia

  • Memoization — Not to be confused with Memorization. In computing, memoization is an optimization technique used primarily to speed up computer programs by having function calls avoid repeating the calculation of results for previously processed inputs.… …   Wikipedia

  • Oscillator (cellular automaton) — In a cellular automaton, an oscillator is a pattern that returns to its original state, in the same orientation and position, after a finite number of generations. Thus the evolution of such a pattern repeats itself indefinitely. Depending on… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”