Hi Vanessa,
 don't you find it difficult to understand? I mean, I do not understand how it goes from the rules of the game (*) to that code... I can not map that implementation to the rules of the game... Can someone explain to me or point me to a paper/description of why that implementation works? 

 I did two implementations of the game a long time ago. One that goes over the board twice and another that goes only once. 
 These implementations try to be as declarative as possible. For example, the one that passes over the board twice is: 
nextGeneration
    aliveCells := self cellsToSurviveOnNextGeneration union: self cellsToResurectOnNextGeneration

 The one that passes over the board once is:
nextGeneration
  aliveCells := self boardCellsSelect: [ :aCell | self shouldBeAliveOnNextGeneration: aCell ]

aliveCells is a Set of the alive cells of the game. I think you can deduce what the other messages do.
Of course it is not as performant as Dan's implementation... If someone can direct me to some info or explain to me why Dan's implementation works I will appreciate it.

Thanks!
Hernan

(*) I use the definition of https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

On Thu, Jan 19, 2023 at 5:54 AM Vanessa Freudenberg <vanessa@codefrau.net> wrote:
 
On Wed, Jan 18, 2023 at 11:33 AM karl ramberg <karlramberg@gmail.com> wrote:
 
Here is a version of Dans Game of Life that almost work ;-P
Some methods have changed names and I'm not sure about the BilBlt combinations rules used.

Best,
Karl

Here's one that does work. Took the liberty to reorder things a bit so I could better understand what it does.

Vanessa

On Mon, Jan 16, 2023 at 9:55 PM tim Rowledge <tim@rowledge.org> wrote:
 


> On 2023-01-16, at 12:00 PM, karl ramberg <karlramberg@gmail.com> wrote:
>
> Very cool. I would not volunteer to refactor that :-D
>
> It's tricky to get high performance GameOfLife in Squeak.

Have you never seen the BitBLT based version Dan Ingalls wrote a gazillion years ago? It used to be in the Squeak image, or at least I feel pretty sure it was.

Oh, wait! It was written up in the Byte81 issue, so see https://archive.org/details/byte-magazine-1981-08/page/n181/mode/2up?view=theater and the following pages.

tim
--
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim
Klingon Code Warrior:- 8) "By filing this bug you have questioned my family honor. Prepare to die!"




--
Hernán Wilkinson
Agile Software Development, Teaching & Coaching
Phone: +54-011-4893-2057
Twitter: @HernanWilkinson
Address: Alem 896, Floor 6, Buenos Aires, Argentina