[Home]Squirrel/Bot

Robo Home | Squirrel | Changes | Preferences | AllPages

package bayen;
import robocode.*;
import java.awt.Color;
import java.util.*;
import java.awt.geom.*;

/**
 *   _________            .__                      .__   
 *  /   _____/ ________ __|__|_____________   ____ |  |  
 *  \_____  \ / ____/  |  \  \_  __ \_  __ \_/ __ \|  |  
 *  /        < <_|  |  |  /  ||  | \/|  | \/\  ___/|  |__
 * /_______  /\__   |____/|__||__|   |__|    \___  >____/
 *         \/    |__|                            \/      
 *                           ii....;;..iiii..        
 *                        ffLLffGGffLLff..          
 *                      iiGGLLffLLffLLffffttii..    
 *                  ..ttffjjttiiiiiittttLLLLtt      
 *                  ttGGttttii;;;;;;;;;;;;ttLLLL..  
 *                ..LLttiiii,,..........;;;;ttfftt  
 *                ttttii;;;;;;......;;::;;;;iiLLLL  
 *      ..      ..ii;;;;;;;;;;::;;iiiiiiii;;iiffDDii
 *  ..iittiitt;;iitttt;;;;;;;;;;LLttttLLLLttttttGGff
 *  iiiittiitt;;;;ffii....;;;;ff..    ..ffLLGGLLDDtt
 *  ;;ttiiii;;tt;;ttii::..;;;;LL,,        ;;DDDDEE;;
 *  ttiiiiiittttii;;ff;;......jjii          LLKKGG  
 *  ;;LLiiffLLiitt,,LL;;;;....;;iiff..      ;;DDjj  
 *  ;;ffttiiiiLLtt;;LL;;,,......;;iiGG;;      ff..  
 *    iiffttKK##LL;;iiffjj;;....::;;ttjjtt..  ;;    
 *      ttff##WWffii....;;LL;;......iiLLGGii        
 *    ..iiKKLLLLGGii......tttt;;......iijjtt        
 *  ;;iiffLLLLttjjtt..;;..,,ttii......;;iiff        
 *  ffffffLLLLtt..ttiiffttii;;tt,,......;;LL        
 *  iiffLLffjjiiLLffttff;;::tttt;;....,,;;jj..      
 *  jjjjLLiiffjj;;ttLL......;;ffjj....;;;;ff..      
 *  ..ttjj;;......iiii......,,iiff;;,,;;ttLL        
 *    ttiiii......tt;;......,,ttffttiittffff        
 *    tt;;tt......tt;;......::ttLLffffLLGG;;        
 *    iiiiff;;....tttt;;..;;;;jjDDGGGGGGii          
 *    ..jjGGLLttiittGGttiiGGLLLLGGKKEE;;            
 *    ;;ttttLLGGii;;......iijj;;                    
 *    ffLLLLGGttii;;ttii;;;;                        
 *    ....;;ttjjffii..                              
 *          ......                                  
 *
 * __________         __________                             
 * \______   \___.__. \______   \_____  ___.__. ____   ____  
 *  |    |  _<   |  |  |    |  _/\__  \<   |  |/ __ \ /      *  |    |   \\___  |  |    |   \ / __ \\___  \  ___/|   |    *  |______  // ____|  |______  /(____  / ____|\___  >___|  /
 *         \/ \/              \/      \/\/         \/     \/ 
 */
public class Squirrel extends AdvancedRobot
{
	boolean alliances = true;
	boolean MC = false; // Good idea, Voidious!
	boolean TC = false; // Good idea, Voidious!
	
	AcornSlingshot slingshot;
	FleetFeet feet;
	/**
	 * run: Squirrel's default behavior
	 */
	public void run() {
		setBodyColor(Color.lightGray);
		setGunColor(Color.lightGray);
		setRadarColor(Color.darkGray);
		setScanColor(Color.red);
		setBulletColor(Color.green);
		slingshot = new AcornSlingshot(this);
		feet = new FleetFeet(this);
		setAdjustGunForRobotTurn(true);
		setAdjustRadarForGunTurn(true);
		slingshot.run();
		turnRadarRight(Double.POSITIVE_INFINITY);
	}

	/**
	 * onScannedRobot: What to do when you see another robot
	 */
	public void onScannedRobot(ScannedRobotEvent e) {
		if(e.getName().length() >= 14 && alliances){
        	if("bayen.Squirrel".equals(
	           e.getName().subSequence(0,14))){
        	return;
        	}
        }
		if(!TC) slingshot.onScannedRobot(e);
		if(!MC) feet.onScannedRobot(e);
		setTurnRadarLeft(getRadarTurnRemaining());
	}

	/**
	 * onHitByBullet: What to do when you're hit by a bullet
	 */
	public void onHitByBullet(HitByBulletEvent e) {
		feet.onHitByBullet(e);
	}
	
	public void onHitWall(HitWallEvent e) {
		feet.onHitWall(e);
	}
	public void onHitRobot(HitRobotEvent e) {
		feet.onHitRobot(e);
	}
	public void onWin(WinEvent e) {
		slingshot.onWin(e);
	}
	public void onDeath(DeathEvent e) {
		slingshot.onDeath(e);
	}
}

Robo Home | Squirrel | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited September 21, 2006 20:22 EST by Bayen (diff)
Search: