[Home]DroidPoet

Robo Home | Changes | Preferences | AllPages

Showing revision 3
One of the Poetss, and a Droid. In fact: A Haiku, Perceptual, ExtendsRobot, Droid bot. Follows walls and shoots against the center of the battle field.

Download: http://www.robocoderepository.com/BotDetail.jsp?id=1748

Here's the source for version 1.0

package pez.femto;
import robocode.*;

// DroidPoet - Blind and strong - http://robowiki.net?Poet#DroidPoet
// By Peter Strömberg, http://robowiki.net/?PEZ

public class DroidPoet extends Robot implements Droid {
    public void run() {
        while (true) {
            ahead(1000);
            fire(getEnergy() > 3 ? 3 : 0);
        }
    }

    public void onHitWall(HitWallEvent e) {
        turnRight(90 - getHeading() % 90); 
        turnGunRight(Math.toDegrees(Math.atan2(getBattleFieldWidth() / 2 - getX(), getBattleFieldHeight() / 2 - getY())) -
                getGunHeading());
    }
} 

And any old versions goes here: /OldVersions


Robo Home | Changes | Preferences | AllPages
Edit revision 3 of this page | View other revisions | View current revision
Edited June 14, 2005 15:57 EST by PEZ (diff)
Search: