<commit_before><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
    <title>duck404</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
    <script type="text/javascript" src="http://cdn.gamequeryjs.com/jquery.gamequery.js"></script>
    <script type="text/javascript">
        function Enemy(node) {
            this.speedx = -5;
            this.speedy = 0;
            this.node = $(node);


            this.update = function(playerNode){
                this.updateX(playerNode);
                this.updateY(playerNode);
            };
            this.updateX = function(playerNode){
                this.node.x(this.speedx, true);
            };
            this.updateY= function(playerNode){
//                var newpos = parseInt(this.node.css("top"))+this.speedy;
//                this.node.y(this.speedy, true);
            };
        }

        function Minion(node) {
            this.node = $(node);
        }
        Minion.prototype = new Enemy();
        Minion.prototype.updateY = function (playerNode) {

//            if (this.node.y() > (PLAYGROUND_HEIGHT - 100)) {
//                this.node.y(-2, true)
//            }
        }


        $(document).ready(function () {
            var PLAYGROUND_HEIGHT = 500;
            var PLAYGROUND_WIDTH = 700;
            var REFRESH_RATE = 5;

            $("#playground").playground({height: PLAYGROUND_HEIGHT, width: PLAYGROUND_WIDTH});

            var background1 = new $.gameQuery.Animation({imageURL: "img/background/background-03.png"});
            var background11 = new $.gameQuery.Animation({imageURL: "img/background/background-03.png"});
            var background2 = new $.gameQuery.Animation({imageURL: "img/background/background-01.png"});
            var background22 = new $.gameQuery.Animation({imageURL: "img/background/background-01.png"});
            var background3 = new $.gameQuery.Animation({imageURL: "img/background/background-04.png"});
            var background33 = new $.gameQuery.Animation({imageURL: "img/background/background-04.png"});

            $.playground()
                    .addGroup("background", {width: PLAYGROUND_WIDTH, height: PLAYGROUND_HEIGHT})
                    .addSprite("background1", {
                        animation: background1,
                        width: PLAYGROUND_WIDTH,
                        height: PLAYGROUND_HEIGHT
                    })
                    .addSprite("background11", {
                        animation: background1,
                        width: PLAYGROUND_WIDTH,
                        height: PLAYGROUND_HEIGHT,
                        posx: PLAYGROUND_WIDTH
                    })
                    .addSprite("background2", {
                        animation: background2,
                        width: PLAYGROUND_WIDTH,
                        height: PLAYGROUND_HEIGHT
                    })
                    .addSprite("background22", {
                        animation: background2,
                        width: PLAYGROUND_WIDTH,
                        height: PLAYGROUND_HEIGHT,
                        posx: PLAYGROUND_WIDTH
                    })
                    .addSprite("background3", {
                        animation: background3,
                        width: PLAYGROUND_WIDTH,
                        height: PLAYGROUND_HEIGHT
                    })
                    .addSprite("background33", {
                        animation: background3,
                        width: PLAYGROUND_WIDTH,
                        height: PLAYGROUND_HEIGHT,
                        posx: PLAYGROUND_WIDTH
                    });

            var duck = [];
            duck["body"] = new $.gameQuery.Animation({imageURL: "img/duck100x100.png"});

            var enemiesSize = [];
            enemiesSize.push({
                width: 227,
                height: 100
            });
            enemiesSize.push({
                width: 233,
                height: 100
            });
            enemiesSize.push({
               width: 170,
               height: 100
            });
            var enemies = []
            enemies[0] = new $.gQ.Animation({
                imageURL: "img/submarine.png",
                numberOfFrame: 1,
                delta: 52,
                rate: 60,
                type: $.gQ.ANIMATION_VERTICAL
            });
            enemies[1] = new $.gQ.Animation({
                imageURL: "img/boat.png",
                numberOfFrame: 1,
                delta: 42,
                rate: 60,
                type: $.gQ.ANIMATION_VERTICAL
            });
            enemies[2] = new $.gQ.Animation({
                imageURL: "img/airplane.png",
                numberOfFrame: 1,
                delta: 100,
                rate: 60,
                type: $.gQ.ANIMATION_VERTICAL
            });

            $.playground()
                    .addGroup("objects", {width: PLAYGROUND_WIDTH, height: PLAYGROUND_HEIGHT})
                    .addGroup("duck", {posx: 0, posy: PLAYGROUND_HEIGHT / 2 - 50, width: 100, height: 100})
                        .addSprite("duckBody", {animation: duck["body"], posx: 0, posy: 0, width: 100, height: 100})

            currentPosition = 1;

            $(document).keydown(function (e) {

                position = ["-125px", "0px", "125px"];

                switch (e.keyCode) {
                    case 38: //up
                        console.log("UP")
                        if (currentPosition == 0) {
                            return
                        }
                        currentPosition--;
                        $("#duck").css("top", position[currentPosition]);
                        break;
                    case 40: //down
                        console.log("DOWN")
                        if (currentPosition == 2) {
                            return
                        }
                        currentPosition++;
                        $("#duck").css("top", position[currentPosition]);
                        break;
                }
            });

            var backSpeed = 2;
            var centerSpeed = 3;
            var frontSpeed = 5;

            //animate enemies
            $.playground().registerCallback(function () {
                $(".enemy").each(function(){
                    this.enemy.update($("#duck"));
                    var posx = $(this).x();
                    if((posx + 100) < 0){
                        $(this).remove();
                        return;
                    }
                    //Test for collisions
//                    var collided = $(this).collision("#playerBody,."+$.gQ.groupCssClass);
//                    if(collided.length > 0){
//                        if(this.enemy instanceof Bossy){
//                            $(this).setAnimation(enemies[2]["explode"], function(node){$(node).remove();});
//                            $(this).css("width", 150);
//                        } else if(this.enemy instanceof Brainy) {
//                            $(this).setAnimation(enemies[1]["explode"], function(node){$(node).remove();});
//                            $(this).css("width", 150);
//                        } else {
//                            $(this).setAnimation(enemies[0]["explode"], function(node){$(node).remove();});
//                            $(this).css("width", 200);
//                        }
//                        $(this).removeClass("enemy");
//                        //The player has been hit!
//                        if($("#player")[0].player.damage()){
//                            explodePlayer($("#player"));
//                        }
//                    }
                    //Make the enemy fire
//                    if(this.enemy instanceof Brainy){
//                        if(Math.random() < 0.05){
//                            var enemyposx = $(this).x();
//                            var enemyposy = $(this).y();
//                            var name = "enemiesMissile_"+Math.ceil(Math.random()*1000);
//                            $("#enemiesMissileLayer").addSprite(name,{animation: missile["enemies"], posx: enemyposx, posy: enemyposy + 20, width: 30,height: 15});
//                            $("#"+name).addClass("enemiesMissiles");
//                        }
//                    }
                });
            }, REFRESH_RATE);

            //generate enemies
            $.playground().registerCallback(function () {

                var name = "enemy1_" + Math.ceil(Math.random() * 1000);
                var enemyType = parseInt(Math.random()*10) % 3;

                var enemyPositions = [350, 200, 50];
                var position = enemyPositions[enemyType];

                $("#objects").addSprite(name, {animation: enemies[enemyType], posx: PLAYGROUND_WIDTH, posy: position, width: enemiesSize[enemyType].width, height: enemiesSize[enemyType].height});
                $("#" + name).addClass("enemy");
                $("#" + name)[0].enemy = new Minion($("#" + name));


            }, 1500);

            //animate waves
            $.playground().registerCallback(function () {
                //Offset all the pane:
                var newPos = (parseInt($("#background1").css("left")) - backSpeed - PLAYGROUND_WIDTH)
                        % (-2 * PLAYGROUND_WIDTH) + PLAYGROUND_WIDTH;
                $("#background1").css("left", newPos);

                var newPos = (parseInt($("#background11").css("left")) - backSpeed)
                        % (-2 * PLAYGROUND_WIDTH);
                $("#background11").css("left", newPos);

                newPos = (parseInt($("#background2").css("left")) - centerSpeed - PLAYGROUND_WIDTH)
                % (-2 * PLAYGROUND_WIDTH) + PLAYGROUND_WIDTH;
                $("#background2").css("left", newPos);

                newPos = (parseInt($("#background22").css("left")) - centerSpeed)
                % (-2 * PLAYGROUND_WIDTH);
                $("#background22").css("left", newPos);

                newPos = (parseInt($("#background3").css("left")) - frontSpeed - PLAYGROUND_WIDTH)
                % (-2 * PLAYGROUND_WIDTH) + PLAYGROUND_WIDTH;
                $("#background3").css("left", newPos);

                newPos = (parseInt($("#background33").css("left")) - frontSpeed)
                % (-2 * PLAYGROUND_WIDTH);
                $("#background33").css("left", newPos);
            }, REFRESH_RATE);

            $.playground().startGame(function () {
            });
        })
    </script>
    <style type="text/css">
        html, body {
            margin: 0;
            padding: 0;
            background: black;
        }
    </style>
</head>
<body>
<div id="playground" style="width: 700px; height: 500px; background: white;">

</div>
</body>
</html><commit_msg>collision nie bangla<commit_after><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
    <title>duck404</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
    <script type="text/javascript" src="http://cdn.gamequeryjs.com/jquery.gamequery.js"></script>
    <script type="text/javascript">


        function explodePlayer(playerNode){
            playerNode.children().hide();
            //playerNode.addSprite("explosion",{animation: playerAnimation["explode"], width: 100, height: 26})
            playerHit = true;
        }


        function Player(node){

            this.node = node;
            //this.animations = animations;

            this.grace = false;
            this.replay = 1;
            this.shield = 1;
            this.respawnTime = -1;

            // This function damage the ship and return true if this cause the ship to die
            this.damage = function(){
//                if(!this.grace){
//                    this.shield--;
//                    if (this.shield == 0){
//                        return true;
//                    }
//                    return false;
//                }
                return true;
            };

            // this try to respawn the ship after a death and return true if the game is over
            this.respawn = function(){
                this.replay--;
                if(this.replay==0){
                    return true;
                }

                this.grace 	= true;
                this.shield	= 3;

                this.respawnTime = (new Date()).getTime();
                $(this.node).fadeTo(0, 0.5);
                return false;
            };

            this.update = function(){
                if((this.respawnTime > 0) && (((new Date()).getTime()-this.respawnTime) > 3000)){
                    this.grace = false;
                    $(this.node).fadeTo(500, 1);
                    this.respawnTime = -1;
                }
            }

            return true;
        }


        function Enemy(node) {
            this.speedx = -5;
            this.speedy = 0;
            this.node = $(node);


            this.update = function(playerNode){
                this.updateX(playerNode);
                this.updateY(playerNode);
            };
            this.updateX = function(playerNode){
                this.node.x(this.speedx, true);
            };
            this.updateY= function(playerNode){
//                var newpos = parseInt(this.node.css("top"))+this.speedy;
//                this.node.y(this.speedy, true);
            };
        }

        function Minion(node) {
            this.node = $(node);
        }
        Minion.prototype = new Enemy();
        Minion.prototype.updateY = function (playerNode) {

//            if (this.node.y() > (PLAYGROUND_HEIGHT - 100)) {
//                this.node.y(-2, true)
//            }
        }


        $(document).ready(function () {
            var PLAYGROUND_HEIGHT = 500;
            var PLAYGROUND_WIDTH = 700;
            var REFRESH_RATE = 5;

            $("#playground").playground({height: PLAYGROUND_HEIGHT, width: PLAYGROUND_WIDTH});

            var background1 = new $.gameQuery.Animation({imageURL: "img/background/background-03.png"});
            var background11 = new $.gameQuery.Animation({imageURL: "img/background/background-03.png"});
            var background2 = new $.gameQuery.Animation({imageURL: "img/background/background-01.png"});
            var background22 = new $.gameQuery.Animation({imageURL: "img/background/background-01.png"});
            var background3 = new $.gameQuery.Animation({imageURL: "img/background/background-04.png"});
            var background33 = new $.gameQuery.Animation({imageURL: "img/background/background-04.png"});

            $.playground()
                    .addGroup("background", {width: PLAYGROUND_WIDTH, height: PLAYGROUND_HEIGHT})
                    .addSprite("background1", {
                        animation: background1,
                        width: PLAYGROUND_WIDTH,
                        height: PLAYGROUND_HEIGHT
                    })
                    .addSprite("background11", {
                        animation: background1,
                        width: PLAYGROUND_WIDTH,
                        height: PLAYGROUND_HEIGHT,
                        posx: PLAYGROUND_WIDTH
                    })
                    .addSprite("background2", {
                        animation: background2,
                        width: PLAYGROUND_WIDTH,
                        height: PLAYGROUND_HEIGHT
                    })
                    .addSprite("background22", {
                        animation: background2,
                        width: PLAYGROUND_WIDTH,
                        height: PLAYGROUND_HEIGHT,
                        posx: PLAYGROUND_WIDTH
                    })
                    .addSprite("background3", {
                        animation: background3,
                        width: PLAYGROUND_WIDTH,
                        height: PLAYGROUND_HEIGHT
                    })
                    .addSprite("background33", {
                        animation: background3,
                        width: PLAYGROUND_WIDTH,
                        height: PLAYGROUND_HEIGHT,
                        posx: PLAYGROUND_WIDTH
                    });

            var duck = [];
            duck["body"] = new $.gameQuery.Animation({imageURL: "img/duck100x100.png"});

            var enemiesSize = [];
            enemiesSize.push({
                width: 227,
                height: 100
            });
            enemiesSize.push({
                width: 233,
                height: 100
            });
            enemiesSize.push({
               width: 170,
               height: 100
            });
            var enemies = []
            enemies[0] = new $.gQ.Animation({
                imageURL: "img/submarine.png",
                numberOfFrame: 1,
                delta: 52,
                rate: 60,
                type: $.gQ.ANIMATION_VERTICAL
            });
            enemies[1] = new $.gQ.Animation({
                imageURL: "img/boat.png",
                numberOfFrame: 1,
                delta: 42,
                rate: 60,
                type: $.gQ.ANIMATION_VERTICAL
            });
            enemies[2] = new $.gQ.Animation({
                imageURL: "img/airplane.png",
                numberOfFrame: 1,
                delta: 100,
                rate: 60,
                type: $.gQ.ANIMATION_VERTICAL
            });

            $.playground()
                    .addGroup("objects", {width: PLAYGROUND_WIDTH, height: PLAYGROUND_HEIGHT})
                    .addGroup("duck", {posx: 0, posy: PLAYGROUND_HEIGHT / 2 - 50, width: 100, height: 100})
                        .addSprite("duckBody", {animation: duck["body"], posx: 0, posy: 0, width: 100, height: 100})

            $("#duck")[0].player = new Player($("#duck"));



            currentPosition = 1;

            $(document).keydown(function (e) {

                position = ["-125px", "0px", "125px"];

                switch (e.keyCode) {
                    case 38: //up
                        console.log("UP")
                        if (currentPosition == 0) {
                            return
                        }
                        currentPosition--;
                        $("#duck").css("top", position[currentPosition]);
                        break;
                    case 40: //down
                        console.log("DOWN")
                        if (currentPosition == 2) {
                            return
                        }
                        currentPosition++;
                        $("#duck").css("top", position[currentPosition]);
                        break;
                }
            });

            var backSpeed = 2;
            var centerSpeed = 3;
            var frontSpeed = 5;

            //animate enemies
            $.playground().registerCallback(function () {
                $(".enemy").each(function(){
                    this.enemy.update($("#duck"));
                    var posx = $(this).x();
                    if((posx+100) < 0){
                        $(this).remove();
                        return;
                    }
                    //Test for collisions
                    var collided = $(this).collision("#duckBody,."+$.gQ.groupCssClass);
//                    console.log($.gQ.groupCssClass);
//                    console.log(collided);
                    if(collided.length > 0){
                        $(this).removeClass("enemy");
                        $(this).remove();
                        //The player has been hit!
                        if($("#duck")[0].player.damage()){
                            explodePlayer($("#duck"));
                        }
                    }
                    //Make the enemy fire
//                    if(this.enemy instanceof Brainy){
//                        if(Math.random() < 0.05){
//                            var enemyposx = $(this).x();
//                            var enemyposy = $(this).y();
//                            var name = "enemiesMissile_"+Math.ceil(Math.random()*1000);
//                            $("#enemiesMissileLayer").addSprite(name,{animation: missile["enemies"], posx: enemyposx, posy: enemyposy + 20, width: 30,height: 15});
//                            $("#"+name).addClass("enemiesMissiles");
//                        }
//                    }
                });
            }, REFRESH_RATE);

            //generate enemies
            $.playground().registerCallback(function () {

                var name = "enemy1_" + Math.ceil(Math.random() * 1000);
                var enemyType = parseInt(Math.random()*10) % 3;

                var enemyPositions = [350, 200, 50];
                var position = enemyPositions[enemyType];

                $("#objects").addSprite(name, {animation: enemies[enemyType], posx: PLAYGROUND_WIDTH, posy: position, width: enemiesSize[enemyType].width, height: enemiesSize[enemyType].height});
                $("#" + name).addClass("enemy");
                $("#" + name)[0].enemy = new Minion($("#" + name));


            }, 1500);

            //animate waves
            $.playground().registerCallback(function () {
                //Offset all the pane:
                var newPos = (parseInt($("#background1").css("left")) - backSpeed - PLAYGROUND_WIDTH)
                        % (-2 * PLAYGROUND_WIDTH) + PLAYGROUND_WIDTH;
                $("#background1").css("left", newPos);

                var newPos = (parseInt($("#background11").css("left")) - backSpeed)
                        % (-2 * PLAYGROUND_WIDTH);
                $("#background11").css("left", newPos);

                newPos = (parseInt($("#background2").css("left")) - centerSpeed - PLAYGROUND_WIDTH)
                % (-2 * PLAYGROUND_WIDTH) + PLAYGROUND_WIDTH;
                $("#background2").css("left", newPos);

                newPos = (parseInt($("#background22").css("left")) - centerSpeed)
                % (-2 * PLAYGROUND_WIDTH);
                $("#background22").css("left", newPos);

                newPos = (parseInt($("#background3").css("left")) - frontSpeed - PLAYGROUND_WIDTH)
                % (-2 * PLAYGROUND_WIDTH) + PLAYGROUND_WIDTH;
                $("#background3").css("left", newPos);

                newPos = (parseInt($("#background33").css("left")) - frontSpeed)
                % (-2 * PLAYGROUND_WIDTH);
                $("#background33").css("left", newPos);
            }, REFRESH_RATE);

            $.playground().startGame(function () {
            });
        })
    </script>
    <style type="text/css">
        html, body {
            margin: 0;
            padding: 0;
            background: black;
        }
    </style>
</head>
<body>
<div id="playground" style="width: 700px; height: 500px; background: white;">

</div>
</body>
</html>
{'fraction_non_alphanumeric': 0.1361222639554462, 'fraction_numerical': 0.02033415360704572, 'mean_word_length': 1.2511175898931002, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, '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': '1136053', 'n_tokens_mistral': 6514, 'n_tokens_neox': 5677, 'n_words': 1072}