java robocode

Discussion in 'Programming' started by icyfiren, Aug 28, 2011.

  1. #1
    need help with robocode ........ its combination of java coding and robowars
    robots are designed with java so i need source code for the bots and relevant tutorials
     
    icyfiren, Aug 28, 2011 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,838
    Likes Received:
    4,542
    Best Answers:
    123
    Trophy Points:
    665
    #2
    Why don't you paste the bits you are having problems with... can't help much without some examples of what is causing you to have problems.
     
    sarahk, Aug 28, 2011 IP
  3. icyfiren

    icyfiren Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    package icy;
    import robocode.*;
    //import java.awt.Color;

    /**
    * Icyfiren - a robot by (your name here)
    */
    public class Icyfiren extends Robot
    {

    /**
    * run: Icyfiren's default behavior
    */
    public void run() {
    // After trying out your robot, try uncommenting the import at the top,
    // and the next line:
    //setColors(Color.red,Color.blue,Color.green);
    while(true) {
    // Replace the next 4 lines with any behavior you would like

    turnGunRight(360);


    }
    }

    /**
    * onScannedRobot: What to do when you see another robot
    */
    public void onScannedRobot(ScannedRobotEvent e) {
    fire(1);

    }

    /**
    * onHitByBullet: What to do when you're hit by a bullet
    */
    public void onHitByBullet(HitByBulletEvent e) {

    e.getBearing();


    }

    }
     
    icyfiren, Aug 29, 2011 IP
  4. icyfiren

    icyfiren Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i want ot lock the target ...what functions can be used?
     
    icyfiren, Aug 29, 2011 IP