sabira-khan / ConwaysGameOfLife

A very simple (and a bit colorful) implementation of Conway's game of life in Java.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conway's Game Of Life

A single class containing a simple implementation of Conway's game of life in Java.

What is Game of Life?

In short, it is a single player game devised by British Mathematician John Conway, that simulates the birth and death of cells on a rectangular grid. The state of a given cell in any generation depends on the state of the cell and its eight immediate neighbors in the preceding generation, according to some simple rules:

  • Any live cell with fewer than two live neighbours dies, as if by underpopulation.
  • Any live cell with two or three live neighbours lives on to the next generation.
  • Any live cell with more than three live neighbours dies, as if by overpopulation.
  • Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
  • How to play or run this code

    1. You can copy the code and run it in your system. It's just a single class with no fancy stuff, so nothing to worry about.
    2. You can download the JAR file and just double click, sit back and enjoy the view.
    In either case, it will look something like this:

    GameOfLife.mp4

    Kinda cool, right? Let me know if you've got better ways to implement this. Happy coding!

    About

    A very simple (and a bit colorful) implementation of Conway's game of life in Java.


    Languages

    Language:Java 100.0%