Package: pyceau
pyceauSimple Python implementation of two-dimensionalcellular automatausingMoore neighbourhood.
Simulation can be (un)paused using^Z/SIGTSTP.
Simulation can be stopped using^C/SIGINT.pyceaustands forPythonCellularAutomata.See thedemonstrationfor results using regular and concatenated rules.
Please note that the website is only tested to be working with Chromium and video files don't seem to render in Firefox.DisclaimerMay create seizures. Use this software at your own risk.InstallationThis project is hosted onPyPIand can therefore be installed easily throughpip:pip install pyceauDependending on your setup you may need to add--userafter theinstall.FlickerSome rule sets are strenuous to the eye, because of heavy flicker.
To alleviate this problem use the-pflag.
You can choose between different modes1,2and3via-mwhere0is default.
It is advisable to use mode1for exploration of new rules because it works for most patterns.
If this does not work, maybe only rendering even frames via-k 2is of help.RulesThe program allows to useConway's Game of Life'srules and others.
They can be given via the-ror--rulesargument using eitherS/B notationor S/B/C notation.
Random rules are allowed using the format-r lL+rR.lis the minimum,Lthe maximum number of elements for the left S rule set.randRwork analogously for the right B rule set.
To allow maximum freedom on randomness of the rule sets, use-r 18+18.Beyond regular S/B notation it is allowed to combine multiple rules together separated by commata,.
It is decided by the current tick which of these alternating rules are used.
Each of these rules can also be prepended by a natural number andxindicating the number of times this rule should be successively repeated.
An example combining both of these concepts would be the rule string-r 123467/0167,3x126/6.This notation can be used for the regular rules via-ras well as thepost-processing rulesgiven via--post-rules.ClassicalRule nameS/B notationConway's23/3Day and night3678/34678Stumbled uponThe following rules have been randomly found or at least partly crafted by either somebody else if annoted or myself.
Flicker of rules marked with + can be filtered, flicker of rules with - cannot.
= works sometimes.
Numbers indicate a preferred filter mode given-mor--flicker-mode.
Convergence describes time to reach a state without much change.
+ means it takes long, = normal and - short to converge.
Stability describes that a system has sufficient change, but not too much to be reduced to noise.
Convergence and stability are not yet operationalized.S/B notationFlickerConvergenceStability01/0156783+--0123/012343+--01234567/123456783=--012346/01236783=++=012358/02381=+=0135/0123573++=01357/456780+=-0/21++-0234/730++++02456/01234673++++03/023+--03456/0123463++=035/0123473+==035678/36 ¹0+=-1/02343+--12/0243+=-1234/41++-12345/012456783+++1237/1370=+=1238/01271=++=1245/12345673+++=12456/45671=++=12457/041+++=1256/30++++=13/341++++145/01283++-145/350+--23/01233+--23457/0123463+++=23457/056780++-2356/45 ²0+=-25/0123463++-2568/356780++-3456/0123563++++34567/681+--34568/460+--34568/56780==-347/3560=++=35/06780-+++3578/060=+++=4/0123463+--4567/5671+--5/0781-+++567/2456781=++-567/456781+--5678/13670=++-5678/35678 ¹0+=-46/246,14/60+++++¹David Eppstein²Sören WegenerTo execute all of these one after another using the least strenuous flicker filter the following bash snippet may help:forrulesin$(grep-Eo'[0-9]+/[0-9]+ +\|'README.md|cut-d\-f1);domode=$(grep-E"^$rules\s+\|"README.md|awk'{ print $3 }'|cut-c1);[[$mode=~[0-3]]]||mode=0pyceau-cr$rules-s200-m$modedoneTo cycle through ones with slow convergence (++) using^Cthe following commands can be used:for rules in $(grep -E '\+{2}' README.md | grep -Eo '[0-9]+/[0-9]+ +\|' | cut -d\  -f1); do
    mode=$(grep -E "^$rules\s+\|" README.md | awk '{ print $3 }' | cut -c1); [[ $mode =~ [0-3] ]] || mode=0
    pyceau -cm $mode -r $rules
doneMore rules are to be found onWikipedia.Roles for S/B/C automatons can be found on thewebsite of Mirek Wójtowicz.ExplorationTo explore and find new rules the following snippet can be used:whiletrue;dopyceau-r18+18sleep.4doneIf interesting patterns emerge^Ccan be held.sleepshould be modified to match the keyboard's refresh rate to not start a new simulation too soon.One dimensional simulationsTo simulate all the rules from the list within a single dimension and create graphical "footprints" use the following snippet:forrulesin$(grep-Eo'[0-9]+/[0-9]+ +\|'README.md|cut-d\-f1);domode=$(grep-E"^$rules\s+\|"README.md|awk'{ print $3 }'|cut-c1)[[$mode=~[0-3]]]||mode=0echo-e"\n$rules"pyceau-cr$rules-s16-m$mode-ud80x1|grep-vE'^$'doneNote thatgrepis used to filter out empty lines that would otherwise disturb the output.
While some of the rules give interesting patterns there are also duplicates (like35/0678and3578/06).
This is because the rules are still computed in two dimensional neighbourhood with a ring of size 1 in the second dimension.Wolfram codeare usually used for one dimensional cellular automata and given S/B notation could be converted accordingly.ArgumentsStart the program using the--helpor-?flag to see a current overview of allowed arguments.BoardSetting the board manually is supported through the-bargument.
This implies board size and therefore-dis not given.
A sample5x5board with a glider can be given using the following notation:-b 00000.00100.00010.01110.000000dead1alive.new lineSubtitle barThe subtitle bar can display different kinds of information.
The following tables lists possible values for its format:FormatExpansion%rRules%RRules (/replaced with-)%dDimensions (WxH)%DDimensions (W-H)%fFlicker mode%aFlicker mode (alphabetic)%sRandom seed%SRandom seed ([,]removed)%tTick number%TTick number (8 digits, preceding zeroes)%iInversion indicator%oRender indicator%pPost processing rules and ticksThe default is%r %a %t %iand can be overwritten via-f.
Image render file format is using%R-%D-%S-%a-%T.pngper default.Render imagesYou can render images with limited options.StillsThe following snippet renders a still inimg/0123-01234-48-32-DEMO-A-4.png:pyceau-r0123/01234-s4-m1-d48x32-qeDEMO-i-1
xdg-openimg/*Image sequencesThe following snippet renders all of the 3000 frames in theimgdirectory. This will take some time:pyceau-r3456/012356-s3100-m2-z2-d512x256-eDEMO-i100:-1:2-q
xdg-openimg/*VideosIf you have executed the last snippet to create image sequences, you can then useffmpegto combine these into a video.
A simple command to encode all the stills in the different subdirectories inimginto a separate video each located invidusingWebM and VP9is:for dir in img/*; do
    id="${dir##*/}"
    ffmpeg -framerate 23 \
           -pattern_type glob \
           -i "$dir/*.png" \
           -c:v libvpx-vp9 \
           -pix_fmt yuva420p \
           "vid/$id.webm"
donefor rules in $(grep -Eo '[0-9]+/[0-9]+ +\|' README.md | cut -d\  -f1); do                                                                                                                                         :(
    mode=$(grep -E "^$rules\s+\|" README.md | awk '{ print $3 }' | cut -c1); [[ $mode =~ [0-3] ]] || mode=0
    pyceau -cr $rules -d 256x64 -m $mode -e DEMO 
doneAfter rendering has completed you can have a look atoutput.webm.
SeeTick spansbelow for further details.Tick spansTo describe tick spans for-ithe following notation is used:ndescribes a single pagen,mdescribes both pages or rangesnandmn:mdescribes a range fromntomincludingmn:m:kdescribes a range fromntomincludingmwith step sizekE.g.0:2,5:9:3,-1unfolds to the list[0, 1, 2, 5, 9]if the last tick is9.Note that there is also--render-ticksthat does something similar for rendering to stdout.Post-processing filtersAfter a step is taken according to the rules of the automaton its state can be altered for display using a post-processing filter.
This filter is another automaton following rules specified via--post-rule.
This filter is then applied as often as defined by--post-ticksfor each tick.