Stephen Wolfram's book "A New Kind of Science" is a fun read, and the pictures that his 1-d cellular automata generate are quite compelling. While I have not yet investigated the matter thoroughly, I suspect that the bitwise versions probably perform better than the originals with regard to memory consumption. Runs after 4 seconds of viewing the initial state. to … Files for cellular-automata, version 0.1.dev1; Filename, size File type Python version Upload date Hashes; Filename, size cellular-automata-0.1.dev1.tar.gz (8.0 kB) File type Source Python version None Upload date Apr 3, 2016 Hashes View Simple 2D Cellular Automaton Simulation. (no Python / Pygame required.) That being said, here are bitwise arithmetic versions of the ca_data and pil_render functions. ''', '''This program generates snoflake pattern'''. I use the Python Imaging Library to generate images from the data, but you could substitute any number of other methods. ActiveState Code (http://code.activestate.com/recipes/576539/), # This program genereates very simple one dimensional cellular automata, # URL: http://www.stephenwolfram.com/publications/articles/ca/83-cellular/2/text.html, '''This function updates list based on rule ( left XOR right here )''', '''This function prints list with 'A' for 1 and ' ' for 0 value. I came up with this shorter and faster implementation. import Image, ImageDraw | Support. draw = ImageDraw.Draw(img). Bitwise Versions. and ActiveTcl® are registered trademarks of ActiveState. Specifically, it takes in a string consists of the characters <.> and
, and changes it according to som… 写文章. ActiveState Tcl Dev Kit®, ActivePerl®, ActivePython®, One-dimensional cellular automata You are encouraged to solve this task according to the task description, using any language you may know. The script uses the Python Imaging Library to render the output, but you could replace this with text or any other method of visualization. - Windows exe file included. Scientific/Engineering :: Artificial Life, http://www.argentum.freeserve.co.uk/lex.htm, http://www.labri.fr/perso/nrougier/teaching/numpy/numpy.html#the-game-of-life. With the exception of the randomization function (where using long integers opened up obvious optimizations too good to pass up) I have attempted to keep the flow of the functions as similar as possible. Stephen Wolfram's book "A New Kind of Science" is a fun read, and the pictures that his 1-d cellular automata generate are quite compelling. I tried to optimize with various different approaches to bit shifting, but found that the << (left shift) operator was almost universally faster than pow and a number of other approaches. Nice. If you're not sure which to choose, learn more about installing packages.