Difference between revisions of "NightBird"
Jump to navigation
Jump to search
BeastBots101 (talk | contribs) m |
BeastBots101 (talk | contribs) |
||
Line 6: | Line 6: | ||
| targeting = [[Linear Targeting]] | | targeting = [[Linear Targeting]] | ||
| current_version = 1.2 | | current_version = 1.2 | ||
− | | license = | + | | license = none |
| isOneOnOne = true | | isOneOnOne = true | ||
| isMelee = false | | isMelee = false | ||
Line 25: | Line 25: | ||
; [[CodeSize]] | ; [[CodeSize]] | ||
− | : NightBird 1.2 is 169 bytes without colors, I think it's one of the smallest bots around. | + | : NightBird 1.2 is 169 bytes without colors, I think it's one of the smallest bots around. It got as high as 67% on v.1.0, which has 239 bytes. see the version history for more. |
== Strategy == | == Strategy == | ||
Line 43: | Line 43: | ||
; May I use your code? | ; May I use your code? | ||
− | : Yes. It's below, I don't really care about what you do, as long as you don't make a total copy. NightBird is a very simple beginner bot, and easy to understand. | + | : Yes. It's below, I don't really care about what you do, as long as you don't make a total copy and change the colors or name. NightBird is a very simple beginner bot, and easy to understand. |
; What's next for your robot? | ; What's next for your robot? | ||
− | : Better targeting. | + | : Better targeting maybe a PMz gun from [[WeekendObsession]]?. |
; Does it have any [[White Whale]]s? | ; Does it have any [[White Whale]]s? | ||
Line 107: | Line 107: | ||
//move | //move | ||
setAhead(10*direction); | setAhead(10*direction); | ||
+ | //turn | ||
setTurnLeft(90-e.getBearing()); | setTurnLeft(90-e.getBearing()); | ||
− | if (Math.random()<0. | + | if (Math.random()<0.035) { |
direction=-direction; | direction=-direction; | ||
} | } |
Revision as of 02:27, 2 September 2013
NightBird | |
Author(s) | User:BeastBots |
Extends | AdvancedRobot |
Targeting | Linear Targeting |
Movement | Random Movement |
Current Version | 1.2 |
Code License | none |
Background Information
- Bot Name
- NightBird
- Extends
- AdvancedRobot
- What's special about it?
- Nothing really. My first NanoBot.
- How competitive is it?
- Not so much. Not entered in roborumble due to the 2013 robocode repository crash.
- CodeSize
- NightBird 1.2 is 169 bytes without colors, I think it's one of the smallest bots around. It got as high as 67% on v.1.0, which has 239 bytes. see the version history for more.
Strategy
- How does it move?
- It uses this homemade thingy... random movement that I made up.
- How does it fire?
- Simple linear targeting from the wiki page.
- How does it dodge bullets?
- I guess random movement can dodge some bullets...
Additional Information
- Where did you get the name?
- I thought about NightHawk, but that was taken. So I did NightBird.
- May I use your code?
- Yes. It's below, I don't really care about what you do, as long as you don't make a total copy and change the colors or name. NightBird is a very simple beginner bot, and easy to understand.
- What's next for your robot?
- Better targeting maybe a PMz gun from WeekendObsession?.
- Does it have any White Whales?
- Acero and N are pretty annoying.
- What other bots is it based on?
- NightBird does not have code from any other bots(maybe accidentally, but I don't know).
Source Code
package EH.nano;
import robocode.*;
import robocode.util.*;
/**
* NightBird - a robot by (BeastBots101)
*
* V.1.0:
* -My first NanoBot!
* -random movement/stop and go
* -head on targeting
* -locking radar
* -Codesize 239
*
* V.1.1:
* -linear gun
* -wierd movement
* -same radar
* -not good...
*
* V.1.2:
* -complete rewrite due to messy code and errors
* -random movement
* -infinity lock
* -linear targeting
* -codesize 169
*
*/
public class NightBird extends AdvancedRobot{
int direction=1;
public void run() {
//gun/radar settings
setAdjustGunForRobotTurn(true);
setAdjustRadarForGunTurn(true);
while(true) {
//turn the radar
turnRadarRightRadians(Double.POSITIVE_INFINITY);
}
}
public void onScannedRobot(ScannedRobotEvent e) {
//infinity lock
setTurnRadarLeftRadians(getRadarTurnRemainingRadians());
//move
setAhead(10*direction);
//turn
setTurnLeft(90-e.getBearing());
if (Math.random()<0.035) {
direction=-direction;
}
//robowiki Linear targeting
double bulletPower = getEnergy()/18;
double headOnBearing =
getHeadingRadians() + e.getBearingRadians();
double linearBearing =
headOnBearing + Math.asin(e.getVelocity() / Rules.getBulletSpeed(bulletPower)
* Math.sin(e.getHeadingRadians() - headOnBearing));
setTurnGunRightRadians(Utils.normalRelativeAngle(linearBearing - getGunHeadingRadians()));
if (getEnergy()<1.0) {
return;
}
setFire(bulletPower);
}
public void onHitWall(){
direction=-direction;
}
}