[Home]History of Starrynte/Knowledge

Robo Home | Changes | Preferences | AllPages


Revision 3 . . December 28, 2006 20:18 EST by Starrynte
Revision 2 . . December 27, 2006 19:43 EST by Starrynte
  

Difference (from prior major revision) (no other diffs)

Added: 1a2
package ntc;

Changed: 10,11c11,12
static StringBuffer? headDelta;
static StringBuffer? velocity;
static String headDelta;
static String velocity;

Changed: 14c15,16

int direction = 1;


Changed: 20,21c22,23
headDelta=new StringBuffer?();
velocity=new StringBuffer?();
headDelta="";
velocity="";

Changed: 24,26c26,27
// After trying out your robot, try uncommenting the import at the top,
// and the next line:
setColors(Color.WHITE,Color.BLACK,new Color(0,255,0));
setFire(0.1);
setColors(Color.WHITE,Color.BLACK,Color.GREEN);

Changed: 30c31,49
doNothing();

double currentDirection=18D;
double maxX = getBattleFieldWidth?()-currentDirection;
double maxY = getBattleFieldHeight?()-currentDirection;
double futureX, futureY;
currentDirection=45;
while(true){
double time = getTime();
double ahead = currentDirection*(Math.sin(time/17D)-Math.cos(time/23D));
setAhead(ahead);
execute();
futureX = ahead*Math.sin(getHeadingRadians())+getX();
futureY = ahead*Math.cos(getHeadingRadians())+getY();
if (futureX < 18D || futureY < 18D || futureX > maxX || futureY > maxY){
currentDirection = -currentDirection;
}
scan();
execute();
}

Added: 35a55
setTurnRightRadians?(normalRelativeAngle(Math.PI/2-e.getBearingRadians?()));

Changed: 40,47c60,66
headDelta.append( (char)(int)(e.getHeadingRadians()-lastHeading) );
velocity.append( (char)(int)(e.getVelocity()) );
lastHeading=e.getHeadingRadians();

if(headDelta.length()>10 && getGunHeat()/getGunCoolingRate?()<5){
double bulletPower=3;
String currentH=headDelta.toString().substring(headDelta.length()-7);
String currentV=velocity.toString().substring(velocity.length()-7);
headDelta += (char)(int)(e.getHeading()-lastHeading);
velocity += (char)(int)(e.getVelocity());
lastHeading=e.getHeading();
if(headDelta.length()>50 && getGunHeat()/getGunCoolingRate?()<4){
double bulletPower=2.5;
String currentH=headDelta.substring(headDelta.length()-7);
String currentV=velocity.substring(velocity.length()-7);

Changed: 49,51c68,73
for(int i=0;i+7<=headDelta.length();i++){
if(headDelta.toString().substring(i,i+7).equals(currentH) &&
velocity.toString().substring(i,i+7).equals(currentV)){
double diff=Double.POSITIVE_INFINITY;

for(int i=0;i+7<=headDelta.length()-14;i++){
double thisDiff=0;
if(headDelta.substring(i,i+7).equals(currentH) &&
velocity.substring(i,i+7).equals(currentV)){

Added: 54a77,84
for(int j=0;j<currentH.length();j++){
thisDiff+=Math.pow(((double)(int)currentH.charAt(j))-((double)(int)headDelta.substring(i,i+7).charAt(j)),2);
thisDiff+=Math.pow(((double)(int)currentV.charAt(j))-((double)(int)velocity.substring(i,i+7).charAt(j)),2);
}
if(thisDiff<diff && thisDiff/3<1){
startIndex=i+7;
diff=thisDiff;
}

Added: 59a90
double bT=0;

Changed: 67,69c98,100
eH+=((double)(int)headDelta.toString().charAt(index));
double dX=Math.sin(eH) * ((double)(int)velocity.toString().charAt(index));
double dY=Math.cos(eH) * ((double)(int)velocity.toString().charAt(index));
eH+=((double)(int)headDelta.charAt(index));
double dX=Math.sin(Math.toRadians(eH)) * ((double)(int)velocity.charAt(index));
double dY=Math.cos(Math.toRadians(eH)) * ((double)(int)velocity.charAt(index));

Changed: 75c106
out.println(":)");
bulletPower=(20-(distance(myX,myY,eX,eY)/bT))/3;

Changed: 78c109,110
bD+=20-(3*bulletPower);
bD+=Rules.getBulletSpeed?(bulletPower);
bT++;

Added: 87a120,122
if(getGunHeat()==0d){
setFire(3);
}

Changed: 89,91c124,126
setTurnRadarRightRadians(normalRelativeAngle(e.getBearingRadians?()+myHeading-getRadarHeadingRadians?())*2);
scan();
execute();
double radarAmt=normalRelativeAngle( getHeadingRadians() + e.getBearingRadians?() - getRadarHeadingRadians?());
radarAmt += (radarAmt < 0.0 ? Math.atan( -18 / e.getDistance()) : Math.atan( 18 / e.getDistance()));
setTurnRadarRightRadians(radarAmt);

Changed: 101c136
return ((angle + 15.7079633) % 6.2831853) - Math.PI;
return robocode.util.Utils.normalRelativeAngle(angle);

Added: 110a146


Changed: 112c148
The onPaint and out.println(":)"); are for debugging. --Starrynte
The onPaint and out.println(":)"); are for debugging. I need them, because it is not workingfor some reason i don't know! (i think it has something to do with the finding of the start index)--Starrynte

Robo Home | Changes | Preferences | AllPages
Search: