Difference between revisions of "Talk:Exterminans2oo8"

From Robowiki
Jump to navigation Jump to search
(New section: Wall smoothing)
m (Using <syntaxhighlight>.)
 
Line 10: Line 10:
 
This is my code:
 
This is my code:
  
<pre>
+
<syntaxhighlight>
 
     double turnAngle = 0;
 
     double turnAngle = 0;
 
     if(e!=null) turnAngle = e.bearing+Math.PI/2;
 
     if(e!=null) turnAngle = e.bearing+Math.PI/2;
Line 20: Line 20:
 
     r.setTurnRight(goAngle - r.getHeadingRadians());
 
     r.setTurnRight(goAngle - r.getHeadingRadians());
 
     r.setAhead(ahead);
 
     r.setAhead(ahead);
</pre>
+
</syntaxhighlight>
  
 
What am I doing wrong?
 
What am I doing wrong?

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