D submission for c't programming contest gets special mention

Vladimir Panteleev thecybershadow at gmail.com
Fri Oct 3 07:49:41 PDT 2008


On Fri, 03 Oct 2008 16:54:12 +0300, bearophile <bearophileHUGS at lycos.com>  
wrote:

> The D code seems quite long, can't it be shortened a lot? I presume that  
> some functional-style programming can shorten it some.

If you're so smart, why don't you try ;)

There's a lot of code in my zip for several reasons:

1) In my haste, I included some files which I used for testing and aren't  
part of the submission, as well as a few demonstrative files which are not  
part of the actual bot (e.g. simplebot.d). That's 1153 lines in 21 files,  
leaving 3263 lines in 8 relevant files (that's still including comments,  
bits of unused and debug code).

2) I used the same method as Helmut Buhler - disassembled the game ROM and  
copied the game logic. The file asteroids.d contains most of the game code  
rewritten procedurally in D. Yet, even if you count out his precomputed  
tables (my program computes these tables on initialization) you will see  
that his C++ code is about twice as longer than mine (although he has lots  
of commented-out code).

3) The task required lots of code. To achieve what I did, the exact state  
of the game was required to be known - and one is not given, because at  
the start of the game there are lots of unknown variables. Furthermore,  
since the communication protocol is UDP, packet loss was a real problem,  
which required very careful synchronization.

-- 
Best regards,
  Vladimir                          mailto:thecybershadow at gmail.com



More information about the Digitalmars-d mailing list