Skip to content

Gi0NZ/GameOfLife

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Game of Life

Game of Life

Game of Life is a zero-player game where the evolution of the instance is solely based on the initial state given to the machine. One interacts with the game by inputing the initial configuration and then watching how it evolves.

game of life gif

The idea of the "Game of Life" is based on an infinite two-dimensional grid, basically a matrix, composed of square cells, where each can only have 1 of 2 possible states: alive or dead, that are the equivalent of populated and unpopulated. The evolution itself is based on the continous interaction between a cell and its 8 adiacent neighbours, with whom, at each step, occurs:

  • Any live cell with less than 2 live neigbors dies, representing underpopulation.
  • Any live cell with 2 or 3 neighbours lives on to the next generation.
  • Any live cell with more than 3 live neighbors dies, representing overpopulation
  • Any given cell with 3 exactly 3 neighbors becomes a live cell, representing reproduction

By default, the starter pattern, which also constitutes the seed of the whole system, is created by applying all of the above rules simultaneously to every cell.

How to run

First and foremost, to run the code above you'll need to install an MPI version, in this case OpenMPI is used. For reference and info, check their website here: OpenMPI

Once you have a full functioning MPI version installed, you can download the above file. Got it? Good. Now, in order to execute it you'll need to:

  • Compile the file (with the command "mpicc gameoflife.c -o your_exec_name"
  • Run the program (mpirun -np #proc your_exec_name) NOTE: you may need to add "--allow-run-as-root" to have it run.

#Notes

Note that the above picture is an illustration of the mekanism itself, it is not a representation of the functioning code.
The presented code simply prints a boolean matrix, containing either alive or dead cells.

About

This repo contains my "GameOfLife" file, a little MPI-based project create in my "Progettazione Concorrente, Parallela e su Cloud" uni course.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages