From Robowiki
Revision as of 16:02, 31 March 2008 by Altglass (talk | contribs) (New section: Wall smoothing)
Jump to navigation Jump to search

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 ( 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());

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

Any help is appreciated --altglass