http://www.robocoderepository.com/BotDetail.jsp?id=3636
Not sure for now.
A combination of StopAndGo with additional stuff.
Semi - Linear Targeting
The choice is Yours, StopAndGo or WaveSurfing
No Difference
It does?
GFs being hit by enemy (between rounds).
It is supposed to Surf, so I want it to surf as a Nano Well, Thus AceSurf.
Please Follow the RWCPL
package ary.nano; import robocode.AdvancedRobot; import robocode.HitByBulletEvent; import robocode.HitWallEvent; import robocode.ScannedRobotEvent; import robocode.util.Utils; public class AceSurf extends AdvancedRobot { private static double move = 100, enemyEnergy; private static int[] hit = new int[41]; //hit array to track where I am hit private static int gf = 0; public void run() { // helps targeting accuracy //setAdjustRadarForGunTurn(true); setAdjustGunForRobotTurn(true); turnRadarRightRadians(Double.POSITIVE_INFINITY); //turn Radar } public void onScannedRobot(ScannedRobotEvent e) { double reuse = 10000; //Ultimate variable setTurnRadarLeftRadians(getRadarTurnRemaining()); //Radar Lock //if enemy fired a bullet if (enemyEnergy > (enemyEnergy = e.getEnergy())) { gf = (int)((3*move*Math.random()))/20; //get GF for(int x = 40; x >= 0; x--) //loop through the array if(hit[x] < reuse) reuse = hit[x]; // get least dangerous one if(hit[gf+20] > reuse) move = -move; //if it is more dangerous than it, reverse //out.println(gf); setMaxVelocity(8); ///keep it 8 for consistency setAhead(3*move*Math.random()); //Move with whatever distance you deifned } // turn perpendicular with range control (approx not so close and not so far, I hope) setTurnRightRadians(Math.cos((reuse = e.getBearingRadians()) - 2000/10000)); //semi - linear targeting (from the wiki) setTurnGunRightRadians(Utils.normalRelativeAngle((reuse += getHeadingRadians()) - getGunHeadingRadians() + (e.getVelocity() * Math.sin(e.getHeadingRadians() - reuse) / 16.0))); setFire(2.5); //best firepower } public void onHitByBullet(HitByBulletEvent e){ hit[gf+20]++; //log your gf hits } public void onHitWall(HitWallEvent e) { setAhead(move = -move); //kinda bad, but best so far. } }
better movement
The Neophyte series and Splinter perhaps. I don't have much space for my gun.
The nano linear targeting, modified by me after using it.
You can probably drop setMaxVelocity(8);
, as its stays 8 without it and free yourself up some bytes. 2000/10000 is division between integers and will probably produce 0 or 1, but not .2 as you are planning for?? (it would probably be smaller and less erronous just to write .2). The random while getting the gf would make this more of a really complex random movement, perhaps with the above fixes you might have enough room to add something more exact. As for the 2.5 firepower being the best, and it may very well be for a nano (or this nano).. but I know that in mega competitions, 1.9 is very popular. --Chase-san