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 (Mac screensaver)
Index -> Programming, C -> C Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DtY




PostPosted: Sat Mar 20, 2010 9:51 pm   Post subject: Conway's Game of Life (Mac screensaver)

The starting scenario is randomly generated, and didn't turn out as well as I'd hoped, but better than a fixed scenario (imo).


conway.saver.zip
 Description:

Download
 Filename:  conway.saver.zip
 Filesize:  11.15 KB
 Downloaded:  366 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Sat Mar 20, 2010 10:06 pm   Post subject: RE:Conway\'s Game of Life (Mac screensaver)

I get an error. I double-clicked the icon, which promped me to install it, and after doing that I went to desktop & screensaver and trying to test it it says it can't load bundle. Is this incompatable with 10.5.*? Snow leopard only?
DtY




PostPosted: Sat Mar 20, 2010 10:15 pm   Post subject: RE:Conway\'s Game of Life (Mac screensaver)

Are you on a power PC processor? I may have built it only for x86_64, I'll try building a universal binary, and see if that would work.
DtY




PostPosted: Sat Mar 20, 2010 10:27 pm   Post subject: Re: Conway's Game of Life (Mac screensaver)

Okay, I'm not sure how to do that; I tried changing the target SDK to 10.5, but that broke it on my computer, same with setting it to create a universal binary.

But here is the source with an xcode project. It doesn't use any special libraries, so just the Apple developer tools should be enough to build it (I'm pretty sure the package is on the installation DVD, if not you should be able to find them online).

[edit] Just so you know, you can't build and run a screensaver from xcode (as far as I can tell), you have to build the project, then install the screensaver from finder in the build directory.



Archive.zip
 Description:
Source

Download
 Filename:  Archive.zip
 Filesize:  15.54 KB
 Downloaded:  214 Time(s)

Insectoid




PostPosted: Sat Mar 20, 2010 10:34 pm   Post subject: RE:Conway\'s Game of Life (Mac screensaver)

I'm on intel, so that won't be the issue. I'll try building tomorrow, unless you can upload the 10.5 one for me.
DtY




PostPosted: Sun Mar 21, 2010 2:21 am   Post subject: Re: Conway's Game of Life (Mac screensaver)

Well, I found out why it looked so boring; I was doing it wrong. First, it was just switching between two boards, once I noticed this, I commented out the stuff that should have been checking each cell to decide if it's alive or not, and it did the exact same thing. I can't remember how I fixed that though. Afterward, when I ran it, cells would just die out until there were a few that were stable, and it would do nothing, this was fixed after I found out that conway's is supposed to check eight neighbours, and not four.

So, here is the source, and Snow Leopard binary for the proper version. I changed the cell drawing to be slightly transparent (90% opaque) so that the cell does not disappear after a single "day", but takes two, and the same with showing up, so you can see there are shadow type things on the screen, they're intentional. I also upped the frame rate from 1Hz to 4Hz.



Archive.zip
 Description:
Source, XCode project

Download
 Filename:  Archive.zip
 Filesize:  16.07 KB
 Downloaded:  230 Time(s)


conway.saver.zip
 Description:
Snow Leopard Binary

Download
 Filename:  conway.saver.zip
 Filesize:  11.29 KB
 Downloaded:  241 Time(s)

endless




PostPosted: Sun Mar 21, 2010 9:31 am   Post subject: RE:Conway\'s Game of Life (Mac screensaver)

pretty cool, I'd use it if I normally used a screensaver.
USEC_OFFICER




PostPosted: Sun Mar 21, 2010 2:36 pm   Post subject: RE:Conway\'s Game of Life (Mac screensaver)

Question: Is there a way to randomize a new board after it grows stable?
Sponsor
Sponsor
Sponsor
sponsor
DtY




PostPosted: Sun Mar 21, 2010 4:45 pm   Post subject: Re: RE:Conway\'s Game of Life (Mac screensaver)

USEC_OFFICER @ Sun Mar 21, 2010 2:36 pm wrote:
Question: Is there a way to randomize a new board after it grows stable?
Right now, no, but I'll look into that for the future.

[edit] Any suggestions on how to detect if it's stable? Some configurations stabilize to a point of not being interesting, but continue moving, like with

code:

.0. ...
.0. 000
.0. ...
and continues that cycle.
USEC_OFFICER




PostPosted: Sun Mar 21, 2010 5:16 pm   Post subject: Re: Conway's Game of Life (Mac screensaver)

An easyish way would be to look for patterns like that, along with the different stable possiblities. Life Wiki has a lot of them.
A.J




PostPosted: Sun Mar 21, 2010 10:36 pm   Post subject: RE:Conway\'s Game of Life (Mac screensaver)

Interesting fact: I met John Conway at MathCamp at Tacoma, Washington last summer. I had lunch with him and we talked about interesting things!
dd




PostPosted: Fri Mar 26, 2010 8:14 am   Post subject: Re: Conway's Game of Life (Mac screensaver)

http://twilightedge.com/mac/crepuscularlife
Display posts from previous:   
   Index -> Programming, C -> C Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: