On 16 January 2018 at 22:05, Photon <[email protected]> wrote:
> That looks ideed cool thanx Nicolai for the hint.
>
> @Ben du you have an idea how to store the prevoius generations? I case
> something cool happens and you want to rewind to have a closer look
In a well designed app, you'd have "grid" instance variable instead of
"cellsAlive"
so then it could be something like...
LifeGrid >> storeGeneration
generations ifNil: [generations := OrderedCollection new].
generations add: grid copy.
but perhaps manipulating a single grid in-place causes complications
and you are better off
replacing the whole grid each generation. Then you don't need the #copy.
cheers -ben