Skip to content

Instantly share code, notes, and snippets.

@bkerley
Created December 3, 2011 21:24
Show Gist options
  • Save bkerley/1428195 to your computer and use it in GitHub Desktop.
Save bkerley/1428195 to your computer and use it in GitHub Desktop.
  1. start with a queue Q1 of all the live cells followed by a "end of live" tombstone

  2. before tombstone reached:

  3. pull cell C from queue

  4. add C's dead non-queued neighbors to queue

  5. add C to queue Q2 if it shall live

  6. repeat

  7. after "end of live" tombstone reached:

  8. put "end of dead" tombstone on Q1

  9. pull currently-dead cell C from queue

  10. add C to queue Q2 if it shall live

  11. repeat

  12. after "end of dead" tombstone reached:

  13. queue Q1 is finished, display and trash

  14. put "end of live" tombstone on Q2

tombstones wait for any per-cell processing to finish

queues cannot be processed until previous queue is finished

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment