True enough. Yes, that should work. If you can guarantee that you've run the pi climbers far enough that they've climbed well beyond the debris, so that there are no pieces of ash in a corner of your bounding rectangle, then golly.hash() should be fine.HartmutHolzwart wrote:The XOR is an alternative way to reach the same goal. I didn't want to hash the whole pattern, but only the relevant part of it. And then compare the hash of the relevant part to the original pie sequence. I was lead to the hash function as it states that the hash is pretty unique and independent from the actual location.
I guess probably 270 ticks is enough, especially if the defined rectangle only reaches down to the front part of the last pi -- if the front part is still there at T=270, then presumably the whole thing survived intact.
I always seem to want the hash function to operate on cell lists, not rectangles. Often it's necessary to create a new layer and drop a pattern into it, just so that I can use golly.hash(). But in this case it should do just what you want.
An equivalent trick would be just to remember the original cell list -- oldpat=golly.getcells(oldrectangle) -- and then see if it's equal to a transformed copy of the new cell list: newpat=g.transform(golly.getcells(newrectangle),0,102). That would avoid any possible false matches -- though I'm pretty sure collisions in the hashing function are so rare that it's really pointless to worry about them. golly.hash() is more efficient in this case, since list comparisons have to do so much more work -- but golly.transform() is fast and useful, so seemed worth mentioning.