Skip to content

Instantly share code, notes, and snippets.

@iandouglas
Last active March 1, 2018 16:20
Show Gist options
  • Select an option

  • Save iandouglas/6d9d8cd543854abed1d01a35ec945deb to your computer and use it in GitHub Desktop.

Select an option

Save iandouglas/6d9d8cd543854abed1d01a35ec945deb to your computer and use it in GitHub Desktop.
Turing Code Retreat - Game of Life

Code Retreat Rules of Engagement

Agenda:

  • 9:00am, kick-off in Clarke Hall and Iteration 1
    • 10:20am, break time
  • 10:30am, meet back in Clarke Hall for Iteration 2
    • 11:50am, break for lunch
  • 1:00pm, meet back in Clarke Hall for Iteration 3
    • 2:20pm, break time
  • 2:30pm, meet back in Clarke Hall for Iteration 4
    • 3:50pm, done!

Notes:

  • You are excused from the code retreat only for the iteration time which coincides with your portfolio review.

IMPORTANT

This code retreat isn't about finishing, it's about the process of working together with other students

Game of Life, Background and Summary

The full story: https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

The main concepts:

You have a 2-dimensional grid, either a square or rectangle, which will contain a random number of "cells" placed around the grid. The cells live, die, or reproduce, based on the following rules:

  • Any live cell with fewer than two live neighbours dies (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 (overpopulation)
  • Any dead cell with exactly three live neighbours becomes a live cell (reproduction)

Your application should not require any user input, and each "round" (generation) may modify the cells in the grid.

Find a way to display your grid with a brief pause in between each generation such that it appears to animate.

Tips

  • each iteration should begin with 100% new code
  • test your code
  • start small, less than a 10x10 grid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment