Difference between revisions of "User talk:Realmoonstruck"

From Robowiki
Jump to navigation Jump to search
Line 2: Line 2:
  
 
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...
 +
 
<code>
 
<code>
 
package ne0n;
 
package ne0n;
Line 72: Line 73:
 
</code>
 
</code>
  
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.  
+
Tis moves in the same was as the Sample Walls. 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
 

Revision as of 14:55, 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);

}

}

Tis moves in the same was as the Sample Walls. 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...