<commit_before>/**
 * Class: TicTacToe
 * @constructor
 */
function TicTacToe() {
    //----------------------------------------
    //               Properties
    //----------------------------------------
    this.displayMessage = $('#message');    //Message div
    this.displayTurn = $('#turn');          //Turn div
    this.player1 = new Player();            //Player1
    this.player2 = new Player();            //Player2
    this.playerTurn = 1;                    //Default is first player
    this.turnsPlayed = 0;                   //Number of turns played
    this.winningCombo = [];                 //Holds winning elements to highlight later
    //----------------------------------------
    //               Methods
    //----------------------------------------
    this.changeMessageDisplay = function (newHtml) {
        var msgHtml = '<h4>'+newHtml+'</h4>';
        this.displayMessage.html(msgHtml);
    }
    this.changeTurnDisplay = function(turn){
        this.displayTurn.html(turn);
    }
    this.checkWinner = function () {
        //Array of moves made from the current player
        var playerMoves = (this.playerTurn === 1 ? this.player1.playerMoves : this.player2.playerMoves);

        // if((playerMoves.includes('00') && playerMoves.includes('01') && playerMoves.includes('02')) ||  //Row Wise 0
        //    (playerMoves.includes('10') && playerMoves.includes('11') && playerMoves.includes('12')) ||  //Row Wise 1
        //    (playerMoves.includes('20') && playerMoves.includes('21') && playerMoves.includes('22')) ||  //Row Wise 2
        //    (playerMoves.includes('00') && playerMoves.includes('10') && playerMoves.includes('20')) ||  //Col Wise 0
        //    (playerMoves.includes('01') && playerMoves.includes('11') && playerMoves.includes('21')) ||  //Col Wise 1
        //    (playerMoves.includes('02') && playerMoves.includes('12') && playerMoves.includes('22')) ||  //Col Wise 2
        //    (playerMoves.includes('00') && playerMoves.includes('11') && playerMoves.includes('22')) ||  //Top Right to Bottom Left
        //    (playerMoves.includes('02') && playerMoves.includes('11') && playerMoves.includes('20'))     //Top Left to Bottom Right
        // )
        //Row Wise 0
        if((playerMoves.includes('00') && playerMoves.includes('01') && playerMoves.includes('02'))){
            this.winningCombo = ['00','01','02'];
            return true;
        }
        //Row Wise 1
        if((playerMoves.includes('10') && playerMoves.includes('11') && playerMoves.includes('12'))){
            this.winningCombo = ['10','11','12'];
            return true;
        }
        //Row Wise 2
        if((playerMoves.includes('20') && playerMoves.includes('21') && playerMoves.includes('22'))){
            this.winningCombo = ['20','21','22'];
            return true;
        }
        //Col Wise 0
        if((playerMoves.includes('00') && playerMoves.includes('10') && playerMoves.includes('20'))){
            this.winningCombo = ['00','10','20'];
            return true;
        }
        //Col Wise 1
        if((playerMoves.includes('01') && playerMoves.includes('11') && playerMoves.includes('21'))){
            this.winningCombo = ['01','11','21'];
            return true;
        }
        //Col Wise 2
        if((playerMoves.includes('02') && playerMoves.includes('12') && playerMoves.includes('22'))){
            this.winningCombo = ['02','12','22'];
            return true;
        }
        //Diagonal 1
        if((playerMoves.includes('00') && playerMoves.includes('11') && playerMoves.includes('22'))){
            this.winningCombo = ['00','11','22'];
            return true;
        }
        //Diagonal 2
        if((playerMoves.includes('02') && playerMoves.includes('11') && playerMoves.includes('20'))){
            this.winningCombo = ['02','11','20'];
            return true;
        }
        return false;
    };
    this.doReset = function (currGame) {
        console.log('do reset');
    }
    this.reset = function (currGame) {
        //Selector Variables
        var jumbotron = $('#jumbotron');                            //Selector for the jumbotron
        var resetBtn  = $('<button id="reset">Reset</button>');     //Variable that holds html to be added
        jumbotron.append(resetBtn);                                 //Add the button to the jumbotron
        resetBtn.show();

        //Reset Listener
        $('#reset').click(function () {
            // console.log('Reset clicked!');
            //Refresh the page (Lazy Way)
            // location.reload();

            //Remove reset button
            resetBtn.remove();

            //Reset the gameboard
            var allBoxes = $('td');
            for(let each of allBoxes){
                var boxID = '#'+each.id;
                if($(boxID).hasClass('clicked'))
                    $(boxID).removeClass('clicked');<commit_msg>Add method hideAvailableMoves(). Executed once a player clicks on an available move.<commit_after>/**
 * Class: TicTacToe
 * @constructor
 */
function TicTacToe() {
    //----------------------------------------
    //               Properties
    //----------------------------------------
    this.displayMessage = $('#message');    //Message div
    this.displayTurn = $('#turn');          //Turn div
    this.player1 = new Player();            //Player1
    this.player2 = new Player();            //Player2
    this.playerTurn = 1;                    //Default is first player
    this.turnsPlayed = 0;                   //Number of turns played
    this.winningCombo = [];                 //Holds winning elements to highlight later
    //----------------------------------------
    //               Methods
    //----------------------------------------
    this.changeMessageDisplay = function (newHtml) {
        var msgHtml = '<h4>'+newHtml+'</h4>';
        this.displayMessage.html(msgHtml);
    }
    this.changeTurnDisplay = function(turn){
        this.displayTurn.html(turn);
    }
    this.checkWinner = function () {
        //Array of moves made from the current player
        var playerMoves = (this.playerTurn === 1 ? this.player1.playerMoves : this.player2.playerMoves);

        // if((playerMoves.includes('00') && playerMoves.includes('01') && playerMoves.includes('02')) ||  //Row Wise 0
        //    (playerMoves.includes('10') && playerMoves.includes('11') && playerMoves.includes('12')) ||  //Row Wise 1
        //    (playerMoves.includes('20') && playerMoves.includes('21') && playerMoves.includes('22')) ||  //Row Wise 2
        //    (playerMoves.includes('00') && playerMoves.includes('10') && playerMoves.includes('20')) ||  //Col Wise 0
        //    (playerMoves.includes('01') && playerMoves.includes('11') && playerMoves.includes('21')) ||  //Col Wise 1
        //    (playerMoves.includes('02') && playerMoves.includes('12') && playerMoves.includes('22')) ||  //Col Wise 2
        //    (playerMoves.includes('00') && playerMoves.includes('11') && playerMoves.includes('22')) ||  //Top Right to Bottom Left
        //    (playerMoves.includes('02') && playerMoves.includes('11') && playerMoves.includes('20'))     //Top Left to Bottom Right
        // )
        //Row Wise 0
        if((playerMoves.includes('00') && playerMoves.includes('01') && playerMoves.includes('02'))){
            this.winningCombo = ['00','01','02'];
            return true;
        }
        //Row Wise 1
        if((playerMoves.includes('10') && playerMoves.includes('11') && playerMoves.includes('12'))){
            this.winningCombo = ['10','11','12'];
            return true;
        }
        //Row Wise 2
        if((playerMoves.includes('20') && playerMoves.includes('21') && playerMoves.includes('22'))){
            this.winningCombo = ['20','21','22'];
            return true;
        }
        //Col Wise 0
        if((playerMoves.includes('00') && playerMoves.includes('10') && playerMoves.includes('20'))){
            this.winningCombo = ['00','10','20'];
            return true;
        }
        //Col Wise 1
        if((playerMoves.includes('01') && playerMoves.includes('11') && playerMoves.includes('21'))){
            this.winningCombo = ['01','11','21'];
            return true;
        }
        //Col Wise 2
        if((playerMoves.includes('02') && playerMoves.includes('12') && playerMoves.includes('22'))){
            this.winningCombo = ['02','12','22'];
            return true;
        }
        //Diagonal 1
        if((playerMoves.includes('00') && playerMoves.includes('11') && playerMoves.includes('22'))){
            this.winningCombo = ['00','11','22'];
            return true;
        }
        //Diagonal 2
        if((playerMoves.includes('02') && playerMoves.includes('11') && playerMoves.includes('20'))){
            this.winningCombo = ['02','11','20'];
            return true;
        }
        return false;
    };
    this.doReset = function (currGame) {
        console.log('do reset');
    }
    this.hideAvailableMoves = function () {
        var availableMoves = $('td.available');
        availableMoves.css('background-color','rgba(0,0,0,0)');
    }
    this.reset = function (currGame) {
        //Selector Variables
        var jumbotron = $('#jumbotron');                            //Selector for the jumbotron
        var resetBtn  = $('<button id="reset">Reset</button>');     //Variable that holds html to be added
        jumbotron.append(resetBtn);                                 //Add the button to the jumbotron
        resetBtn.show();

        //Reset Listener
        $('#reset').click(function () {
            // console.log('Reset clicked!');
            //Refresh the page (Lazy Way)
            // location.reload();

            //Remove reset button
            resetBtn.remove();

            //Reset the gameboard
            var allBoxes = $('td');
            for(let each of allBoxes){
                var boxID = '#'+each.id;
                if($(boxID).hasClass('clicked'))
                    $(boxID).removeClass('clicked');
{'fraction_non_alphanumeric': 0.1979280804861042, 'fraction_numerical': 0.034067138161171434, 'mean_word_length': 1.8305610374964758, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4588115', 'n_tokens_mistral': 2950, 'n_tokens_neox': 2741, 'n_words': 550}