Introduction
Back in 1970, John Conway devised a simulation of cellular automation. The simulation or game was based around a grid with cells in it that either would be dead or alive based on a set of rules. The future status of a cell was determined by its neighboring cells before it. Given these simple rules there are immense mathematical combinations for the games outcomes. The rules state that :
- Any live cell with fewer than two live neighbors dies, as if by underpopulation.
- Any live cell with two or three live neighbors lives on to the next generation.
- Any live cell with more than three live neighbors dies, as if by overpopulation.
- Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
Why Build your Own
When I was learning coding I found that Conway's game of life provided a new programmer a good template for learning more about the basics within their given language. For starters, although the rules are simple it forces a young programmer the need to start thinking algorithmically. "How am I going to check the spaces around a cell?", "How do I update all cells at once?", etc. are questions this project forces you to ask and answer. Next it provides a good basis for working with data structures, and although there are multiple data structures one could use, choosing the right one will make the process of development easier. Next depending on how far you go with this project you can include user input, a start and stop or added features that will add the need to deal with event handling and a working user interface. Creation of a game also makes you look at the modularity of your code and how well it is organized. It forces you to have to reuse functions, objects, or code blocks which will only benefit you going forward. Lastly, depending on the language you choose to work with it will give you experience in visualization of our code by displaying the grid of cells.
What I recommend You Do
For this specific project I would use a language that allows for easy visualization as your end project you would like to be seen by others. The two that come to mind are JavaScript, as you can place it in a web browser to see or python as they have several libraries for creating GUI windows (tKinter and PyQT). Next I would brush up on your knowledge of this languages basic data structures such as arrays or lists as they will come in handy for your development process. Next I would research the game itself, as I did a very quick overview above you might want to make an effort to understand the simulation itself. Lastly, if you are completely lost look to either my code above or this amazing video by The Coding Train as they were my inspiration for doing this project years ago.
Conclusion
All in all, when learning programming I feel it is best to build something. For me this was a great project in the early part of my learning and helped me develop a good foundation for me to build upon in my future years. I would say when starting try as much as you can to create this without looking up a solution or my code as it won't exercise your coding muscles as much. Please feel free to take a look at my development which is linked above if you want to see a working final product.
Thank You for Reading!
If you end up making your own Game of Life please comment below as I would love to see it. If you enjoyed reading or have any questions please like and/or comment below. Cheers 👋
Top comments (0)