Difference between revisions of "User talk:Realmoonstruck"

From Robowiki
Jump to navigation Jump to search
(Competitive JuniorRobot)
 
Line 3: Line 3:
 
I have been trying to make  competitive Junior Robots. This the best 1 vs 1 bot I could make till now...
 
I have been trying to make  competitive Junior Robots. This the best 1 vs 1 bot I could make till now...
  
<math>
+
 
 +
----
 +
 
 
package ne0n;
 
package ne0n;
 
import robocode.*;
 
import robocode.*;
Line 38: Line 40:
 
}
 
}
 
}
 
}
</math>
+
 
 +
----
 +
 
  
 
As the name suggests this uses simple trigonometric linear targeting. This has been able to beat all the Sample bots on 1 vs 1. But in melee Walls and SpinBot are beating me each time. I tried to implement some better movement and targeting strategies but couldn't get anything to work till now.  
 
As the name suggests this uses simple trigonometric linear targeting. This has been able to beat all the Sample bots on 1 vs 1. But in melee Walls and SpinBot are beating me each time. I tried to implement some better movement and targeting strategies but couldn't get anything to work till now.  
 
Any help will be appreciated...
 
Any help will be appreciated...
 
cant figure out how to get
 
cant figure out how to get

Revision as of 14:49, 14 July 2010

Competitive JuniorRobot

I have been trying to make competitive Junior Robots. This the best 1 vs 1 bot I could make till now...



package ne0n; import robocode.*; public class JuniorLinear extends JuniorRobot { int moveAmount; public void run() { setColors(black, white, red, orange, purple); moveAmount = Math.max(fieldWidth, fieldHeight); turnTo(0); while (true) { bearGunTo(90); ahead(moveAmount); } } public void onHitWall() { bearGunTo(90); turnRight(90); } public void onHitByBullet() { turnGunTo(hitByBulletAngle); } public void onHitRobot() { if (scannedBearing > -90 && scannedBearing < 90) back(100); else ahead(100); } public void onScannedRobot() { double firepower = 3d-2d*((double)scannedDistance/(double)moveAmount); double bulletVelocity = 20-3*firepower; double offset = Math.toDegrees(Math.asin(scannedVelocity*Math.sin(Math.toRadians(scannedHeading-scannedAngle))/bulletVelocity)); turnGunTo((int)(scannedAngle + offset)); fire(firepower); } }



As the name suggests this uses simple trigonometric linear targeting. This has been able to beat all the Sample bots on 1 vs 1. But in melee Walls and SpinBot are beating me each time. I tried to implement some better movement and targeting strategies but couldn't get anything to work till now. Any help will be appreciated... cant figure out how to get