DEV Community

Cover image for A "Life". With a twist.
Vladimir Uogov
Vladimir Uogov

Posted on

A "Life". With a twist.

A "Game of Life"

Many of you, heard about "Game of Life". This is quite old zero-player game, where you can set the initial condition for the game and then watch story to be happening in the front of your eyes. The idea of the "Game of Life" or "Life" is strikingly simple. There are endless grid, stretching left, right, up and down. Each cell on this grid could be "live" or "dead". If "live" cell have a lesser than 2 "live" neighbors across all 8 directions, it dies to "underpopulation". If "live" cell have more than 3 "live" neighbors, it dies of "overpopulation". If "dead" cell have exactly 3 "live" neighbors, it changes it's state to "live", so 3 "live" cells making a new "live" cell. Overall, this game is looks like this:

You are placing a pattern of cells on the gameplay and watch a sequences of life and death in this strange universe. While this game may look like a toy, it's been a very influential model, impacting many fields of science, such as "Automata theory", "Game theory", "Decision theory" and many others. And I can not understate the importance of this very simple concept for a Mathematics and consequently for the IT industry.

A twist in the "Life"

Like many math and computer enthusiasts before me, I was captivated with this very simple, but very powerful concept. But few things had bother me for a quite a while, and I did not know what to do with the questions I've had. Without an external help, I've tried to sink my teeth into this game and while failed, I've moved closer and closer to the answer to the questions I've been bothered with. Let me sum-up those questions:

  1. Why the classic "Life" is bit off from the real life, from how the cells actually behave ?
  2. Why so much dependency is fallen on initial positioning of the "live" cells on the grid. How we can end up this dependency and create an "immortal" cellular automata ?
  3. How the behavior of the "Life" will be changed if the grid of the game will be non-infinite and convoluted ? North will continue on South, West on East.
  4. What kind of practical applications could be done with this algorithm, applications understandable by IT professionals, not just by a bunch of professors and post-doc fellows ?

And after giving this problem some while for thoughts, I've came up with twisting the classic "Life" rules. I still do not have an answer to all the question I have, but by twisting the rules a little bit, I've resolved some of the issues, or as I see them as an "issue" with a classic "Game of Life".

  1. In real life, every cell have an "immunity" a resistance to unfavorable conditions.
  2. In a real life, cell do have a limit for an age. Even in a favorable condition, cell can not live forever.
  3. In a real life, if the place for a cell been unoccupied for certain period of time, the "life" can self-procreate itself in the "dead" cell with some randomness.
  4. Each new cell, when born to "life", do have a unique ability to resist to an unfavorable conditions.
  5. If "live" cell been hit with unfavorable conditions and had enough immunity to live through, own immunity is "compromised" and will not be healed with time. So, cell will resist to an unfavorable conditions as long as initial immunity allows to continue to live.
  6. We can define a separate immunity threshold for "overpopulation" and "underpopulation".
  7. "Life" world is not infinite and it is convoluted.

Well, once you have an "immortal cellular automata", the practical applications will be readily available. But before we discuss practicality, let's look at how "the Game of Life" will behave if we will have a "live" cells with immunity and "Life" world with self-procreation of "life".

I only captured 128 "steps" of the Game for this movie, but my attempt to run the "Game of Life" with modified rules for a few days, gave me an understanding that we do have an immortal automata (well based on number of steps for a "dead node" to be a "dead" and randomness of pro-creation. I probably will need a time/help to build a math base under this statement.

A practical application for the modified algorithm.

First, when you place a limitation on the size of your convoluted world, you are bringing the data grid to a practicality. There are number of applications for this modified algorithm, and let me discuss one of them, known as a "Resource access limitation". In the real life, we always dealing with a limited resources and capacities of different kind. For example, you always do have a limited capacity of the servers delivering of some software update on the cluster. Due to a capacity limitation, servers can serve only limited number of requests simultaneously and access must be throttled, but eventually, all servers must be enabled to communicate with an update cluster.

Modified "Game of Life" could serve as a throttling mechanism for this request. All servers that are in the production cluster can be represented as a "cells" in the "Life" World. When cell become "live", it is enabled to communicate with an update servers and this enablement lasts until cell is "live". When cell is in "dead" state, server represented by this cell can not use that limited resource, till cell becomes "live" again. So, this is one of the ways on how to enable a fair access to a shared resource.

There are so many ways oh how you can utilize that algorithm, and this simple example is only a tip of the iceberg. Try to implement and experiment with this algorithm. Look at my experimental implementation here and share your results.

Top comments (0)