Help on Reaping Fire Level

When I play this level my Griffin Riders just get completely destroyed by the enemies within about 15 seconds and then they hit the mine field. Can someone look at my code and see where I can improve? I’m stumped.

// The goal is to survive for 30 seconds, and keep the mines intact for at least 30 seconds.

this.chooseStrategy = function() {
    var enemies = this.findEnemies();
    var fangrider = this.findNearest(this.findByType("fangrider"));
    if( >= this.costOf("griffin-rider")){

    if(fangrider && fangrider.pos.x < 36){
        return "fight-back";
    } else {
        return "collect-coins";

this.commandAttack = function() {
    var griffins = this.findByType("griffin-rider");
    var enemies = this.findEnemies();
    for(var i = 0; i < griffins.length; i++){
        var griffin = griffins[i];
        var enemy = griffin.findNearest(enemies);
        if(enemy && enemy != "fangrider"){
            this.command(griffin, "attack", enemy);

this.pickUpCoin = function() {
    var coin = this.findNearest(this.findItems());

this.heroAttack = function() {
    // Your hero should attack fang riders that cross the minefield.
    var fangrider = this.findNearest(this.findByType("fangrider"));

loop {
    var strategy = this.chooseStrategy();
    if(strategy === "fight-back"){
    } else if(strategy === "collect-coins"){

There’s nothing wrong with your code, except perhaps that your griffin-riders will attack all enemies, since you check the enemy’s name, not the enemy’s type in this.commandAttack. Just keep submitting.

Ended up having to use a Wizard with haste and long range attacks to make it work.

My tactics was to keep the griffin riders away from the ogres. Something along these lines:

    if friend.distanceTo(enemy) < 10:
        # move back a bit
        # attack enemy