An abstract, lambda-driven, open source cellular automata program
A sample callular automaton simulation created with my program

An abstract, lambda-driven, open source cellular automata program

It had been a while since I had looked into the fascinating world of cellular automata. I had previously developed a 2D CAP for fun in an object-oriented programming class during my studies at the University of West Florida, but it was nothing near to the level of abstraction that I often like to encode in my programs. This past two weeks I decided to remake this program from scratch in C#, initially with 3D support using a rendering library that I had written from the ground up for my physical simulation project, but eventually settled on two dimensions due to the rather annoying level of sluggishness that arises when adding an additional spacial dimension. This new program allows pretty much every component of the overall algorithm to be specified via lambda expressions. Everything from the neighbor search algorithm, seed algorithm, search radius, ruleset, and boundary conditions can be modified at runtime. In addition, I have also allowed multiple simulation rules to affect the automaton at once by implementing an additional "rule selection" algorithm, which selects one of the many state results generated from each rule. Another handy feature is the ability to randomize different aspects of algorithm selection and the ability to create a new automaton in the event that the current simulation "flat-lines".

Features

  • Integer-based cell states.
  • Lambda-based rule, rule selection, neighbor, seed, and boundary condition algorithms which are loaded at runtime.
  • Algorithmic support for 1D elementary cellular automata, specified via Wolfram numerical codes.
  • Ability to update cell states based on more than one automaton rule (the true result is then selected).
  • Parallel thread computation for faster iterations.
  • Ability to "buffer" an automaton for a particular number of generations and then play back the result.
  • Object serialization for loading/saving live simulations or pre-buffered simulations.
  • Ability to randomize most features of an automaton at runtime for discovery of new combinations and patterns.
  • Ability to restart a simulation upon the "flat-lining" of the current automaton (when up to four successive generations produce no change in cell states).
  • Runtime algorithm documentation based on C# attribute metadata.

 

You can find the project at this GitHub repo.

Excellent exercise in obfuscated code! Exactly the same can be done for any dimension using a single map from large integers to large integers and a single recursion given only an infinite precision module.

Like
Reply

To view or add a comment, sign in

More articles by Harrison Totty

  • How I found "Art" in beautiful desktops

    Growing up, I never really had much interest for "Art". I always saw myself as a more objective person, and that many's…

    2 Comments
  • Relationship Between n-Dimensional Planck Length And Gravity In String Theory

    (Note that the following was pulled from my personal blog which usually contains LaTex expressions that are normally…

    1 Comment
  • Simplex Universe Concept Project

    As a few of you guys know, I have been working on an abstract n-body simulation project for a few years now and I have…

  • About Simplex Universe

    I have been fascinated at the laws of nature and how the world around us works since I was a young boy. Yet, as many…

    1 Comment

Others also viewed

Explore content categories