Project: Game of Life Extensions

 


Introduction

In 1970, the British mathematician John Conway created his "Game of Life" -- a set of rules that mimics the chaotic yet patterned growth of a colony of biological organisms. The "game" takes place on a two-dimensional grid consisting of "living" and "dead" cells, and the rules to step from generation to generation are simple:

By enforcing these rules in sequential steps, beautiful and unexpected patterns can appear.

The purpose of this project is to explore different starting configurations and other variations on life.


Exercises

  1. Make a copy of your Game of Life notebook in Google Colab and rename it for this project.
  2. Generating Different Worlds

  3. Rename the generateWorld function to be generateRandomWorld. Modify your simulation function to use this newly-named function and test that the behavior looks the way you expect.

  4. Create at least two more world-generating functions based on patterns found at Game of Life Extensions or Conway's Game of Life in Python. Your two worlds should come from different categories (Still Life, Oscillating, Spaceship, Perpetual). Things to think about:
    • What parameters do your new functions need?
    • Since you won't be generating random 1s and 0s, it might make sense to create a world of all 0s and then change the cells for the particular starting configuration to be 1.
    • Make sure you return the world at the end of the functions.

  5. In a new Code cell you should test that each of your new world-generating functions works properly. For each of your functions, call the function with some size, say 10 or 20, and store the world that gets returned in a new variable. Then print that variable. Do this for each of your new functions. Make any edits in your world-generating functions as needed.

  6. In your simulation function, comment out the line that calls the generateRandomWorld function and add a statement to call one of your new world-generating functions. What happens in the simulation?
  7. Run the main function with your other world-generating function(s) with several different-sized worlds.

  8. Add a Text cell and describe what you see happening in the simulations with these different worlds.

    Modifying the Program Design

    In order to make the program a little easier to use, some reorganizing/redesigning will be helpful.

  9. Since the generateRandomWorld function is the only one that uses a user-specified proportion of cells to be alive, move that input statement from the main function to the generateRandomWorld function. Then remove the parameter corresponding to that value from the simulation and generateRandomWorld functions, as well as any calls to these functions. Make any other edits related to this as needed.

  10. Define a new function, generateWorld. This function should take the world size as a parameter. It should ask the user which type of starting world they would like to use. (Make sure the input request informs the user of their options and expected input values.) Based on that user-input, create the corresponding world. At the end of this function, return the world that was created.

  11. Modify your simulation function to call this new generateWorld function instead of a specific world-generating function.

  12. Run the program multiple times, selecting different world types, different sizes, and different numbers of generations.

    Variations on Life

  13. Read about Variations on Life. Choose one or more of these variations to implement in your program. Include descriptive comments in your code and use Text cells to explain what variation(s) you have chosen, what you expect to see happen, and what results you obtained. This is your chance to explore and be creative!

Submit