![]() |
| | #1 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,439
| Game of Life The basic rules of the game are explained here: http://en.wikipedia.org/wiki/Conway's_Game_of_Life Your objective is to implement a program that runs this simulation as fast as possible. Measure of performance is a) the number of CPU cycles used and b) the physical time used. (Mean of three runs.) The program will be executed for 3000 generations on two different patterns on two different machines. Each result will be given a score relative to the results of my reference implementation. (8 results: two measurements over two starting patterns and two machines) The mean of the score is the final result. Implementations that produce an incorrect result are disqualified. Implementations that need more than two minutes for a run are disqualified, too. I'm not that patient. The program must be able to read and write a simple textual file format. This file holds two whitespace-separated numbers per line, which form a coordinate pair designating a cell that is alive. Code: 100 24 -24 51 Input to the programs will be given in this format, and the program must produce this format as output (either to stdout or a configurable file name). The order of points is irrelevant; the file will be sorted before any comparison is done. The machine specifications are: 1) Intel Core Duo (32-bit instruction set, SSSE3 support, dual core) 1 GB RAM 2) AMD Athlon64 (64-bit instruction set, SSE2 support, single core) 1 GB RAM The target compiler is GCC 4.1 or GCC 4.2 (depends on what I'll be using when the contest ends) on a Linux system. There is no need to make it portable to other platforms. The project must include a simple way of building. You can use GNU autotools/make, SCons, Boost.Build or a custom shell script (Bourne shell or bash). Compilations must be possible with one, at most two, simple commands. (e.g. "./configure; make" or "bjam"). You may use C or C++. If you use C++, you may expect the Boost libraries to be available, both 1.34.1 and 1.35. (Hopefully it will be released by then.) Implementations based on hashlife are forbidden, sorry. This advanced algorithm is so superior that it would be pointless to compare it against the other possibilities. This is an optimization challenge. Optimize your algorithms, and optimize your instructions. Every cycle counts. The contest ends at 0:00, April 21th. Have fun! I will post a few test input/output files soon.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #2 |
| Wheres the lesbians? Join Date: Oct 2006 Location: UK
Posts: 1,219
| Sorry, I havent read through the entire Wikipedia page so maybe I missed this part, but what size are the grid dimensions meant to be? |
| mike_g is offline | |
| | #3 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| |
| tabstop is offline | |
| | #4 |
| Just Lurking Join Date: Oct 2002
Posts: 4,990
| I'm still waiting for the results of Wireworld.
__________________ 7. It is easier to write an incorrect program than understand a correct one. 40. There are two ways to write error-free programs; only the third one works.* |
| Dave_Sinkula is offline | |
| | #5 | ||
| verbose cat Join Date: Jun 2003
Posts: 209
| Quote:
)Quote:
__________________ abachler: "A great programmer never stops optimizing a piece of code until it consists of nothing but preprocessor directives and comments " Last edited by jEssYcAt; 01-19-2008 at 10:37 PM. Reason: Making my post on topic | ||
| jEssYcAt is offline | |
| | #6 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,439
| There is no actual boundary on the grid size. However, I will run no pattern for more than 3000 generations, and no starting pattern will be larger than a few hundred grid cells in any direction. Because the pattern cannot grow more than one cell per generation, you can assume that it will not grow beyond about 8000 cells in either dimension. However, I will give out bonus points for solutions that do not use fixed-size grids. I'll just have to think of a fair and balanced way of adding that in.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law Last edited by CornedBee; 01-20-2008 at 08:43 AM. |
| CornedBee is offline | |
| | #7 |
| verbose cat Join Date: Jun 2003
Posts: 209
| When you say you will run no pattern for more than 3,000 generations, are you suggesting that our program needs to have a way to let you choose how many generations it will run, or are we safe to hard-code the program running for 3,000 generations? And are you going to clock the entire program or are you going to modify the program to add your own timing functions around the update or something (meaning you are only timing the actual calculation of the generations, not loading and saving files)? I realize the overhead of loading and saving files is probably not going to be a significant bottleneck compared to calculating 3,000 generations of a board that might grow to a couple thousand cells in both directions, but I need to know how pointlessly to tinker with my file io operations.
__________________ abachler: "A great programmer never stops optimizing a piece of code until it consists of nothing but preprocessor directives and comments " |
| jEssYcAt is offline | |
| | #8 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,439
| Let me put it this way: in profiling my reference, file I/O is not there. It simply takes up no noticeable amount of time. That said, the cycle count will clock the entire program. The physical time count will count only the core parts. And the program must be able to run for a configurable number of steps. Best would be a command line parameter.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #9 |
| Super Moderator Join Date: Aug 2001
Posts: 7,472
| Presumably this has to be in C/C++? |
| Bubba is offline | |
| | #10 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,439
| You can write it in Fortran if you want; I have that gcc variant too. The rule is that a GNU toolchain must support the code. So you can write it in pure assembly, too, as long as you use AT&T syntax.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #11 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,929
| Does it have to be for linux, or will Win32 console variants be allowed also?
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet |
| abachler is online now | |
| | #12 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,439
| My test computers run Linux only, sorry. I could run programs under Wine, but 1) I can't compile them, and I don't accept executables and 2) Wine is 32-bit only and 3) you'd probably get a considerable performance penalty from Wine. However, if you don't have Linux, you could develop using MinGW GCC. I'd be willing to help you in the final stage.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law Last edited by CornedBee; 01-23-2008 at 10:36 AM. |
| CornedBee is offline | |
| | #13 | |
| Frequently Quite Prolix Join Date: Apr 2005 Location: Canada
Posts: 7,629
| Quote:
Or you could wine the compiler. But you're right, of course; performance would be significantly reduced. [edit] "April 21th"? Oh, and of course it looks interesting. [/edit]
__________________ dwk Seek and ye shall find. quaere et invenies. "Simplicity does not precede complexity, but follows it." -- Alan Perlis "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra "The only real mistake is the one from which we learn nothing." -- John Powell Other boards: DaniWeb, TPS Unofficial Wiki FAQ: cpwiki.sf.net My website: http://dwks.theprogrammingsite.com/ Projects: codeform, xuni, atlantis, etc. New project: nort | |
| dwks is offline | |
| | #14 | ||
| Cat without Hat Join Date: Apr 2003
Posts: 8,439
| Quote:
Quote:
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law | ||
| CornedBee is offline | |
| | #15 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,929
| Well, I was planning on using assembly, multithreading and the GPU. Linux does threads differn't from win32 and im not sure if you have RapidMind installed.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet |
| abachler is online now | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Open-source Game Project | Glorfindel | Projects and Job Recruitment | 0 | 03-24-2009 01:12 AM |
| 2D RPG Online Game Project. 30% Complete. To be released and marketed. | drallstars | Projects and Job Recruitment | 2 | 10-28-2006 12:48 AM |
| C Programming 2d Array Question | jeev2005 | C Programming | 3 | 04-26-2006 03:18 PM |
| Game Of Life | din1983 | C Programming | 20 | 10-11-2005 10:36 PM |
| Please help with some coding.. | stehigs321 | C Programming | 2 | 10-27-2003 06:44 PM |