[Home]DroidPoet

Robo Home | Changes | Preferences | AllPages

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: https://www.robocoderepository.com/BotDetail.jsp?id=1748

Here's the source for version 2.0

package pez.femto;
import robocode.*;

// DroidPoet - Blind and strong - https://robowiki.net?Poet#DroidPoet
// By Peter Strömberg, https://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 text of this page | View other revisions
Last edited June 14, 2005 14:03 EST by PEZ (diff)
Search: