Your task is to write a program to calculate the next generation of Conway's game of life, given any starting position. You start with a two dimensional grid of cells, where each cell is either alive or dead. The grid is finite, and no life can exist off the edges. When calculating the next generation of the grid, follow these four rules:
- Any live cell with fewer than two live neighbors dies, as if caused by underpopulation.
- Any live cell with more than three live neighbors dies, as if by overcrowding.
- Any live cell with two or three live neighbors lives on to the next generation.
- Any dead cell with exactly three live neighbors becomes a live cell.
(Source)
- Find all living neighbors of a given cell (tests)
- Convert grid in text file to two dimensional array (tests)
Cell returns it's current status: live or dead (tests)- Fate will determine a cell_fate: born, live or dead (tests)
- All files should be independent of each other except life-generation.rb
- cell
- fate
- grid
- neighbors/living neighbors
- The Generation class should, for each cell in the grid and:
- find number of living neighbors
- get current status
- return determined fate
- add cell's new status to a next_gen_grid array
- split into 2D array with same proportions as original grid & return
instance_of_grid.start_grid(num)
instance_of_neighbors.living_neighbors(x,y,grid)
instance_of_fate.cell_fate(status,living_neighbors)
instance_of_cell.status(status)