The purpose of this repo is to show my journey in trying to design and build the Game of Life of John Horton Conway fame in a simple ruby environment.
So far I've concluded that I need to design the game based a 2d array that houses the actions in the code.
We'll call this 2d array the "grid." As per the assignment, the size of this grid will be based on standard user input.
Within this grid, there will be an initial colony, a randomly generated 3x3 square.
Each square of the colony will have a value of either dead (0) or alive ("a")
The program assesses the value of each cell in the colony and determines whether or not the primary_cell will live into the next generation based on the following rules:
- Any live cell with fewer than two live neighbours dies, as if caused 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.
- Creating a 2d array
- Random assignment of a primary cell's coordinates and status
- Create a second 2d array of its neighbors and assign status
- Assess the status of each neighbor and affect primary cell status
- Unable to create next generation
- Unable to apply "colony" or neighbors method to all cells
- Create a second array for next generation and replace main variable.
- Create a 2d array that randomly assigns life status to each cell
- Allows user to set world dimensions, initial population density, and live cell style.
- World respects array bounds and doesn't "wrap" as in the Matrix option.
Unable to apply previous colony/neighbor logic to all cells- Unable to initiate user input as a method inside the class.
- Experiment with a second class to keep all methods inside the classes.
- Implement user options to set specific population that yield the desired patterns
- Able to specify world size through standard user input
- Users can determine population density that triggered by a ternary operator statement
Matrix.build(size) { rand(population) == 0 ? 1 : 0 }- Neighbor counts are determined by "stacking" and reducing each matrix vector.
- Game rules truncated to 2 options:
count == 3 || count == 4 && @board[idx / width, idx % width] == 1 ? 1 : 0- Installed toilet to create a more graphical introduction.
- Employed emoji's for the world display using unicodes.
- Incorporated a Thread instance to allow user to stop the program without ^C.
- Neighbor Count does not respect array bounds and "wraps" to the opposite bound.
- Create the option for allowing user to input particular patterns that generate certain results
- Track ecah generation
- Allow user to select display "themes."