Game of Life

This is a discussion on Game of Life within the Contests Board forums, part of the Community Boards category; Just under a month until the deadline. Please send your submissions to sebastian DOT redl AT getdesigned DOT at. It ...

  1. #31
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Just under a month until the deadline. Please send your submissions to sebastian DOT redl AT getdesigned DOT at. It should be a single archive (zip, tgz, tbz, rar, 7z, I don't really care which).
    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

  2. #32
    verbose cat
    Join Date
    Jun 2003
    Posts
    209
    Yep, brewbuck, I'm working on it too. I have a working version but I'm trying to improve on it before I submit it.
    abachler: "A great programmer never stops optimizing a piece of code until it consists of nothing but preprocessor directives and comments "

  3. #33
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by brewbuck View Post
    I hope people are still working on this.
    I never got a definative answer on the inline assembly.

    I don't code for linux, so I probably don't have time to port a solution to it at this point. Any chance you can expand it to include win32?
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  4. #34
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,270
    Quote Originally Posted by abachler View Post
    I never got a definative answer on the inline assembly.

    I don't code for linux, so I probably don't have time to port a solution to it at this point. Any chance you can expand it to include win32?
    If you write your assembly stuff in actual .asm source files, you could use NASM to assemble it, which can target both platforms. But inline assembly seems out, unless you learn the AT&T syntax, which honestly, is not that big a deal.

  5. #35
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    My intention is to write it in Visual Studio, so I guess Im out.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  6. #36
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    Ok well I had a go at knocking up a quick version. Me being me I ignored the rules and made something with a graphical representation; the thought of staring at a list of co-ordinates trying to figure out what was going on would stretch my attention span a little too far. I couldent be bothered with lists either so its all done on, and limited to, a 2d array. Its very slow; O to the something horrible.

    If anyone else finishes this youre guaranteed to beat me

    I attached the source; it requires SDL. I'm not completely sure If I got it right. My little automatons dont seem to behave very interestingly off a random generated grid. Oh well.
    Attached Files Attached Files

  7. #37
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I still fail to see how you can get an inline assembly version working reliably in both 32-bit and 64-bit environment (a requirement). In fact, Visual Studio does not allow inline assembly for 64-bit targets.

    Thanks, mike. I'll try to give you some feedback over the weekend.
    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

  8. #38
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,270
    Quote Originally Posted by CornedBee View Post
    I still fail to see how you can get an inline assembly version working reliably in both 32-bit and 64-bit environment (a requirement). In fact, Visual Studio does not allow inline assembly for 64-bit targets.
    I haven't programmed in assembler on the AMD64 platform but I was under the impression that the 32-bit instruction set is all still available. Wrong?

  9. #39
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Not wrong, but just because the instructions are available, doesn't mean you can use all code without changes.

    For example, to completely dereference a double pointer, in 32 bits you do this:
    Code:
    MOV eax, DWORD PTR[somevar] ; Load variable
    MOV eax, DWORD PTR[eax] ; Dereference once
    MOV eax, DWORD PTR[eax] ; Dereference twice
    In 64 bits you do this (guessing a bit here - do the 64-bit GPRs have a g or an r prefix?):
    Code:
    MOV gax, QWORD PTR[somevar] ; Load variable
    MOV gax, QWORD PTR[gax] ; Dereference once
    MOV eax, DWORD PTR[gax] ; Dereference twice (get at a 32-bit int)
    In AT&T syntax, it's yet more complicated, because the operand size is in the instruction mnemonic. So instead of movl you have to write movq.
    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

  10. #40
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    You can use inline assembly under VS 2005 and 2008 and it will compile for an x86 target, btu if you try to compile it for an x64 target , then it throws errors. Yeah lots of developers are ........ed at MS for that one, it basically makes it 10 times harder to write drivers, since now all the hardware companies have to buy additional products and convert all their existing code.

    Sorry , didn't mean to derail your thread, lets get back on topic now.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  11. #41
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,270
    Quote Originally Posted by abachler View Post
    Sorry , didn't mean to derail your thread, lets get back on topic now.
    You could always compete unofficially... I'm interested to see what you come up with.

  12. #42
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,270
    Quote Originally Posted by mike_g View Post
    My little automatons dont seem to behave very interestingly off a random generated grid. Oh well.
    I think you're getting uninteresting results because you're not using the right rules:

    Code:
                    Uint8 u = (y > 0)? cells[flip][x][y-1]: 0;		
    		Uint8 d = (y < Y_CELL-1)? cells[flip][x][y+1]: 0;
    		Uint8 l = (x > 0)? cells[flip][x-1][y]: 0;
    		Uint8 r = (x < X_CELL-1)? cells[flip][x+1][y]: 0;	
    
    		switch(u+d+r+l)
    You're only looking at the four neighbors above, below, left and right. The actual rules require you to examine the four diagonal neighbors as well. Add that, and I bet things get a lot more interesting.

  13. #43
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,270
    Will you be analyzing memory usage of the submissions? It might be interesting data.

  14. #44
    verbose cat
    Join Date
    Jun 2003
    Posts
    209
    As long as there are no penalties for horrible abuse of memory... You did say you have 8GB of Ram, right?
    abachler: "A great programmer never stops optimizing a piece of code until it consists of nothing but preprocessor directives and comments "

  15. #45
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I have one Gig on both test machines

    I can analyze the usage, but I won't count it. My experience with our own program is that memory usage is its own speed penalty in CPU-bound applications. Basically, our performance went down drastically when the data got too large to fit into the L2 cache. And God help you if you start swapping.
    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

Page 3 of 5 FirstFirst 12345 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open-source Game Project
    By Glorfindel in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 03-24-2009, 02:12 AM
  2. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 01:48 AM
  3. C Programming 2d Array Question
    By jeev2005 in forum C Programming
    Replies: 3
    Last Post: 04-26-2006, 04:18 PM
  4. Game Of Life
    By din1983 in forum C Programming
    Replies: 20
    Last Post: 10-11-2005, 11:36 PM
  5. Please help with some coding..
    By stehigs321 in forum C Programming
    Replies: 2
    Last Post: 10-27-2003, 06:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21