C Board  

Go Back   C Board > Community Boards > Contests Board

Reply
 
LinkBack Thread Tools Display Modes
Old 03-26-2008, 10:50 AM   #31
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
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
CornedBee is offline   Reply With Quote
Old 03-27-2008, 03:26 AM   #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 "
jEssYcAt is offline   Reply With Quote
Old 03-27-2008, 11:46 AM   #33
Malum in se
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 3,188
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.
abachler is offline   Reply With Quote
Old 03-27-2008, 11:50 AM   #34
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
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.
brewbuck is offline   Reply With Quote
Old 03-27-2008, 02:46 PM   #35
Malum in se
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 3,188
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.
abachler is offline   Reply With Quote
Old 03-27-2008, 04:03 PM   #36
Dr Dipshi++
 
mike_g's Avatar
 
Join Date: Oct 2006
Location: On me hyperplane
Posts: 1,219
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
File Type: c automaton.c (2.6 KB, 87 views)
mike_g is offline   Reply With Quote
Old 03-27-2008, 04:06 PM   #37
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
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
CornedBee is offline   Reply With Quote
Old 03-27-2008, 04:29 PM   #38
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
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?
brewbuck is offline   Reply With Quote
Old 03-27-2008, 04:35 PM   #39
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
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
CornedBee is offline   Reply With Quote
Old 03-27-2008, 04:40 PM   #40
Malum in se
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 3,188
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.
abachler is offline   Reply With Quote
Old 03-27-2008, 04:48 PM   #41
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
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.
brewbuck is offline   Reply With Quote
Old 03-27-2008, 10:49 PM   #42
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
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.
brewbuck is offline   Reply With Quote
Old 03-27-2008, 11:29 PM   #43
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
Will you be analyzing memory usage of the submissions? It might be interesting data.
brewbuck is offline   Reply With Quote
Old 03-28-2008, 12:19 AM   #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 "
jEssYcAt is offline   Reply With Quote
Old 03-28-2008, 05:19 AM   #45
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
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
CornedBee is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 02:32 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

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