Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Conway's Game of Life
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Wakening




PostPosted: 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.



v1.3 Conway's Game of Life.t
 Description:
I'd like to increase the total size of the arena far more, but it's too taxing on my computer.

Download
 Filename:  v1.3 Conway's Game of Life.t
 Filesize:  3.19 KB
 Downloaded:  79 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Wakening




PostPosted: 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
Raknarg




PostPosted: 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:


Game of Life.t
 Description:

Download
 Filename:  Game of Life.t
 Filesize:  2.19 KB
 Downloaded:  71 Time(s)

Raknarg




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: