<commit_before>var last_mouse_x = 0;
var last_mouse_y = 0;
var spaceships = [];
var bullets = [];
var EXPL = 4;
var points = 0;
var shaking = 0;

function startGame(){
    console.log("Game Begins Now!");
    var canvas=document.getElementById("can");
    canvas.setAttribute("tabIndex",0);
    setInterval(repaint,30);
    setInterval(update,30);
    
}
function repaint(){
    var canvas=document.getElementById("can");
    var ctx= canvas.getContext("2d");
    
    // shake
    var translation_x = (Math.random()*50 - 25)*shaking;
    var translation_y = (Math.random()*50 - 25)*shaking;
    ctx.translate(translation_x,translation_y);
    
    var rotation_ang = (Math.random()*Math.PI/4 - Math.PI/8)*shaking*0.5;
    ctx.translate(canvas.width/2,canvas.height/2);
    ctx.rotate(rotation_ang);
    ctx.translate(-canvas.width/2,-canvas.height/2);

    // clear the sceen
    ctx.fillStyle = "#000000";
    ctx.fillRect(0,0,canvas.width,canvas.height);
    
    // draw the enemies
    ctx.fillStyle = "#FF0000";
    for (var i = spaceships.length - 1; i >= 0; i--) {
        ctx.fillRect(spaceships[i][0],spaceships[i][1],40,40);
    }

    // draw the bullets
    ctx.fillStyle = "#00FF00";
    for (var i = bullets.length - 1; i >= 0; i--) {
        ctx.fillRect(bullets[i][0],bullets[i][1],10,10);
    }

    // draw the hero
    ctx.fillStyle = "#0000FF";
    ctx.fillRect(last_mouse_x - 60,last_mouse_y - 10,20,20);

    // unshake
    ctx.translate(canvas.width/2,canvas.height/2);
    ctx.rotate(-rotation_ang);
    ctx.translate(-canvas.width/2,-canvas.height/2);
    
    ctx.translate(-translation_x,-translation_y);

    // keep score<commit_msg>Added code to draw ship images<commit_after>var last_mouse_x = 0;
var last_mouse_y = 0;
var spaceships = [];
var bullets = [];
var EXPL = 4;
var points = 0;
var shaking = 0;
var shipLeft = new Image();
var shipRight = new Image();

function startGame(){
    console.log("Game Begins Now!");
    var canvas=document.getElementById("can");
    canvas.setAttribute("tabIndex",0);
    setInterval(repaint,30);
    setInterval(update,30);
    shipLeft.src="static/images/ship_loop_left.gif";
    shipRight.src="static/images/ship_loop.gif";
    
}
function repaint(){
    var canvas=document.getElementById("can");
    var ctx= canvas.getContext("2d");
    
    // shake
    var translation_x = (Math.random()*50 - 25)*shaking;
    var translation_y = (Math.random()*50 - 25)*shaking;
    ctx.translate(translation_x,translation_y);
    
    var rotation_ang = (Math.random()*Math.PI/4 - Math.PI/8)*shaking*0.5;
    ctx.translate(canvas.width/2,canvas.height/2);
    ctx.rotate(rotation_ang);
    ctx.translate(-canvas.width/2,-canvas.height/2);

    // clear the sceen
    ctx.fillStyle = "#000000";
    ctx.fillRect(0,0,canvas.width,canvas.height);
    
    // draw the enemies
    ctx.fillStyle = "#FF0000";
    for (var i = spaceships.length - 1; i >= 0; i--) {
        // ctx.fillRect(spaceships[i][0],spaceships[i][1],40,40);
        ctx.drawImage(shipLeft,spaceships[i][0],spaceships[i][1],40,40);
    }

    // draw the bullets
    ctx.fillStyle = "#00FF00";
    for (var i = bullets.length - 1; i >= 0; i--) {
        ctx.fillRect(bullets[i][0],bullets[i][1],10,10);
    }

    // draw the hero
    ctx.fillStyle = "#0000FF";
    ctx.fillRect(last_mouse_x - 60,last_mouse_y - 10,20,20);

    // unshake
    ctx.translate(canvas.width/2,canvas.height/2);
    ctx.rotate(-rotation_ang);
    ctx.translate(-canvas.width/2,-canvas.height/2);
    
    ctx.translate(-translation_x,-translation_y);

    // keep score
{'fraction_non_alphanumeric': 0.16825041922861933, 'fraction_numerical': 0.043599776411403016, 'mean_word_length': 3.1471610660486675, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1410405', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1242, 'n_words': 219}