<commit_before>// This code runs once per frame. Build units and command peons!
// Destroy the human base within 180 seconds.
// Run over 4000 statements per call and chooseAction will run less often.
// Check out the green Guide button at the top for more info.

var base = this;

/////// 1. Command peons to grab coins and gems. ///////
// You can only command peons, not fighting units.
// You win by gathering gold more efficiently to make a larger army.
// Click on a unit to see its API.

var items = base.getItems();

var peons = base.getByType('peon');

// Available items:
// this.type = "gem"
// this.type = "gold-coin"
function getHighestPriorityItem(peon)
{
    var highestPriorityItem = {'priority': 0};

    for(var itemKey in items)
    {
        var item = items[itemKey];
        item.priority = item.bountyGold / item.distance(peon);
        if(item.priority > highestPriorityItem.priority)
        {
            highestPriorityItem = item;
        }
    }
    
    return highestPriorityItem;
}

for (var peonIndex = 0; peonIndex < peons.length; peonIndex++) {
    var peon = peons[peonIndex];
    var item = getHighestPriorityItem(peon);
    if (item)
        base.command(peon, 'move', item.pos);
}


/////// 2. Decide which unit to build this frame. ///////
// Peons can gather gold; other units auto-attack the enemy base.
// You can only build one unit per frame, if you have enough gold.
var type;
if (base.built.length === 0)
    type = 'peon';
else
    type = 'ogre';
if (base.gold >= base.buildables[type].goldCost)
    base.build(type);


// 'peon': Peons gather gold and do not fight.
// 'munchkin': Light melee unit.
// 'ogre': Heavy melee unit.
// 'shaman': Support spellcaster.
// 'fangrider': High damage ranged attacker.
// 'brawler': Mythically expensive super melee unit.
// See the buildables documentation below for costs and the guide for more info.<commit_msg>Attempt #2: moar ogres!<commit_after>// This code runs once per frame. Build units and command peons!
// Destroy the human base within 180 seconds.
// Run over 4000 statements per call and chooseAction will run less often.
// Check out the green Guide button at the top for more info.

var base = this;

/////// 1. Command peons to grab coins and gems. ///////
// You can only command peons, not fighting units.
// You win by gathering gold more efficiently to make a larger army.
// Click on a unit to see its API.

var items = base.getItems();

var peons = base.getByType('peon');

// Available items:
// this.type = "gem"
// this.type = "gold-coin"
function getHighestPriorityItem(peon)
{
    var highestPriorityItem = {'priority': 0};

    for(var itemKey in items)
    {
        var item = items[itemKey];
        item.priority = item.bountyGold / item.distance(peon);
        if(item.priority > highestPriorityItem.priority)
        {
            highestPriorityItem = item;
        }
    }
    
    return highestPriorityItem;
}

for (var peonIndex = 0; peonIndex < peons.length; peonIndex++) {
    var peon = peons[peonIndex];
    var item = getHighestPriorityItem(peon);
    if (item)
        base.command(peon, 'move', item.pos);
}


/////// 2. Decide which unit to build this frame. ///////
// Peons can gather gold; other units auto-attack the enemy base.
// You can only build one unit per frame, if you have enough gold.
var type;
if (peons.length < 3)
    type = 'peon';
else
    type = 'ogre';
if (base.gold >= base.buildables[type].goldCost)
    base.build(type);


// 'peon': Peons gather gold and do not fight.
// 'munchkin': Light melee unit.
// 'ogre': Heavy melee unit.
// 'shaman': Support spellcaster.
// 'fangrider': High damage ranged attacker.
// 'brawler': Mythically expensive super melee unit.
// See the buildables documentation below for costs and the guide for more info.
{'fraction_non_alphanumeric': 0.12194480946123522, 'fraction_numerical': 0.006570302233902759, 'mean_word_length': 2.8174523570712138, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '170067', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1144, 'n_words': 446}