Thread overview
D submission for c't programming contest gets special mention
Oct 03, 2008
Vladimir Panteleev
Oct 03, 2008
Moritz Warning
Oct 03, 2008
Nick B
Oct 03, 2008
Extrawurst
Oct 03, 2008
bearophile
Oct 03, 2008
Vladimir Panteleev
Oct 03, 2008
Denis Koroskin
Oct 03, 2008
Sönke Ludwig
October 03, 2008
Some time ago someone wrote to this newsgroup that the German magazine c't was hosting a programming contest. I decided to participate using the D language, and my submission got the 17th place. I could have done a lot better, but due to poor time management on my behalf I left myself only one week for the bulk of programming.

Today a friend of mine found the article in the magazine and scanned it for me:

http://img119.imageshack.us/img119/1051/ctarticlepage1lq8.jpg
http://img146.imageshack.us/img146/7448/ctarticlepage2kq8.jpg

I can't post an exact translation as I don't speak German myself, but I was told that the editors found the unique behavior of my bot - flying around the screen while narrowly dodging obstacles - quite amusing to watch :)

The source code for the submissions can be downloaded here:
http://www.heise.de/ct/creativ/08/02/ergebnisse/

-- 
Best regards,
 Vladimir                          mailto:thecybershadow@gmail.com
October 03, 2008
On Fri, 03 Oct 2008 07:22:35 +0300, Vladimir Panteleev wrote:

> Some time ago someone wrote to this newsgroup that the German magazine c't was hosting a programming contest. I decided to participate using the D language, and my submission got the 17th place. I could have done a lot better, but due to poor time management on my behalf I left myself only one week for the bulk of programming.
> 
> Today a friend of mine found the article in the magazine and scanned it for me:
> 
> http://img119.imageshack.us/img119/1051/ctarticlepage1lq8.jpg http://img146.imageshack.us/img146/7448/ctarticlepage2kq8.jpg
> 
> I can't post an exact translation as I don't speak German myself, but I was told that the editors found the unique behavior of my bot - flying around the screen while narrowly dodging obstacles - quite amusing to watch :)
> 
> The source code for the submissions can be downloaded here: http://www.heise.de/ct/creativ/08/02/ergebnisse/


Nice! congratulations!
October 03, 2008
Vladimir -where exactly is your code ?

Nick B


Vladimir Panteleev wrote:
> Some time ago someone wrote to this newsgroup that the German magazine c't was hosting a programming contest. I decided to participate using the D language, and my submission got the 17th place. I could have done a lot better, but due to poor time management on my behalf I left myself only one week for the bulk of programming.
> 
> Today a friend of mine found the article in the magazine and scanned it for me:
> 
> http://img119.imageshack.us/img119/1051/ctarticlepage1lq8.jpg
> http://img146.imageshack.us/img146/7448/ctarticlepage2kq8.jpg
> 
> I can't post an exact translation as I don't speak German myself, but I was told that the editors found the unique behavior of my bot - flying around the screen while narrowly dodging obstacles - quite amusing to watch :)
> 
> The source code for the submissions can be downloaded here:
> http://www.heise.de/ct/creativ/08/02/ergebnisse/
> 
October 03, 2008
when u visit the website he linked and scroll down there is another table with all the submission sources

Nick B wrote:
> Vladimir -where exactly is your code ?
> 
> Nick B
> 
> 
> Vladimir Panteleev wrote:
>> Some time ago someone wrote to this newsgroup that the German magazine c't was hosting a programming contest. I decided to participate using the D language, and my submission got the 17th place. I could have done a lot better, but due to poor time management on my behalf I left myself only one week for the bulk of programming.
>>
>> Today a friend of mine found the article in the magazine and scanned it for me:
>>
>> http://img119.imageshack.us/img119/1051/ctarticlepage1lq8.jpg
>> http://img146.imageshack.us/img146/7448/ctarticlepage2kq8.jpg
>>
>> I can't post an exact translation as I don't speak German myself, but I was told that the editors found the unique behavior of my bot - flying around the screen while narrowly dodging obstacles - quite amusing to watch :)
>>
>> The source code for the submissions can be downloaded here:
>> http://www.heise.de/ct/creativ/08/02/ergebnisse/
>>
October 03, 2008
On Fri, 03 Oct 2008 08:22:35 +0400, Vladimir Panteleev <thecybershadow@gmail.com> wrote:

> Some time ago someone wrote to this newsgroup that the German magazine c't was hosting a programming contest. I decided to participate using the D language, and my submission got the 17th place. I could have done a lot better, but due to poor time management on my behalf I left myself only one week for the bulk of programming.
>
> Today a friend of mine found the article in the magazine and scanned it for me:
>
> http://img119.imageshack.us/img119/1051/ctarticlepage1lq8.jpg
> http://img146.imageshack.us/img146/7448/ctarticlepage2kq8.jpg
>
> I can't post an exact translation as I don't speak German myself, but I was told that the editors found the unique behavior of my bot - flying around the screen while narrowly dodging obstacles - quite amusing to watch :)
>
> The source code for the submissions can be downloaded here:
> http://www.heise.de/ct/creativ/08/02/ergebnisse/
>

Translate, anyone?
October 03, 2008
Extrawurst:
> when u visit the website he linked and scroll down there is another table with all the submission sources

I have found that code now, they have hidden the links well under a tiny and near-transparent icon :-)

The game seems nice, I presume the purpose is to control the Asteroid startship. I presume a good strategy is to not move the ship in most situations (maybe moving it to avoid very close obstacles seems positive). The ship of the winner entry behaves like your stereotypical uber-smart AI :-) (but it doesn't move to avoid incoming asteroids, so it can be improved still).

I have seen some of the sources, and there's lot of variation. There are submissions like the Python one (not much successful) with just few hundred lines of code in a single module (using the socket std lib module), and very large C++/Java programs too.

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

Bye,
bearophile
October 03, 2008
On Fri, 03 Oct 2008 16:54:12 +0300, bearophile <bearophileHUGS@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@gmail.com
October 03, 2008
Vladimir Panteleev schrieb:
> Some time ago someone wrote to this newsgroup that the German magazine c't was hosting a programming contest. I decided to participate using the D language, and my submission got the 17th place. I could have done a lot better, but due to poor time management on my behalf I left myself only one week for the bulk of programming.
> 
> Today a friend of mine found the article in the magazine and scanned it for me:
> 
> http://img119.imageshack.us/img119/1051/ctarticlepage1lq8.jpg
> http://img146.imageshack.us/img146/7448/ctarticlepage2kq8.jpg
> 
> I can't post an exact translation as I don't speak German myself, but I was told that the editors found the unique behavior of my bot - flying around the screen while narrowly dodging obstacles - quite amusing to watch :)
> 
> The source code for the submissions can be downloaded here:
> http://www.heise.de/ct/creativ/08/02/ergebnisse/
> 

Nice one! (Coincidentially I've seen this magazine with exactly this page open lying on a table at my fathers house...)

Approximate translation:

[...]

In the table which was published in the internet, records of all matches can be found for watching and downloading [1]. Apart from the winners, the entry of Vladimir Panteleev, programmed in D, is worth taking a look: It rushes the whole five minutes with full throttle through the asteroid field without getting destroyed a single time - top mark for entertainment but in points only place 17.

[...]

[Mentions that some of the participants have disassembled the original game code and rewritten the game logic in general, as well as the random number generator in particular.]

[...]

Leadfoot Pantelev belongs to those who understand randomness too, as does Gunnar Fock, who lies at the end of the table with 2070 points, but has been a hot candidate for the second place during the preliminary rounds with 127660 points. [...]