Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stata implementation of Conway's Game of Life

    Conway's Game of Life is a cellular automaton devised by John Conway in 1970, in which cells on an infinite grid interact with neighbors, following a set of rules which determine whether a cell dies, lives on to the next generation, or is brought to life:
    1. Any live cell with fewer than two live neighbours dies, as if by underpopulation.
    2. Any live cell with two or three live neighbours lives on to the next generation.
    3. Any live cell with more than three live neighbours dies, as if by overpopulation.
    4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
    My new program, gameoflife, implements the game in Stata with a randomized initial configuration, and visualizes the results. One key difference to the original game is the use of a grid with wraparound borders instead of an infinite grid (such that a cell at the top of the grid has its three upper neighbors at the bottom of the grid, and a cell at the rightmost edge has its three rightward neighbors at the leftmost edge).

    An example visualization, with a 50x50 grid after 122 generations:


    The same game, after 456 generations, looks like this:


    The program can be installed by entering the following command into Stata:

    Code:
    net install gameoflife, from("https://raw.githubusercontent.com/aliatia-1/gameoflife/main/")
    Last edited by Ali Atia; 25 Sep 2021, 14:21.

  • #2
    Nice. Alternatively, there is an implementation of Conway's Game of Live in the ABM package. The ABM package is a set of tools to help with building an Agent Based Model in Mata. Agent Based Models can be thought of as generalizations of cellular automata. The Game of Live is in the examples section of https://github.com/maartenteaches/abm. I gave a talk on the ABM package at the Belgian Stata Conference: https://www.stata.com/meeting/belgiu...ium21_Buis.zip
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Originally posted by Ali Atia View Post
      Conway's Game of Life is a cellular automaton devised by John Conway in 1970, in which cells on an infinite grid interact with neighbors, following a set of rules which determine whether a cell dies, lives on to the next generation, or is brought to life:
      1. Any live cell with fewer than two live neighbours dies, as if by underpopulation.
      2. Any live cell with two or three live neighbours lives on to the next generation.
      3. Any live cell with more than three live neighbours dies, as if by overpopulation.
      4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
      My new program, gameoflife, implements the game in Stata with a randomized initial configuration, and visualizes the results. One key difference to the original game is the use of a grid with wraparound borders instead of an infinite grid (such that a cell at the top of the grid has its three upper neighbors at the bottom of the grid, and a cell at the rightmost edge has its three rightward neighbors at the leftmost edge).
      I also see in this the prospect of developing games and online slots for casinos and online casinos, which in the long run are quite profitable. I'm currently playing Buffalo slot and I'm amazed at how good this online slot is. Free Buffalo slot machines were introduced in 2006 by Aristocrat Limited, a well-known developer of online casino software.

      An example visualization, with a 50x50 grid after 122 generations:
      [ATTACH=CONFIG]temp_24153_1632601231206_410[/ATTACH]

      The same game, after 456 generations, looks like this:

      [ATTACH=CONFIG]temp_24154_1632601260426_907[/ATTACH]
      The program can be installed by entering the following command into Stata:

      Code:
      net install gameoflife, from("https://raw.githubusercontent.com/aliatia-1/gameoflife/main/")
      It's very cool!

      Comment

      Working...
      X