<commit_before>game.ExperienceManager = Object.extend({
    init: function(x, y, settings){
      this.alwaysUpdate = true;
      this.gameover = false;
    },
    
    update: function(){
        if(game.data.win === true && !this.gameover){
             this.gameOver(true);
        }else if(game.data.win === false && !this.gameover){
             this.gameOver(false);
        }
        
        
        return true;
    },
    
    gameOver: function(win){
        if(win){
          game.data.exp += 10;  
        }else{
           game.data.exp += 1; 
        }
        console.log(game.data.exp);
        this.gameover = true;
        me.save.exp = game.data.exp;
       
    }
    
});
<commit_msg>finished video 59<commit_after>game.ExperienceManager = Object.extend({
    init: function(x, y, settings) {
        this.alwaysUpdate = true;
        this.gameover = false;
    },
    update: function() {
        if (game.data.win === true && !this.gameover) {
            this.gameOver(true);
            alert("YOU WIN!");
        } else if (game.data.win === false && !this.gameover) {
            this.gameOver(false);
            alert("yOU LOSE!");
        }


        return true;
    },
    gameOver: function(win) {
        if (win) {
            game.data.exp += 10;
        } else {
            game.data.exp += 1;
        }
        console.log(game.data.exp);
        this.gameover = true;
        me.save.exp = game.data.exp;


        $.ajax({
            type: "POST",
            url: "php/controller/save-user.php",
            data: {
                exp: game.data.exp,
                exp1: game.data.exp1,
                exp2: game.data.exp2,
                exp3: game.data.exp3,
                exp4: game.data.exp4,
            },
            dataType: "text"
        })
                .success(function(response) {
                    if (response === "true") {
                        me.state.change(me.state.MENU);
                    } else {
                        alert(response);
                    }
                })
                .fail(function(response) {
                    alert("Fail");
                });

    }

});

{'fraction_non_alphanumeric': 0.13885057471264367, 'fraction_numerical': 0.0073563218390804595, 'mean_word_length': 1.206896551724138, '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': '4867471', 'n_tokens_mistral': 663, 'n_tokens_neox': 629, 'n_words': 108}