Difference between revisions of "Talk:Exterminans2oo8"

From Robowiki
Jump to navigation Jump to search
m
m (Using <syntaxhighlight>.)
 
(2 intermediate revisions by one other user not shown)
Line 2: Line 2:
 
May be [[RWPCL]] is the license that you want for your bot.
 
May be [[RWPCL]] is the license that you want for your bot.
 
The part of your code when you check if the enemy is shooting you can be easily improved taking into account damage from walls, ramming and your own bullets. --[[User:Jab |Jab]]
 
The part of your code when you check if the enemy is shooting you can be easily improved taking into account damage from walls, ramming and your own bullets. --[[User:Jab |Jab]]
 +
:Thanks, that's exactly what I've been looking for :) If I understood the event handling process correctly onScannedRobot is called last, after the other events. Ramming and bullets thus are already taken into consideration. The only needed thing is checking when the enemy hit the wall. Thanks for the hint, I'll implement that in the next version. And someday I'll also use WaveSurfing, but that still needs quite some coding :/ --[[User:Altglass|altglass]]
 +
 +
== Wall smoothing ==
 +
 +
I've tried implementing Voidious' WallSmoothing algorithm (http://robowiki.net/cgi-bin/robowiki?WallSmoothing#fast) in the OscillatorMovement. But somehow it crashes into the walls anyway.
 +
 +
This is my code:
 +
 +
<syntaxhighlight>
 +
    double turnAngle = 0;
 +
    if(e!=null) turnAngle = e.bearing+Math.PI/2;
 +
    double absAngle = r.getHeadingRadians() + turnAngle;
 +
    double ahead = 50+random.nextInt(100)*(Math.sin(r.getTime()/a)+Math.cos(r.getTime()/b));   
 +
    int clockwise = (r.getHeading()>=0)?1:-1;
 +
    clockwise *= (ahead>0)?1:-1;
 +
    double goAngle = wallSmoothing(r.getX(),r.getY(),absAngle,clockwise,1);
 +
    r.setTurnRight(goAngle - r.getHeadingRadians());
 +
    r.setAhead(ahead);
 +
</syntaxhighlight>
 +
 +
What am I doing wrong?
 +
 +
I've compiled a testing version that does not fire and only drives around in OscillatorMovement. You can find it at http://d-gfx.kognetwork.ch/robocode/altglass.Exterminans2oo8_test0331WS.jar
 +
 +
Any help is appreciated --[[User:Altglass|altglass]]

Latest revision as of 09:34, 1 July 2010

Hi, two comments: May be RWPCL is the license that you want for your bot. The part of your code when you check if the enemy is shooting you can be easily improved taking into account damage from walls, ramming and your own bullets. --Jab

Thanks, that's exactly what I've been looking for :) If I understood the event handling process correctly onScannedRobot is called last, after the other events. Ramming and bullets thus are already taken into consideration. The only needed thing is checking when the enemy hit the wall. Thanks for the hint, I'll implement that in the next version. And someday I'll also use WaveSurfing, but that still needs quite some coding :/ --altglass

Wall smoothing

I've tried implementing Voidious' WallSmoothing algorithm (http://robowiki.net/cgi-bin/robowiki?WallSmoothing#fast) in the OscillatorMovement. But somehow it crashes into the walls anyway.

This is my code:

    double turnAngle = 0;
    if(e!=null) turnAngle = e.bearing+Math.PI/2;
    double absAngle = r.getHeadingRadians() + turnAngle;
    double ahead = 50+random.nextInt(100)*(Math.sin(r.getTime()/a)+Math.cos(r.getTime()/b));    
    int clockwise = (r.getHeading()>=0)?1:-1;
    clockwise *= (ahead>0)?1:-1;
    double goAngle = wallSmoothing(r.getX(),r.getY(),absAngle,clockwise,1);
    r.setTurnRight(goAngle - r.getHeadingRadians());
    r.setAhead(ahead);

What am I doing wrong?

I've compiled a testing version that does not fire and only drives around in OscillatorMovement. You can find it at http://d-gfx.kognetwork.ch/robocode/altglass.Exterminans2oo8_test0331WS.jar

Any help is appreciated --altglass