Welcome to the 3D Game of Life project! This implementation provides an interactive visualization of Conway's Game of Life in a 3D space using Mayavi.
The rules of the Game of Life 3D are an extension of the classic Game of Life rules into three dimensions. Here are the key points:
-
Birth and Survival: A cell in the 3D grid is "born" if it has exactly a certain number of live neighbors, similar to the 2D version. Additionally, a live cell survives to the next generation if it has a specific number of live neighbors.
-
Neighborhood Definition: In the 3D version, each cell has 26 neighbors, accounting for all adjacent cells in the three dimensions (including diagonals).
-
Overpopulation and Underpopulation: If a live cell has too few (underpopulation) or too many (overpopulation) live neighbors, it dies due to isolation or overcrowding, respectively.
-
Birth Conditions: A cell becomes alive in the next generation if it is currently dead and has a specific number of live neighbors, simulating reproduction.
-
Static and Oscillating Patterns: The Game of Life 3D, like its 2D counterpart, can exhibit static patterns where cells remain unchanged, or oscillating patterns where cells alternate between different states over generations, providing dynamic and evolving structures in the three-dimensional space.
Follow these steps to run the code and explore the 3D Game of Life:
- Python installed on your system
- GPU for optimal performance
- Clone the Repository onto a system with GPU.
- Pip install all the required libraries (requirements.txt) ( pip install numba mayavi numpy flask flask-socketio requests )
- Run
python main.py
which will launch a Mayavi visualization window. This will launch a Mayavi window, providing an interactive visualization of the generations. - Run
python servermain.py
on a system with GPU as this has the kernel code. If you are running these two files on different systems, please updateservermain.py
file, line 77, with the public URL to your system wheremain.py
is running:url = 'http://localhost:5000/receive'
- That’s it we have our 3D Game of Life Ready.
Objective: To compare the execution times of a specific task with and without GPU acceleration. We have performed many tests with different sizes of worlds, starting from (101010) to (100100100).
- Execution Time: 0.000773030098 seconds
- Execution Time: 0.0004838885683 seconds
The execution time with GPU acceleration (Run 2) is approximately 37.5% smaller than without GPU acceleration (Run 1). This reduction in execution time suggests that utilizing GPU resources has led to a performance improvement for the given task.