<commit_before>define([], function() {
    var achievements = {
        actions: {
            list: new Array(),
            complete: new Array()
        },

        create: function(name, type, desc, desc2, part, reqName, reqValue, changeName, changeValue) {
            this.name = name;
        	this.type = type;
        	this.desc = desc;
        	this.desc2 = desc2;
        	this.part = part; // actions or production for example
        	this.reqName = reqName;
        	this.reqValue = reqValue;
        	this.changeName = changeName;
        	this.changeValue = changeValue;
        },

        getCurrent: function(type, Index) {
            var index;
            switch (type) {
                case 0: // type 0 is for actions
                	for (var i = 0; i < this.actions.list.length; i++) {
                		if (!this.actions.complete[i] && this.actions.list[i].type == Index) {
                			index = i;
                			i = this.actions.list.length;
                		};
                	};
                    break;
                case 1: // type 1 is for production
                    // todo with production
                    break;
            };
            return index;
        },

        isComplete: function(index, part) {
            var need = window["game"]["achievements"][part]["list"][index]["reqValue"];
        	var reqName = window["game"]["achievements"][part]["list"][index]["reqName"];
        	var reqNameIndex = reqName.substring(reqName.indexOf('[') + 1, reqName.indexOf(']'));
        	var actual = window["game"][part][reqName.substring(0, reqName.indexOf('['))][reqNameIndex];
        	return actual >= need;
        },

        achieve: function(index, part) {
            var changeValue = window["game"]["achievements"][part]["list"][index]["changeValue"];
        	var changeName = window["game"]["achievements"][part]["list"][index]["changeName"];
        	var changeNameIndex = changeName.substring(changeName.indexOf('[') + 1, changeName.indexOf(']'));
        	var actual = window["game"][part][changeName.substring(0, changeName.indexOf('['))][changeNameIndex];
        	window["game"][part][changeName.substring(0, changeName.indexOf('['))][changeNameIndex] = eval(actual + changeValue);
        	this.display();

            var name = window["game"]["achievements"][part]["list"][index]["name"];
            var effect = window["game"]["achievements"][part]["list"][index]["desc2"];
            notify.pop("<strong>Achievement earned :</strong> " + name + "<br><strong>" + effect + "</strong>");
        },

        loop: function() {
            for (var i = 0; i < this.actions.list.length; i++) {
        		if (game.achievements.isComplete(i, 'actions') && !this.actions.complete[i]) {
        			game.achievements.achieve(i, 'actions');
        			this.actions.complete[i] = true;
        		};
        	};

            this.display();
        },

        display: function() {<commit_msg>updated notify.pop() call<commit_after>define([], function() {
    var achievements = {
        actions: {
            list: new Array(),
            complete: new Array()
        },

        create: function(name, type, desc, desc2, part, reqName, reqValue, changeName, changeValue) {
            this.name = name;
        	this.type = type;
        	this.desc = desc;
        	this.desc2 = desc2;
        	this.part = part; // actions or production for example
        	this.reqName = reqName;
        	this.reqValue = reqValue;
        	this.changeName = changeName;
        	this.changeValue = changeValue;
        },

        getCurrent: function(type, Index) {
            var index;
            switch (type) {
                case 0: // type 0 is for actions
                	for (var i = 0; i < this.actions.list.length; i++) {
                		if (!this.actions.complete[i] && this.actions.list[i].type == Index) {
                			index = i;
                			i = this.actions.list.length;
                		};
                	};
                    break;
                case 1: // type 1 is for production
                    // todo with production
                    break;
            };
            return index;
        },

        isComplete: function(index, part) {
            var need = window["game"]["achievements"][part]["list"][index]["reqValue"];
        	var reqName = window["game"]["achievements"][part]["list"][index]["reqName"];
        	var reqNameIndex = reqName.substring(reqName.indexOf('[') + 1, reqName.indexOf(']'));
        	var actual = window["game"][part][reqName.substring(0, reqName.indexOf('['))][reqNameIndex];
        	return actual >= need;
        },

        achieve: function(index, part) {
            var changeValue = window["game"]["achievements"][part]["list"][index]["changeValue"];
        	var changeName = window["game"]["achievements"][part]["list"][index]["changeName"];
        	var changeNameIndex = changeName.substring(changeName.indexOf('[') + 1, changeName.indexOf(']'));
        	var actual = window["game"][part][changeName.substring(0, changeName.indexOf('['))][changeNameIndex];
        	window["game"][part][changeName.substring(0, changeName.indexOf('['))][changeNameIndex] = eval(actual + changeValue);
        	this.display();

            var name = window["game"]["achievements"][part]["list"][index]["name"];
            var effect = window["game"]["achievements"][part]["list"][index]["desc2"];
            notify.pop("success", "<strong>Achievement earned :</strong> " + name + "<br><strong>" + effect + "</strong>");
        },

        loop: function() {
            for (var i = 0; i < this.actions.list.length; i++) {
        		if (game.achievements.isComplete(i, 'actions') && !this.actions.complete[i]) {
        			game.achievements.achieve(i, 'actions');
        			this.actions.complete[i] = true;
        		};
        	};

            this.display();
        },

        display: function() {
{'fraction_non_alphanumeric': 0.16143648263131397, 'fraction_numerical': 0.005034401745259272, 'mean_word_length': 2.045477772100153, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, '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': '1517012', 'n_tokens_mistral': 1737, 'n_tokens_neox': 1712, 'n_words': 331}