<commit_before><!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>This is my first EAR attempt</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width">

        <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->

        <link rel="stylesheet" href="css/normalize.css">
        <link rel="stylesheet" href="css/main.css">
        <script src="js/vendor/modernizr-2.6.2.min.js"></script>
        <script>

            //Declare all of your variables here
            var canvas = null;
            var ctx = null;
            var bufferCanvas = null;
            var bufferCanvasCtx = null;
            var mode = null;
            var startText = null;
            var score = null;

            //main() gets called onload body
            function main() {
                canvas = document.getElementById("canvas");
                ctx  = canvas.getContext("2d");

                bufferCanvas = document.createElement("canvas");
                bufferCanvasCtx = bufferCanvas.getContext("2d");
                bufferCanvasCtx.canvas.width = ctx.canvas.width;
                bufferCanvasCtx.canvas.height = ctx.canvas.height;

                mode = "start";
                startText = "Press any key to start";

                if (mode == "start") {
                    score = 0;
                    openingTimer = setInterval(drawOpening, 300);
                }

                //Draw();

                //setInterval(animate, 30);
            }

            // Objects
            /* Add your objects here */

            // Events
            document.onkeydown = keyPress;

            // Actions
            function keyPress(e) {
                if (mode == "start") {
                    clearInterval(openingTimer);
                    mode = 1;
                    alert(mode);
                }
            }


            // Rendering
            function blank() {
                bufferCanvasCtx.fillStyle = "#000";
                bufferCanvasCtx.fillRect(0,0,bufferCanvasCtx.canvas.width, bufferCanvasCtx.canvas.height);
            }

            function animate() {
                Update();
                Draw();
            }

            function Update() {
            /* all the state change logic goes here */
            }

            function Draw() {
                ctx.save();

                blank();

                /* Remember to use bufferCanvasCtx */
<commit_msg>adds hero movement and basic peashooter firing mechanism<commit_after><!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>This is my first EAR attempt</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width">

        <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->

        <link rel="stylesheet" href="css/normalize.css">
        <link rel="stylesheet" href="css/main.css">
        <script src="js/vendor/modernizr-2.6.2.min.js"></script>
        <script>

            //Declare all of your variables here
            var canvas = null;
            var ctx = null;
            var bufferCanvas = null;
            var bufferCanvasCtx = null;
            var mode = "start";
            var startText = "Press any key to start";
            var score = null;
            var hero = null;
            var weapon = 1;
            var peaShooterArray = [];

            //main() gets called onload body
            function main() {
                canvas = document.getElementById("canvas");
                ctx  = canvas.getContext("2d");

                bufferCanvas = document.createElement("canvas");
                bufferCanvasCtx = bufferCanvas.getContext("2d");
                bufferCanvasCtx.canvas.width = ctx.canvas.width;
                bufferCanvasCtx.canvas.height = ctx.canvas.height;

                if (mode == "start") {
                    score = 0;
                    openingTimer = setInterval(drawOpening, 300);
                }

                if (!isNaN(mode)) {
                    playGame(mode);
                }

                //Draw();

                //setInterval(animate, 30);
            }

            // Objects
            function spaceShip() {
                this.w = 50;
                this.h = this.w;
                this.x = 0;
                this.y = canvas.height/2 - this.h/2;
                this.color = "white";
            }

            function peaShooterBlast() {
                this.w = 30;
                this.h = 10;
                this.y = hero.y + hero.h/2 - this.h/2;
                this.x = hero.w;
                this.color = "yellow";
                this.velx = 25;
            }

            // Events
            document.onkeydown = keyPress;
            document.onmousemove = moveMouse;
            document.onmouseup = mousePress;

            // Actions
            function keyPress(e) {
                if (mode == "start") {
                    clearInterval(openingTimer);
                    mode = 1;
                    main();
                }
            }

            function moveMouse(e) {
                if (!isNaN(mode)) {
                    if (hero) {
                        if (e.pageY < canvas.height) {
                            hero.y = e.pageY;
                        } else {
                            hero.y = canvas.height - hero.h;
                        }
                    }
                }
            }

            function mousePress() {
                if (!isNaN(mode)) {
                    if (hero) {
                        fireWeapon(weapon);
                    }
                }
            }

            function fireWeapon(weapon) {
                // Peashooter
                if (weapon == 1) {
                    peaShooterArray[peaShooterArray.length] = new peaShooterBlast();
                }
            }

            function playGame(mode) {
                hero = new spaceShip();
                setInterval(animate, 30);
            }


            // Rendering
            function blank() {
                bufferCanvasCtx.fillStyle = "#000";
                bufferCanvasCtx.fillRect(0,0,bufferCanvasCtx.canvas.width, bufferCanvasCtx.canvas.height);
            }

            function animate() {
                Update();
                Draw();
            }

            function Update() {
                for (var i = 0; i < peaShooterArray.length; i++) {
                    peaShooterArray[i].x += peaShooterArray[i].velx;
                    if(peaShooterArray[i].x > canvas.width) {
                        peaShooterArray.shift();
                    }
                }
            }

            function Draw() {
                ctx.save();

                blank();

                bufferCanvasCtx.fillStyle = "white";
                bufferCanvasCtx.fillRect(hero.x, hero.y, hero.w, hero.h);

                for (var i = 0; i < peaShooterArray.length; i++) {
                    bufferCanvasCtx.fillStyle = peaShooterArray[i].color;
                    bufferCanvasCtx.fillRect(peaShooterArray[i].x, peaShooterArray[i].y, peaShooterArray[i].w, peaShooterArray[i].h);
                }

{'fraction_non_alphanumeric': 0.12478053674441936, 'fraction_numerical': 0.00965638324554803, 'mean_word_length': 1.2024302678818006, 'pattern_counts': {'":': 0, '<': 62, '<?xml version=': 0, '>': 58, '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': '470258', 'n_tokens_mistral': 2271, 'n_tokens_neox': 2057, 'n_words': 461}