2 comments

  1. M. Bass says:

    So about the 2^9 switch vs the if statements…

    I think the most effecient way would be to setup a 9-D array of binary values (64 bytes, so not that big really). Then for each timestep for each location you address the array with the binary values of the surrounding and central cells (eg life[1][1][1][0][0][0][0][0][0]=1 for the situation:
    111
    000
    000
    so the central cell would turn on.)

    Great show btw!

  2. J. Bowman says:

    If you are checking everything locally, for each cell, you need to check the state of the cell, and the states of each neighbor. If, on the other hand, you have a library of each global state and the state that it leads to, you only need to check the state of each cell once to determine the next global state (using a binary search tree). If your board has n cells, it translates to a O(n) savings in processing time. The tradeoff, of course, is having to store 2^n outcomes, versus having to store 0 when you're checking things locally. If you have the disk space, and want to run billions of iterations, it might be a consideration.

Leave a Reply

Your email address will not be published. Required fields are marked *