better movement (1.2 Done) better Gun |
better movement (1.2 Done) + better Gun (Like GF Guns, my objective) |
https://www.robocoderepository.com/BotDetail.jsp?id=3352
I like the jump from 1.1(40+) to 1.2 (20+ - 30), way to go!
A combination of StopAndGo with additional stuff, now more like Surfing (1.2+)
Linear Targeting with little velocity management.
The choice is Yours, StopAndGo or WaveSurfing
No Difference
It does?
Distances 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 (For Version 1.1, 1.2 needs time to be readable)
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 (1.2 Done) + better Gun (Like GF Guns, my objective)
The Neophyte series, PRAL and Pattern, Don't know how I got past SRAL.
The nano linear targeting, modified by me after using it (new way of getting velocities)
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
1.9 is very good for Mega, I have done megabots :D. Hmm, and oh well, thanks for the info, I was just trying to see if I could fit in the prediction it some other way, like determining your distance. And hmm, I shall try to add better guns in there, you know it is terrible with that gun , although the movement is , I would say, like taking up too much codesize? -- aryary
I wrote a nano surfer called WaveSnake in which surfing was done with choosing different velocities, avoiding the complexities of prediction. Even then, the movement took up almost all of the codesize though. Also, I think 2.5 bullet power might be the best at close range because the hit percentage will be so high. -- Kev
Hmmm, movement does take out plenty of codesize, but managed to squeeze everything into 190, after looking at your code (special thanks :D ) . Also, s there any nice targeting I can use that avoids linear exploitation? I will be releasing it after this. Thanks -- Aryary
In 59 bytes, I'm not sure. Take a look at Splinter, otherwise I suggest a random*linear gun. RaikoNano uses this to good effect, and your movement should be quite a bit stronger. -- Skilgannon
1.2 is out , found some way to avoid some circumstances with new "surfing" techniques. Is there any improvement, in both terms of surfing and targeting? Just collecting feedback, and if you want the code, I will see what I can do. -- Aryary