raganwald / hashlife

http://raganwald.com/hashlife
60 stars 7 forks source link

Allow for advancing by one generation #26

Closed joelangeway closed 11 years ago

joelangeway commented 11 years ago

Currently it advances by many generations or iterations or steps or whatever every time I hit the advance button. It would be a lot more fun potentially if I could advance one generation at a time to allow for some experimentation.

raganwald commented 11 years ago

It's an interesting problem for HashLife to calculate futures one generation at a time. The base algorithm takes a square with sides 2^n and calculates the future 2^(n-1) generations in the future. So if you have an active area that is 16 by 16, it will jump 8 generations into the future.

The full algorithm does have a recursive way to calculate futures that are smaller than 2^(n-1), but it actually requires more calculations to do it. I'll work on this and undo next.