Difference between revisions of "NightBird"

From Robowiki
Jump to navigation Jump to search
m
 
(16 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
| name            = NightBird
 
| name            = NightBird
 
| extends        = [[AdvancedRobot]]
 
| extends        = [[AdvancedRobot]]
| author          = [[User:BeastBots]]
+
| author          = [[User:BeastBots101|BeastBots]]
 
| movement        = [[Random Movement]]
 
| movement        = [[Random Movement]]
 
| targeting      = [[Linear Targeting]]
 
| targeting      = [[Linear Targeting]]
 
| current_version = 1.2
 
| current_version = 1.2
| license        = Use and abuse!
+
| license        = none
 
| isOneOnOne      = true
 
| isOneOnOne      = true
 
| isMelee        = false
 
| isMelee        = false
Line 19: Line 19:
  
 
; What's special about it?
 
; What's special about it?
: Not very much.
+
: Nothing really. My first NanoBot.
 +
: Check out my [[NiBhtbird/NightBirdM|Nightbird M series]] for my (failed) [[Multi-Mode|Multimode]] version.
  
; Great, I want to try it. Where can I download it?'''
+
; How competitive is it?
: http://www.robocoderepository.com/BotFiles/4248/sheldor.micro.EpeeistMicro_1.8.3.jar
+
: Not so much. Not entered in roborumble due to the 2013 robocode repository crash.
 +
: My guess is it would be around the position of [[N]], in the 800s od roborumble.
  
; How competitive is it?
+
; [[CodeSize]]
: Second in every category but Survival, as of 05/02/2013.
+
: 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 ==
 
; How does it move?
 
; How does it move?
: It starts with [[Stop And Go]] movement from [[Toorkild]], if it gets hit more than it would like to, it switches to [[Random Movement]] also from [[Toorkild]].
+
: It uses this homemade thingy... random movement that I made up.
  
; How does it fire?
+
; How does it fire?  
: [[GuessFactor Targeting (traditional)|Guess Factor Targeting]], [[Segmentation|segmented]] on acceleration, time since velocity change (from [[Komarious]]), [[Lateral Velocity]], near-wall, and distance.
+
: Simple [[linear targeting]] from the wiki page.
  
 
; How does it dodge bullets?
 
; How does it dodge bullets?
: Only the [[Stop And Go]] mode involves reacting to enemy fire.
+
: Usually, robot moves little enough to dodge a 2.0-3.0 powered linear or circular bullet. If I get lucky, it might be able to dodge linear bullets with power lower than 1.0. It's okay against [[HOT]] bullets.
 
 
; Is this robot melee-capable?
 
: Capable is a very broad word. Yes, ÉpéeistMicro is "capable" of fighting in [[Melee]] battles just like any other bot. It is not, however, capable in the sense of not being the first to die, so I didn't enter it in the meleerumble.
 
 
 
; What does it save between rounds and matches?
 
: Between rounds, the array of enemy guess factors and other variables. It doesn't (intentionally) save anything between matches.
 
  
 
== Additional Information ==
 
== Additional Information ==
  
 
; Where did you get the name?  
 
; Where did you get the name?  
: Épée is one of the three forms of modern sport fencing, along with Foil and Sabre. [http://en.wikipedia.org/wiki/Épée]
+
: I thought about NightHawk, but that was taken. So I did NightBird.
  
 
; May I use your code?
 
; May I use your code?
: Yes, but under the terms of the [[RWPCL]].
+
: 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?
: Take the APS throne.
+
: Better targeting. maybe a PM gun from [[WeekendObsession]]?.
  
 
; Does it have any [[White Whale]]s?
 
; Does it have any [[White Whale]]s?
: [[Acero]] and [[N]] are pretty annoying.
+
: [[Acero]]: Movement I can't beat(I know. ahf must be laughing at me right now!).
 +
: N̶:̶ ̶g̶o̶o̶d̶ ̶m̶o̶v̶e̶m̶e̶n̶t̶,̶ ̶g̶r̶e̶a̶t̶ ̶g̶u̶n̶  Not anymore! Average 54%, good enough for me.
 +
 
 +
; 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==
 +
 
 +
<syntaxhighlight>
 +
package EH.nano;
 +
import robocode.*;
 +
import robocode.util.*;
 +
/**
 +
* NightBird - a robot by BeastBots
 +
*
 +
* 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;
 +
}
 +
}
 +
 +
</syntaxhighlight>
 +
 
 +
== Version History ==
 +
; v.1.0:
 +
: To start, I used stop and go with random velocity and a HOT gun. Black, grey, and blue colors. [[Codesize]] 239 including colors.
 +
; v.1.1:
 +
: Linear gun, no colors due to high code size(no colors 234).
 +
; v.1.2:
 +
: Complete rewrite due to messy coding and various bugs. Now has random movement, energy management, and generally gets 45-67% on v.1.0. [[Codesize]] with no colors is 169 bytes.
  
  
 
[[Category:NanoBots]]
 
[[Category:NanoBots]]
 
[[Category:Bots]]
 
[[Category:Bots]]

Latest revision as of 01:26, 23 November 2013

NightBird
Author(s) 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.
Check out my Nightbird M series for my (failed) Multimode version.
How competitive is it?
Not so much. Not entered in roborumble due to the 2013 robocode repository crash.
My guess is it would be around the position of N, in the 800s od roborumble.
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?
Usually, robot moves little enough to dodge a 2.0-3.0 powered linear or circular bullet. If I get lucky, it might be able to dodge linear bullets with power lower than 1.0. It's okay against HOT 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 PM gun from WeekendObsession?.
Does it have any White Whales?
Acero: Movement I can't beat(I know. ahf must be laughing at me right now!).
N̶:̶ ̶g̶o̶o̶d̶ ̶m̶o̶v̶e̶m̶e̶n̶t̶,̶ ̶g̶r̶e̶a̶t̶ ̶g̶u̶n̶ Not anymore! Average 54%, good enough for me.
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 BeastBots
 * 
 * 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;
		}
}

Version History

v.1.0
To start, I used stop and go with random velocity and a HOT gun. Black, grey, and blue colors. Codesize 239 including colors.
v.1.1
Linear gun, no colors due to high code size(no colors 234).
v.1.2
Complete rewrite due to messy coding and various bugs. Now has random movement, energy management, and generally gets 45-67% on v.1.0. Codesize with no colors is 169 bytes.