The Game of Light

In memoriam: John Horton Conway

In 1970 an article by Martin Gardner appeared in Scientific American disclosing for the first time a “game” invented by John H. Conway: a matrix of ones and zeros changes with time according to simple rules inspired by biology. Cells (ones) survive or die because of overpopulation, or starvation. The simple rules surprisingly generate a variety of binary animals, named gliders, blocks, and spaceships, among others. By pen and paper, Conway demonstrated that complex dynamics spontaneously emerge in the game. Ultimately, Conway’s Game of Life turned out to be a universal Turing machine, and it is the most famous example of Cellular Automaton.

I was deeply inspired by the possibility of generating complexity with simple rules, like many others before me. In more than 50 years, Conway’s Game of Life inspired generations of scientists. “Life” is at the inner core of ideas that pervade nowadays machine learning, evolutionary biology, quantum computing, and many other fields. It also connects to the work of Wolfram and the development of Mathematica.

I was intrigued by the interaction between light and complexity and I wanted to combine the Game of Life with electromagnetic fields. I report below my original post on the topic (dating back to 2008). The article was rejected by many journals and finally published in a book dedicated to the 50 years of the GOL ( Game of Life Cellular Automata, Springer 2010).

The Enlightened Game of Life (EGOL)

The link between light and the development of complex behavior is as subtle as evident. Examples include the moonlight triggered mass spawning of hard corals in the Great Barrier, or the light-switch hypothesis in evolutionary biology, which ascribes the Cambrian explosion of biodiversity to the development of vision. Electromagnetic (EM) radiation drastically alters complex systems, from physics (e.g., climate changes) to biology (e.g., structural colors or bioluminescence). So far the emphasis has been given to bio-physical, or digital, models of the evolution of the eye with the aim of understanding the environmental influence on highly specialized organs. In this manuscript, we consider the way the appearance of photosensitivity affects the dynamics, the emergent properties and the self-organization of a community of interacting agents, specifically, of cellular automata (CA).

Quick and dirty implementation of the EGOL in a Python Notebook

https://github.com/nonlinearxwaves/gameoflife.git

Docker, mpi, fftw, fftw-mpi

Docker enables to create containers for your program with all the libraries installed.

This avoids to reinstall all the libraries (say mpich, fftw…) to any user and in new systems

The user just needs to pull the container from a repository. For example nonlinearxwaves/base

I write C++ scientific computing programs with mpich, fftw-mpi and random numbers libraries (as sprng5), which I need to run in both windows and linux systems. Docker simplifies a lot the deployment but also the development of the code.

nonlinearxwaves/base is a container with all of that

After installing Docker you run

docker login

Then you pull the docker image

docker pull nonlinearxwaves/base:0.1

You list the available images with

docker images -a

You identify the image id (in this example it is ec56f7250d5a)

REPOSITORY             TAG                 IMAGE ID            CREATED             SIZE
nonlinearxwaves/base 0.1 ec56f7250d5a 42 hours ago 1.13GB

You run the image with (you must replace the image id with your image id)

docker run -i -t ec56f7250d5a 

And you are in a shell with all the libraries installed and you may compile and run your mpi application in the usual way. In this image you will be the user “user”

user@2ff281ad4621:~$

The number 2ff281ad4621 is the container id that is now running (similar to a virtual machine)

This works with Windows and Linux (and also Mac, but I did not test)

You may also create your images with the Dockerfile

Is docker fast ? or is it better not to use a container? we will test …

emacs, auctex, Sumatra.pdf in Windows 10

On Windows 10 Pro

Install MiKTeX from https://miktex.org/

Download emacs zip file in the GNU mirror. I have chosen in http://mirror.lihnidos.org/GNU/ftp/gnu/emacs/windows/ the file in the folder emacs-26 http://mirror.lihnidos.org/GNU/ftp/gnu/emacs/windows/emacs-26/emacs-26.3-x86_64.zip

Unzip the emacs file in some folder for example Downloads folder, you will have a folder with name emacs-26.1-x86.4

Inside this emacs folder, click on runemacs

Now emacs is running, but you need to install auctex and Sumatra.pdf. You may create a shortcut to runemacs in the application bar by right clicking on it

To install auctex open emacs, then “M+x package-install auctex” and hit return

M+x package-install auctex

Sumatra.pdf enables to open multiple windows with the same pdf file. Acrobat blocks the compilation if the pdf is open.

Install Sumatra.pdf from https://www.sumatrapdfreader.org

Sumatra.pdf exe file will be in “C:\Program Files\SumatraPDF”

C:\Program Files\SumatraPDF

Now you need to configure emacs for using Sumatra.pdf, this is done by modifying the .emacs file

The .emacs file is the main configuration file for emacs

You find the .emacs file in the folder “C:\Users\<USER>\AppData\Roaming”

C:\Users\YourUserNameHere\AppData\Roaming

This is a hidden folder, you need to enable showing hidden folder in windows explorer (go to options in the folder menu)

Open .emacs and add the lines at the end of the file and save

(setq TeX-PDF-mode t)
(setq TeX-source-correlate-mode t)
(setq TeX-source-correlate-method 'synctex)
(setq TeX-view-program-list
'(("Sumatra PDF" ("\"C:/Program Files/SumatraPDF/SumatraPDF.exe\" -reuse-instance"
   (mode-io-correlate " -forward-search %b %n ") " %o"))))

(eval-after-load 'tex
 '(progn
   (assq-delete-all 'output-pdf TeX-view-program-selection)
   (add-to-list 'TeX-view-program-selection '(output-pdf "Sumatra PDF")))
 )
(server-start)

Now you are set to run auctex in emacs with forward search and Sumatra.pdf