<commit_before>var engine = (function (config) {
    'use strict';

    var $ = config,
        width = $.colWidth * $.cols,
        height = $.rowHeight * $.rows,
        lastTime;

    var canvas = createCanvas(width, height),
        context = createContext(canvas),
        gameContainer = document.querySelector($.gameContainerElement);

    /**
     * @description  Initialize the game engine
     */
    function init() {

        mountCanvas(canvas);
        showSplashscreen(context);
        lastTime = Date.now();

    }

    /**
     * @description  Start the game engine
     */
    function start() {

        console.log('Engine started!!');
        var assets = [].concat($.tiles, $.assets);
        Resources.load(assets);
        Resources.onReady(init);

    }

    /**
     * @description Engine's game loop
     */
    function loop() {

        // 1. Set the variable now to the actual time
        var now = Date.now();
        // 2. Calculate delta of time to allow smooth animation between
        // the previous frame and the next one.
        var dt = (now - lastTime) / 2500.0;
        // 3. Update positions of the game entities
        update(dt);
        // 4. Render the game board & game entities
        render();
        // 5. Set last time to the moment after render
        lastTime = now;

        // 6. Request browser to repeat whenever possible
        window.requestAnimationFrame(loop);
    }

    /**
     * @description          Update the game entities
     * @param  {number}  dt  Delta time to allow smooth animation
     */
    function update(dt) {

        game.player.update($.bounds);
        game.allEnemies.forEach(function(enemy) {
            enemy.update(dt, $.bounds);
        });
        game.allClouds.forEach(function(cloud) {
            cloud.update(dt, $.bounds);
        });
        monitorCollisions();

    }

    function monitorCollisions () {
        game.allEnemies.forEach(function(enemy) {
            if (hasCollided(game.player, enemy)) {
                // Send the player to the predefined bottom bound in case of collision with an enemy
                game.player.y = $.bounds.bottom;
                console.log('Oups! Collision with a goomba vehicle!')
            }
        });
        game.allCoins.forEach(function(coin) {
            if (hasCollided(game.player, coin)) {
                // Remove the coin object froom the coins array in case of collision with the player
                game.allCoins.splice(game.allCoins.indexOf(coin), 1);
                //
                game.dash.coins++;
                // Increment with 100 the score value of the game board
                game.dash.score += 100;

                console.log('Yupi... to cashflow!')
            }
        });
    }

    function hasCollided(player, entity) {
        var collided = false;
        if (Math.abs(player.x - entity.x) < $.collisionTolerance.x) {
            if (Math.abs(player.y - entity.y) < $.collisionTolerance.y) {
                collided = true;
            }
        }
        return collided;
    }

    /**<commit_msg>modify console logs of the game engine<commit_after>var engine = (function (config) {
    'use strict';

    var $ = config,
        width = $.colWidth * $.cols,
        height = $.rowHeight * $.rows,
        lastTime;

    var canvas = createCanvas(width, height),
        context = createContext(canvas),
        gameContainer = document.querySelector($.gameContainerElement);

    /**
     * @description  Initialize the game engine
     */
    function init() {

        mountCanvas(canvas);
        showSplashscreen(context);
        lastTime = Date.now();

    }

    /**
     * @description  Start the game engine
     */
    function start() {

        console.log('Engine started!!');
        var assets = [].concat($.tiles, $.assets);
        Resources.load(assets);
        Resources.onReady(init);

    }

    /**
     * @description Engine's game loop
     */
    function loop() {

        // 1. Set the variable now to the actual time
        var now = Date.now();
        // 2. Calculate delta of time to allow smooth animation between
        // the previous frame and the next one.
        var dt = (now - lastTime) / 2500.0;
        // 3. Update positions of the game entities
        update(dt);
        // 4. Render the game board & game entities
        render();
        // 5. Set last time to the moment after render
        lastTime = now;

        // 6. Request browser to repeat whenever possible
        window.requestAnimationFrame(loop);
    }

    /**
     * @description          Update the game entities
     * @param  {number}  dt  Delta time to allow smooth animation
     */
    function update(dt) {

        game.player.update($.bounds);
        game.allEnemies.forEach(function(enemy) {
            enemy.update(dt, $.bounds);
        });
        game.allClouds.forEach(function(cloud) {
            cloud.update(dt, $.bounds);
        });
        monitorCollisions();

    }

    function monitorCollisions () {
        game.allEnemies.forEach(function(enemy) {
            if (hasCollided(game.player, enemy)) {
                // Send the player to the predefined bottom bound in case of collision with an enemy
                game.player.y = $.bounds.bottom;
                console.log('Oups! Collision with a goomba vehicle!')
            }
        });
        game.allCoins.forEach(function(coin) {
            if (hasCollided(game.player, coin)) {
                // Remove the coin object froom the coins array in case of collision with the player
                game.allCoins.splice(game.allCoins.indexOf(coin), 1);
                //
                game.dash.coins++;
                // Increment with 100 the score value of the game board
                game.dash.score += 100;

                console.log('Yupi... cashflow: ' + game.dash.coins + ' $!')
            }
        });
    }

    function hasCollided(player, entity) {
        var collided = false;
        if (Math.abs(player.x - entity.x) < $.collisionTolerance.x) {
            if (Math.abs(player.y - entity.y) < $.collisionTolerance.y) {
                collided = true;
            }
        }
        return collided;
    }

    /**
{'fraction_non_alphanumeric': 0.11336420245888552, 'fraction_numerical': 0.005748044068337857, 'mean_word_length': 1.6953528399311533, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5767074', 'n_tokens_mistral': 1759, 'n_tokens_neox': 1659, 'n_words': 470}