<commit_before>// Enemies our player must avoid
var Enemy = function(y) {
    // Variables applied to each of our instances go here,
    // we've provided one for you to get started

    // The image/sprite for our enemies, this uses
    // a helper we've provided to easily load images
    this.sprite = 'images/enemy-bug.png';
    this.x = -101;
    this.y = y;
    this.speed = Math.random() * (800 - 200) + 200;
};

// Update the enemy's position, required method for game
// Parameter: dt, a time delta between ticks
Enemy.prototype.update = function(dt) {
    // You should multiply any movement by the dt parameter
    // which will ensure the game runs at the same speed for
    // all computers.
    if (this.x <= 505) {
        // increase the x value of enemy, until the end of canvas
        this.x += this.speed * dt;
    } else {
        // make the x value negative enough to let the specify line
        // have a little break
        this.x = Math.random() * (-101 - (-500)) + (-500);
        this.speed = Math.random() * (800 - 200) + 200;
    }
};

// Draw the enemy on the screen, required method for game
Enemy.prototype.render = function() {
    ctx.drawImage(Resources.get(this.sprite), this.x, this.y);
};

Enemy.prototype.checkCollisions = function (dt) {
    // collision or win judgement
    if ((player.x < this.x + 83 &&
        player.x + 83 > this.x &&
        player.y < this.y + 60 &&
        player.y + 60 > this.y) ||<commit_msg>adjust arcade game code:   1. use strict mode in app.js;   2. reduce magic numbers by adding getRandomArbitrary function<commit_after>'use strict';
// this function gets a random data from a stable scope.
// See: https://goo.gl/q1r8gU
function getRandomArbitrary(min, max) {
  return Math.random() * (max - min) + min;
}
// Enemies our player must avoid
var Enemy = function(y) {
    // Variables applied to each of our instances go here,
    // we've provided one for you to get started

    // The image/sprite for our enemies, this uses
    // a helper we've provided to easily load images
    this.sprite = 'images/enemy-bug.png';
    this.x = -101;
    this.y = y;
    this.speed = getRandomArbitrary(200, 800);
};

// Update the enemy's position, required method for game
// Parameter: dt, a time delta between ticks
Enemy.prototype.update = function(dt) {
    // You should multiply any movement by the dt parameter
    // which will ensure the game runs at the same speed for
    // all computers.
    if (this.x <= 505) {
        // increase the x value of enemy, until the end of canvas
        this.x += this.speed * dt;
    } else {
        // make the x value negative enough to let the specify line
        // have a little break
        this.x = getRandomArbitrary(-500, -101);
        this.speed = getRandomArbitrary(200, 800);
    }
};

// Draw the enemy on the screen, required method for game
Enemy.prototype.render = function() {
    ctx.drawImage(Resources.get(this.sprite), this.x, this.y);
};

Enemy.prototype.checkCollisions = function (dt) {
    // collision or win judgement
    if ((player.x < this.x + 83 &&
        player.x + 83 > this.x &&
        player.y < this.y + 60 &&
        player.y + 60 > this.y) ||
{'fraction_non_alphanumeric': 0.11773891317926297, 'fraction_numerical': 0.024047470331043097, 'mean_word_length': 2.433011789924973, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1548028', 'n_tokens_mistral': 1034, 'n_tokens_neox': 955, 'n_words': 370}