The zero player Darwinism simulation game as described by Conway (demonstrates Turing Completeness)

Overview

Conway's Game of Life

The zero player Darwinism simulation game as described by Conway (demonstrates Turing Completeness).

I created this script after having made attempts to do the same project in the past, but being limited by the horizons of my knowledge. I've tried again recently and the algorithms I chose to use in this one were much faster. My old project often ran out of memory or spent ~20 seconds in between each generation, this project gets through a couple hundred at least in the same amount of time, but I digress.

If you aren't already aware, Conway's Game of Life is a thought experiment turned into a program which simulates natural selection in order to demonstrate the idea of Turing Completeness. In this "zero player game" as Conway described it, cells are given an initial state, or seed, and then the rules below are applied over and over, for an undecidable amount of time in most cases.

The rules are as follows:

  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.

For further information on the game itself (and for generally interesting information told in a digestible format) see this video: https://www.youtube.com/watch?v=HeQX2HjkcNo

Keep reading if you care to know the implementation / thought process behind the program's algorithm (it isn't obvious just looking), otherwise you can stop here. (Note: this is all pure Python, no Cython)

The most naive approach, and the one I had used to tackle this problem the first time is essentially brute force. In this method, I stored every cell in a list. When I needed a particular cell in a particular position, I used a method that would search that list, checking each and every Cell's x and y values until I found the exact one I needed. Not the best time complexity wise, especially when you have to do something that simple so often. Even worse, when grabbing the neighbors, I simply repeated the same thing 8 times. The benefits of such an approach are limited mostly to simplicity, and of course, this approach did not work. At extremely small scales, with "non explosive" patterns, the algorithm did appear to work in terms of the rules, but it certainly did not work with my GPU.

The next approach I tried, some few months later, was to use a dictionary to store cells by location. This is certainly getting there, and is actually implemented in my current version, however it does not go far enough. Neighbors were still grabbed manually, methods handling cell positions and graphics were stil slow and unoptimized, and there was a lot of unnecessary clutter.

In the current approach, I store the grid in the format dict[tuple[int, int], dict[tuple[int, int], bool]] such that the outer tuples are the locations of a cell, the inner dict tuples are locations of that cells neighbors, and the boolean values are the cells dead or alive status. This comes with the benefit of constant lookup times in all aspects regarding cells, leaving almost all time constraints up to the algorithms themselves. I would love to say there are more major optimizations but this data structure is actually hyper-efficient compared to my previous iterations of this project, and it's likely doing all the heavy lifting. That isn't to say there aren't other optimizations, though. There are probably hundreds of micro-optimizations scattered throughout this code compared to the old attempts.

##################################################################################################################################################################

The reason I chose to write so much about this project is due to my lack of having a GitHub account before this. I did not upload the old versions of this project, nor anything else I have ever written, and my digital organizational skills are poor, so they are lost to the sands of time as far as I'm considered. This readme is to make up for that lost history, I suppose. In the future I'll only be doing this much if there is really this much to say. I'll also be uploading all my major and minor projects (anything that is more than a "quick script") on GitHub from here on out. Thanks for reading.

Owner
jachinema
Been coding for a little while, I do projects for fun when I can. Rate of doing so is slow at the moment because of school, but I try.
jachinema
A python-based multi-player online educational game for students to play in a class or club setting.

Kurono (codename: aimmo) Code for Life has been developed by Ocado Technology as a free, open-source project to inspire the next generation of compute

Ocado Technology 108 Nov 07, 2022
Multiplayer 2D shooter made with Pygame

PyTanks This project started as a one day project with two goals: Create a simulated environment with as much logic as possible written in Numpy, to o

Felix Chippendale 1 Nov 07, 2021
SuperChess is a GUI application for playing chess.

About SuperChess is a GUI application for playing chess. It is written in Python 3.10 programming language, uses PySide6 GUI library, python-chess lib

Boštjan Mejak 1 Oct 16, 2022
A short non 100% Accurate Solar System in pygame

solar-system-pygame Controls UP/DOWN for Emulation Speed Control ESC for Pause/Unpause q to Quit c or ESC again to Continue LEFT CLICK to Add an orbit

LightCrimson 2 May 28, 2022
The zero player Darwinism simulation game as described by Conway (demonstrates Turing Completeness)

Conway's Game of Life The zero player Darwinism simulation game as described by Conway (demonstrates Turing Completeness). I created this script after

jachinema 1 Feb 13, 2022
The DOS game from the 80s re-written in Python from Scratch!

Drugwars The DOS game from the 80s re-written in Python from Scratch! Play in your browser Here Installation Recommended: Using pip pip3 install drugw

Max Bridgland 45 Jan 03, 2023
We tried to recreate this classic game using python physics libraries.

We tried to recreate this classic game using python physics libraries. The result is certainly hilarious but enjoyable. One of my very first physics application.

Delwys Glokpor 2 Dec 12, 2021
Code infrastructure and player algorithms for the Codenames board game.

Codenames Code infrastructure and player algorithms for the Codenames board game. This is the active fork of mkali-personal/codenames. Intro This is b

Asaf Kali 1 May 18, 2022
Chess turnament organizer (short construct concept)

Turnament Organizer Chess turnament organizer (short construct concept). It is my hobby app I want to write to support lightweight tool for smart roun

kkuba91 3 Dec 16, 2022
2d war game single player

WarGame-third-version-0.0.4- 2d war game single player Hi ! Today, I publish on GitHub the version 0.0.4 of "WarGame". In this version, you can find a

Edouard Vincent 2 Apr 08, 2022
Play a game of Phazed with a bot or with other players or watch bots play with each other

Phazed Game and Player play a game of Phazed with a bot or with other players or watch bots play with each other Live Demo hosted on repl.it (makes su

Xin Yu 0 Aug 28, 2021
Setup minecraft server (Tuinity) to your directory

hapeshiva server-setup Setup minecraft server (Tuinity) for you. Support for optimization Create optimized yml Customazible server port and view dista

3 May 11, 2022
PLVRA is a TUI (Terminal User Interface) implementation of wordle / termo in portuguese, written in Python

PLVRA is a TUI (Terminal User Interface) implementation of wordle / termo in portuguese, written in Python

Enzo Shiraishi 1 Feb 11, 2022
Pyvidplayer - An extremely easy to use module that plays videos on Pygame

pyvidplayer An extremely easy to use module that plays videos on Pygame Example

17 Dec 05, 2022
A Pygame application which generates mazes using randomized DFS (Depth-First-Search)

Maze-Generator-with-Randomized-DFS A Pygame application which generates mazes using randomized DFS (Depth-First-Search)-(Iterative implementation). Ra

Aysha sana 2 Feb 08, 2022
Among Us Editor written in Python, for newer versions of the game

Among Us Editor Remake Among Us Editor written in Python, for newer versions of the game. Credits GUI Code by Vresod Data dumping and some GUI code by

Vresod 7 Nov 18, 2022
A minimal open source mtg-like tcg game made in python that can be played on a terminal emulator using a keyboard.

A minimal open source mtg-like tcg game made in python that can be played on a terminal emulator using a keyboard.

Amos 3 Aug 29, 2021
This is a simple Tic-Tac-Toe game.

Tic-Tac-Toe Nosso famoso e tradicional Jogo da Velha, mas agora em Python. Development setup Para rodar o programa, basta instalar python em sua maqui

João Assalim 1 Oct 10, 2022
🍦 Cheat for cs:go written in Python.

Cs::Fuck 🍦 Cheat for cs:go written in Python. You can show a video here: https://vimeo.com/642730650 Feature. TriggerBot Glow Esp NoFlash Setup. 0. p

Ѵιcнч 10 Sep 23, 2022
Minecraft clone using Python Ursina game engine!

Minecraft clone using Python Ursina game engine!

Taehee Lee 35 Jan 03, 2023