What “Conway’s Game of Life” taught me.

Itza Reyes
3 min readJun 6, 2023

--

Para leer en Español clic aquí.

Once I read it, I was fascinated by how, under such few simple rules, one can observe behaviours of great complexity.

👾 The game

To provide context for this automaton, here are the simple rules:

Players

It is a zero-player game. The initial state determines its evolution and does not require any further input.

Board

The board is an infinite two-dimensional orthogonal grid of square cells.

Each cell can be in one of two possible states: alive or dead.

Each cell interacts with its eight neighbours, the adjacent cells positioned horizontally, vertically, or diagonally.

Transitions / States

With each step in time, the following transitions occur:

  • Any live cell with fewer than two live neighbours dies, as if by underpopulation.
  • Any live cell with two or three live neighbours survives to the next generation.
  • Any live cell with more than three live neighbours dies, as if by overpopulation.
  • Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

🤓 My learnings

  • While developing the Game of Life, I came to appreciate the importance of having a mentor who can guide and take you through steps they have already traversed. I am grateful to José Juan for encouraging and guiding me in this Game of Life.
  • When I sought to understand the problem, I took the time to delve into this part of its definition: “…an infinite two-dimensional orthogonal grid.” This led me to think about the property of orthogonality, where each function or feature is independent and unaffected by other functions or features. By preserving this property, we can develop software that is extensible, modular, reusable, scalable, and easy to maintain.
  • When I began thinking about the solution, I had to consider the design approach I would adopt. I chose object-oriented programming, not because it is the best, but simply because I wanted to develop it in Kotlin, the language I currently use the most. This decision was important as it would govern my future choices. This analogy can be applied to any software development. It is valuable to engage in the design phase as it provides guidelines for continuing any project.
  • Something that should never be absent in my code anymore are the tests. Once again, I reaffirmed their importance while developing this code, as the first thing I did was write my test cases and make them work. Tests ensure that your code does what it’s supposed to do and can assist you in designing the solution.

👩‍💻 My code

Here I present my code, which, although it still has several areas for improvement, gave me a lot of excitement to see it running.

My code running.

By the way, search for the Game of Life on Google and discover the magic. I’ll also share a video here that I found very emotional. I enjoyed it because it represents my feelings while solving the Game of Life.

If you create your version of the Game of Life, please share it with me. I would be delighted to review it.

Thank you very much for reading. If you have any comments, suggestions, or ideas, I’ll be happy to read and collaborate to grow together. ❤️

Disclaimer: I am improving my English so the article may have some grammar and writing errors. I’ll keep getting better I promise.

www.itzareyes.mx

--

--

Itza Reyes
Itza Reyes

Written by Itza Reyes

Me encanta trabajar con personas, resolver problemas y crear software asombroso. | Tech Lead @Creditas | https://www.itzareyes.mx/

No responses yet