Re: Is it possible to make a competitive JuniorRobot?
"realmoonstruck" <[email protected]>
| Newsgroups | gmane.comp.java.robocode |
|---|---|
| Message-ID | <[email protected]> |
I have been able to make linear targeting work. This bot can beat all the sample bots on 1 vs 1. But comes third in a melee against all the sample bots.
1st SpinBot(11%) 2nd Walls(11%) 3rd (9%) being a score of 100 rounds.
Though my bot can beat both consistently on 1vs1.
This is the code:
package ne0n;
import robocode.*;
public class BekarLinear 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);
}
}
Basically a copy of the movement of Walls but has linear targeting implemented.
Any ideas of improvement to win this melee?
--- In [email protected], Thomas Dalton <thomas.dalton@...> wrote:
>
> On 13 July 2010 22:38, realmoonstruck <realmoonstruck@...> wrote:
> > I have made a few junior bots for testing.
> > Until now i have been able to beat all the sample bots in 1 vs 1 combat. but when it comes to a melee it shows no deterministic result.
>
> I've never tried to write a JuniorRobot but I've read the manual and,
> given the simplified scanning system in JuniorRobots, I'm not sure
> you'll ever be able to make a successful melee robot. I'd suggest
> sticking to 1-on-1.
>
> > Maybe mainly because i haven't been able track any enemy. I also lack proper targeting. only thing that works are some simple movement strategies. The blocking calls are becoming a major setback.
>
> Linear and circular targeting should be possible, you just need to
> take into account the amount of time it will take to get the gun
> pointing in the right direction, which could well be longer than for
> an AdvancedRobot. Anything more complicated will be difficult since
> you can't get a decent radar lock - your lock will slip whenever you
> move.
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Robocode/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/Robocode/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/