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
Chess GUI

Lucas Chess Lucas Chess is a GUI of chess: To learn to play chess. To play chess against engines. Dependencies Python 2.7 PyQt4 PyAudio psutil Python

Lucas 322 Dec 20, 2022
A small Python Library to process Game Boy Camera images

GameBEye GameBEye is a Python Library to process Game Boy Camera images. Source code 📁 : https://github.com/mtouzot/GameBEye Issues 🆘 : https://gith

Martin TOUZOT 4 Nov 25, 2022
This is a basic virtual quiz game using opencv-python

Basic Virtual-Quiz-Game This is a basic structure of a virtual quiz game using opencv-python. As the camera window opens up we can see the questions a

2 Dec 11, 2021
Historical battle simulation package for Python

Jomini v0.1.4 Jomini creates military simulations by using mathematical combat models. Designed to be helpful for game developers, students, history e

Ümit Kaan Usta 36 Dec 08, 2022
Brawl Stars open source server for v20

Laser Scratch Brawl Stars open source server for v20! Implemented Features Battle End Leaderboard Player Profile Lobby Info Menu Notifications Club Wa

TheIke 17 Nov 19, 2022
A small module for creating a card deck, used for making card games

card-deck This module can be used to create small card games such as BlackJack etc.. To initialize the deck, use: Deck() To shuffle the deck, use: Dec

4 Dec 31, 2021
Easy and fun game to play a bit. Written in python

NumGuesser Easy and fun game to play a bit. Written in python

Lodi#0001 4 May 22, 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
Pygame Raycaster made by me.

Pygame Raycaster made by me.

Sable 0 Jan 10, 2022
Bingo game with python

bingo-game-with-python type of plays possible player vs computer player vs player computer vs computer game is built with 4 objects classes 1.game 2.b

1 Nov 27, 2021
A full featured game of falling pieces using python's pygame library.

A full featured game of falling shapes using python's pygame library. Key Features • How To Play • Download • Contributing • License Key Features Sing

Giovani Rodriguez 7 Dec 14, 2022
A stat tracker for the bedwars hypixel game in python

A hypixel bedwars stat tracker. Features Get stats in your current lobby Get stats in a guild Installation & Configuration git clone https://github.co

Le_Grand_Mannitout 3 Dec 25, 2021
Open source Brawl Stars server emulator for version 29 of the game!

Welcome to Classic-Brawl v29 Remake 👋 Open source Brawl Stars server emulator for version 29 of the game! (Remake) What's working ? Battles Trophies

CrossFire 4 Jan 19, 2022
MCRPC (Minecraft Resource Pack Comparator) checks your resource pack against any version of Minecraft to show resources missing from your pack for that version.

Minecraft Resource Pack Comparator MCRPC checks your resource pack against any version of Minecraft to show resources missing from your pack for that

3 Nov 03, 2022
AI based assitant for minecarft

Minecraft_AI_assistant AI-based assistant for Minecraft There are 4 steps to build 1-I'm using collecting_data.png as a structure to take shots with c

Murat Ali Avcu 13 Oct 16, 2022
Replicating Minecraft World Generation in Python

Minecraft World Generation in Python This is an attempt to replicate Minecraft world generation in Python. This is part of an article published on Med

Bilal Himite 159 Dec 19, 2022
OpenGL experiments with Pygame & ModernGL

pygame-opengl OpenGL experiments with Pygame & ModernGL TODO Skybox & Reflections Post-process effects (motion blur, color correction, etc..) Normal m

Kadir Aksoy 4 Oct 28, 2022
Solo CLF project about the creation of the FlickColor game in Python with very precise instructions.

Solo CLF project about the creation of the FlickColor game in Python with very precise instructions.

COZAX 1 Dec 09, 2022
A fun discord bot for music, mini games, admin controls, economy, ai chatbot and levelling system

A fun discord bot for music, mini games, admin controls, economy, ai chatbot and levelling system. This bot was specially made for Dspark discord server.

2 Aug 30, 2022
A Python tic tac toe game

Tic Tac Toe A Python tic tac toe game To start the game, run python3 main.py First, you have to select the game level. Today, it has three levels In a

Phant 1 Jan 14, 2022