Java data structures

Hard Prerequisites
  • PROJECTS: Java collections
  • TOPICS: Java collections and data structures

  • Game Time

    In this project we are going to create a GAME!!! fun right, its called Conway Game of life

    How This game works

    Initially, there is a grid (yours should be 10 * 10) with some cells which may be alive or dead. Our task is to generate the next generation of cells based on the following rules:

    1. Any live cell with fewer than two live neighbors dies, as if caused by under population.
    2. Any live cell with two or three live neighbors lives on to the next generation.
    3. Any live cell with more than three live neighbors dies, as if by overpopulation.
    4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.

    You will need to show in your console the initial state (input) and next generation

    (+) - Dead Cell

    (#) - Alive Cell

    Input

    / + + # + + +

    / + + # # # +

    / + + + + + +

    Next generation

    / + + # + + +

    / + + # # + +

    / + + + # + +

    You should have a test for all the rules above but you can also add more test if you want.


    RAW CONTENT URL