<commit_before>function GamePlayCtrl($interval, $scope, dictionaryService) {
    this.playerName;
    this.challengeString;
    this.humanInput;
    this.computerInput;
    this.selectedLevelSpeed;
    this.timerPromise;
    this.clockPromise;
    this.computerInputPromise;
    this.humanSpeed;
    
    this.$onInit = function() {
        this.hasGameStarted = false;
        this.initializeOrReset_();
        this.intervalService_ = $interval;
    };
    
    $scope.$watch(
            (function() {return this.hasGameStarted;}).bind(this),
            (function(newValue) {
                if (newValue === true) {
                    this.challengeString = 
                            dictionaryService.getRandomSentence(20);
                }
            }).bind(this));
    
    $scope.$watch(
            (function() {return this.humanInput;}).bind(this),
            (function(newValue, oldValue) {
                if (newValue !== oldValue &&
                        newValue === this.challengeString) {
                    this.intervalService_.cancel(this.computerInputPromise);
                    this.intervalService_.cancel(this.clockPromise);
                    this.computerInputPromise = null;
                    this.clockPromise = null;
                }
            }).bind(this));
}


/**
 * Initialzes or reset the game.
 * 
 * @private
 */
GamePlayCtrl.prototype.initializeOrReset_ = function() {
    // Resetting the timervalue otherwise it will start from the point where
    // it left on the execution of the timerPromise last time.
    this.timerValue = 4;
    // Clearing off the previously written text.
    this.humanInput = '';
    this.computerInput = '';
    this.humanSpeed = 0;
};


/**<commit_msg>Fix typo in the comment.<commit_after>function GamePlayCtrl($interval, $scope, dictionaryService) {
    this.playerName;
    this.challengeString;
    this.humanInput;
    this.computerInput;
    this.selectedLevelSpeed;
    this.timerPromise;
    this.clockPromise;
    this.computerInputPromise;
    this.humanSpeed;
    
    this.$onInit = function() {
        this.hasGameStarted = false;
        this.initializeOrReset_();
        this.intervalService_ = $interval;
    };
    
    $scope.$watch(
            (function() {return this.hasGameStarted;}).bind(this),
            (function(newValue) {
                if (newValue === true) {
                    this.challengeString = 
                            dictionaryService.getRandomSentence(20);
                }
            }).bind(this));
    
    $scope.$watch(
            (function() {return this.humanInput;}).bind(this),
            (function(newValue, oldValue) {
                if (newValue !== oldValue &&
                        newValue === this.challengeString) {
                    this.intervalService_.cancel(this.computerInputPromise);
                    this.intervalService_.cancel(this.clockPromise);
                    this.computerInputPromise = null;
                    this.clockPromise = null;
                }
            }).bind(this));
}


/**
 * Initializes or reset the game.
 * 
 * @private
 */
GamePlayCtrl.prototype.initializeOrReset_ = function() {
    // Resetting the timervalue otherwise it will start from the point where
    // it left on the execution of the timerPromise last time.
    this.timerValue = 4;
    // Clearing off the previously written text.
    this.humanInput = '';
    this.computerInput = '';
    this.humanSpeed = 0;
};


/**
{'fraction_non_alphanumeric': 0.11018889524899829, 'fraction_numerical': 0.0022896393817973667, 'mean_word_length': 1.9271356783919598, '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': '5001501', 'n_tokens_mistral': 954, 'n_tokens_neox': 899, 'n_words': 184}