[Home]DroidPoet/OldVersions

Robo Home | DroidPoet | Changes | Preferences | AllPages

Source for version 0.1

package pez.femto;
import robocode.*;

// By Peter Strömberg, http://robowiki.dyndns.org/?PEZ
// Blind and strong

public class DroidPoet extends Robot implements Droid {
    public void run() {
        while (true) {
            ahead(Math.random() * 600);
            turnGunRight(Math.toDegrees(Math.atan2(getBattleFieldWidth() / 2 - getX(),
                getBattleFieldHeight() / 2 - getY())) - getGunHeading());
            fire(1.2);
        }
    }

    public void onHitWall(HitWallEvent e) {
        turnRight(90 - getHeading() % 90); 
    }
} 

Robo Home | DroidPoet | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited June 14, 2005 13:54 EST by PEZ (diff)
Search: