Skip to main content

Jogo da vida

O que é?

É uma simulação que segue regras bem definidas de como um grupo de seres vivos deve se orientar. O jogo foi criado de modo a reproduzir, através de regras simples, as alterações e mudanças em grupos de seres vivos, tendo aplicações em diversas áreas da ciência. É definido um tabuleiro bidimensional (nesse código será considerada uma matriz quadrada para facilitar a representação computacional) com valores binários para definir se o elemento da matriz - que representa uma célula, por exemplo - está viva, ou morta.

É o exemplo de autômato celular mais conhecido e foi criado por John Conway, em 1970.

Nesse código será adotado 0 para morto e 1 para vivo.

Regras

  • Toda célula morta com exatamente três vizinhos vivos torna-se viva (nascimento);
  • Toda célula viva com menos de dois vizinhos vivos morre por isolamento;
  • Toda célula viva com mais de três vizinhos vivos morre por superpopulação;
  • Toda célula viva com dois ou três vizinhos vivos permanece viva.

Desenvolvimento

O jogo não precisa de interações com o usuário após a declaração do estado inicial. Ele é interessante para analisar como um estado pode evoluir para um mais complexo, dado regras simples. Para conhecer mais sobre a criação desse tipo de algoritmo, recomendo ler a página do Wikipedia (https://pt.wikipedia.org/wiki/Jogo_da_vida). Lá consta diversas curiosidades sobre a criação e como você pode encontrar aplicações diferentes (até na música!) do jogo da vida.

Sobre o código

A configuração inicial do estado da população é feita por inputs no terminal. O resultado é mostrado no terminal, mas é possível também salvar as gerações em um arquivo .csv, para algum estudo estatístico futuro.

Contribuições

Quer contribuir com uma nova feature? Perfeito. Quer sugerir/colaborar em algo? Me envie um e-mail para me15degrees@poggers.team, ou abra uma issue.

Game of Life

What is it?

It is a simulation that follows well-defined rules on how a group of living beings should orient themselves. The game was created to reproduce, through simple rules, the alterations and changes in groups of living beings, having applications in various areas of science. A two-dimensional board is defined (in this code, a square matrix will be considered to facilitate computational representation) with binary values to define whether the element of the matrix - which represents a cell, for example - is alive or dead.

It is the most well-known example of a cellular automaton and was created by John Conway in 1970.

In this code, 0 will be used for dead and 1 for alive.

Rules

  • Any dead cell with exactly three live neighbors becomes alive (birth);
  • Any live cell with fewer than two live neighbors dies by isolation;
  • Any live cell with more than three live neighbors dies by overpopulation;
  • Any live cell with two or three live neighbors remains alive.

Development

The game does not need interactions with the user after declaring the initial state. It is interesting for analyzing how a state can evolve into a more complex one, given simple rules. To learn more about the creation of this type of algorithm, I recommend reading the Wikipedia page (https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life). There you will find various curiosities about its creation and how you can find different applications (even in music!) of the game of life.

About the code

The initial configuration of the population state is done through inputs in the terminal. The result is displayed in the terminal, but it's also possible to save the generations in a .csv file for future statistical studies.

Contributions

Want to contribute a new feature? Perfect. Want to suggest/collaborate on something? Send me an email at me15degrees@poggers.team, or open an issue.

Metadata

Release files for gvita 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gvita 0.5.0
File Size Uploaded
gvita-0.5.0.tar.gz 5.5 kB Details

Release files / gvita-0.5.0.tar.gz

Download URL gvita-0.5.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6e33925c20a7d534cb0828f79852382db45c49f70fe80dfcce665c8121be1963
BLAKE2b-256 checksum
How to use checksums
1d0bdade7ec66d9ee5db8a14ce957eec32ea60f90145b01ff3e8d94d4a64eef6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.5.0 This release

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page