Computer Science Canada

Conway's Game of Life

Author:  Wakening [ Sun Apr 15, 2012 9:40 am ]
Post subject:  Conway's Game of Life

What is it you are trying to achieve?
Creating an efficient simulation of Conway's Game of Life


What is the problem you are having?
The process which decides the next generation is far too inefficient and requires too much cpu


Describe what you have tried to solve this problem
Changing the drawing/displaying procedure and integrating it into the next gen. cycle procedure
Changing array types to boolean instead of integer

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
See attached File


Please specify what version of Turing you are using
4.1


Any help would be greatly appreciated.

Author:  Wakening [ Sun Apr 15, 2012 9:42 am ]
Post subject:  Re: Conway's Game of Life

For anyone who is not familiar with Conway's Game of Life
http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

Author:  Raknarg [ Sun Apr 15, 2012 2:37 pm ]
Post subject:  Re: Conway's Game of Life

It seems to work fine for me. However, you can look at the one that zylum made a while back that I saved:

Author:  Raknarg [ Sun Apr 15, 2012 2:41 pm ]
Post subject:  RE:Conway\'s Game of Life

actually, I did chage one thing just to make myself happier:
Turing:

procedure Cycle
    for ix : 2 .. totalx - 1
        for iy : 2 .. totaly - 1

            if arena (ix, iy) = true then
                drawfillbox (ix * 5, iy * 5, ix * 5 + 4, iy * 5 + 4, black)
                if EdgeCount (ix, iy) < 2 then
                    temparena (ix, iy) := false
                elsif EdgeCount (ix, iy) > 3 then
                    temparena (ix, iy) := false
                end if
            elsif arena (ix, iy) = false then
                if EdgeCount (ix, iy) = 3 then
                    temparena (ix, iy) := true
                end if
            end if

        end for
    end for
   
    for ix : 2 .. totalx - 1
        for iy : 2 .. totaly - 1
            arena (ix, iy) := temparena (ix, iy)
        end for
    end for

    View.Update
    cls
end Cycle


I think it makes more sense only to draw where the points are alive and then just wipe it after.


: