/*
* This is the main method that is run at startup
* It sets our colours, sets some preferences for the bot.
* It then goes into an infinite while loop, which defines
* what we want to do every robocode 'turn'
* A robocode turn is the time a robot has to process
* before it moves.  A turn lasts about 8 milliseconds.
*/

public void run() {
        target = new Enemy();                           //target is an object of type Enemy.  It holds target info
        target.distance = 100000;			//initialise the distance so that we can select a target
        setColors(Color.red,Color.blue,Color.green);	//sets the colours of the robot

        //the next two lines mean that the turns of the robot, gun and radar are independant
        setAdjustGunForRobotTurn(true);
        setAdjustRadarForGunTurn(true);
        turnRadarRightRadians(2*PI);			//turns the radar right around to get a view of the field
        while(true) {
                doMovement();				//Move the bot
                doFirePower();				//select the fire power to use
                doScanner();				//Oscillate the scanner over the bot
                doGun();
                out.println(target.distance);		//move the gun to predict where the enemy will be
                fire(firePower);
                execute();				//execute all commands
        }
}