[Duf-talk] Another Java Game

Mark Delano duf-talk@duf.spieleck.de
Thu Nov 1 20:05:01 2001


One of the problems with Robocode is the lack of documentation, although the 
API is written well enough that you can get the basics down.

The trick with events is that if you initiate a move or rotation in an event 
(by calling ahead(), turnRight(), turnGunRight(), etc.) all events after that 
one in the queue are ignored.  Instead your robot proceeds to the next time 
slice.  So if you receive a scannedrobot event and a hitwithbullet event in 
that order, if you decide to turnGunRight() in the scannedrobot event you will 
never get the hitwithbullet.

The better way to handle the problem is for each event to gather information 
without calling any move or turn methods, and in the while loop of the run() 
method take whatever action is appropriate.  The while loop of the run() 
always gets executed after the events.  This is an advantage AdvancedRobot has 
over Robot, in that you can call set methods (setAhead(), setTurnRight()) that 
will not execute until you want them to.

Mark

>===== Original Message From Frank Nestel <info@doris-frank.de> =====
>Hi Mark,
>
>I've seen that. I tried a simple bot and I didn't understand
>the event mechanism: My whole robot caught only 2 shoot events
>while being shot down to death.
>
>Apart of that it is really a nice environment and cool animation!
>
>Frank
>
>Mark Delano schrieb:
>>
>> For those on this list who participated or who played around with Numfield
>> (http://doris-frank.de/numfield.html), there is a new Java programming game
>> called Robocode (http://robocode.alphaworks.ibm.com/).  It allows you to
>> program a robot against one or more than one robot opponent.  I'm guessing 
it
>> might appeal to those who wrote programs for Numfield.  The API for it is
>> fairly intuitive (except for the whole bearings/headings thing, which made 
me
>> dredge up memories of triginometry I'd thankfully forgotten), and getting 
in
>> touch with the designer is pretty easy.
>>
>> Mark
>>
>> ------------------------------------------------------------
>> Just one of those email accounts.
>> ------------------------------------------------------------
>>
>> _______________________________________________
>> Duf-talk@duf.spieleck.de mailing list
>> Unsubcribe/Passwd/usw.: http://duf.spieleck.de/mailman/listinfo/duf-talk
>> Echte Probleme?  Mail an Duf-talk-admin@duf.spieleck.de
>
>--
>------------------------------------------ooO---"---Ooo-------------------
>info@doris-frank.de,                "I hate this game, lets play it
>again"
>http://doris-frank.de,
>http://duf.spieleck.de/mailman/listinfo
>Dr. Frank  Sven  Nestel,      http://spieleck.de,
>http://frank.spieleck.de
>Spiele von Doris und Frank, Wolfsstaudenring 32, D-91056 Erlangen,
>GERMANY
>
>_______________________________________________
>Duf-talk@duf.spieleck.de mailing list
>Unsubcribe/Passwd/usw.: http://duf.spieleck.de/mailman/listinfo/duf-talk
>Echte Probleme?  Mail an Duf-talk-admin@duf.spieleck.de

------------------------------------------------------------
Just one of those email accounts.
------------------------------------------------------------