<commit_before>module.exports = {
    behaviours: {
        default: {
            algorithm: require("creep.Builder.behaviour.Default"),
            complete: function (creep) {
                return true;
            }
        },
        Spawning: {
            algorithm: require("creep.Builder.behaviour.Spawning"),
            complete: function (creep) {
                return false;
            }
        },
        Collect: {
            algorithm: require("creep.Builder.behaviour.Collect"),
            complete: function (creep) {
                return creep.energy === creep.energyCapacity;
            }
        },
        Repair: {
            algorithm: require("creep.Builder.behaviour.Repair"),
            complete: function (creep) {
                return Memory.repairList[0] !== creep.memory.currentTarget.id;
            }
        },
        Build: {
            algorithm: require("creep.Builder.behaviour.Build"),
            complete: function (creep) {
                return creep.energy === 0 || creep.currentTarget.progress === undefined;
            }
        },
        Upgrade: {
            algorithm: require("creep.Builder.behaviour.Upgrade"),
            complete: function (creep) {
                return creep.energy === 0;
            }
        }

    },

    compute: function(creep) {

        if(this.behaviours[creep.memory.behaviour].complete(creep)) {
            if(creep.energy === 0) {
                creep.memory.behaviour = "Collect";
            } else if(Memory.repairList.length !== 0) {
                creep.memory.behaviour = "Repair";
            } else if((creep.memory.constructionTarget = creep.pos.findClosest(FIND_CONSTRUCTION_SITES))) {
                creep.memory.behaviour = "Build";
            } else {
                creep.memory.behaviour = "Upgrade";
            }
        }

        this.behaviours[creep.memory.behaviour || "default"].algorithm(creep);
    }
};
<commit_msg>Fix Builder Build Complete Condition<commit_after>module.exports = {
    behaviours: {
        default: {
            algorithm: require("creep.Builder.behaviour.Default"),
            complete: function (creep) {
                return true;
            }
        },
        Spawning: {
            algorithm: require("creep.Builder.behaviour.Spawning"),
            complete: function (creep) {
                return false;
            }
        },
        Collect: {
            algorithm: require("creep.Builder.behaviour.Collect"),
            complete: function (creep) {
                return creep.energy === creep.energyCapacity;
            }
        },
        Repair: {
            algorithm: require("creep.Builder.behaviour.Repair"),
            complete: function (creep) {
                return Memory.repairList[0] !== creep.memory.currentTarget.id;
            }
        },
        Build: {
            algorithm: require("creep.Builder.behaviour.Build"),
            complete: function (creep) {
                return creep.energy === 0 || creep.currentTarget ? creep.currentTarget.progress === undefined : false;
            }
        },
        Upgrade: {
            algorithm: require("creep.Builder.behaviour.Upgrade"),
            complete: function (creep) {
                return creep.energy === 0;
            }
        }

    },

    compute: function(creep) {

        if(this.behaviours[creep.memory.behaviour].complete(creep)) {
            if(creep.energy === 0) {
                creep.memory.behaviour = "Collect";
            } else if(Memory.repairList.length !== 0) {
                creep.memory.behaviour = "Repair";
            } else if((creep.memory.constructionTarget = creep.pos.findClosest(FIND_CONSTRUCTION_SITES))) {
                creep.memory.behaviour = "Build";
            } else {
                creep.memory.behaviour = "Upgrade";
            }
        }

        this.behaviours[creep.memory.behaviour || "default"].algorithm(creep);
    }
};

{'fraction_non_alphanumeric': 0.12193890431709165, 'fraction_numerical': 0.0025246149962130774, 'mean_word_length': 1.5861618798955615, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1151156', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1045, 'n_words': 162}