Skip to content

Instantly share code, notes, and snippets.

@bitops
Created October 12, 2012 22:14
Show Gist options
  • Select an option

  • Save bitops/3881904 to your computer and use it in GitHub Desktop.

Select an option

Save bitops/3881904 to your computer and use it in GitHub Desktop.
Auto-generated Description
Already, note a complication: New elements in the list must be introduced if the pattern grows over a block's boundaries, but we have to know if the block's neighbor already exists. You can either do a simple linear search of the list, or binary search, or keep some kind of map. I chose to make a hash table. This is solely used for finding the neighbors of a new block; each existing block already keeps a pointer to its neighbors, as they will be referenced often.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment