<commit_before>
var canvas = document.getElementById('game');
var context = canvas.getContext('2d');
var canvasWidth = canvas.width;
var canvasHeight = canvas.height;

function Block(options) {
  options = options || {};
  this.x = options.x || 10;
  this.y = options.y || 10;
  this.width = options.width || 10;
  this.height = options.height || 10;
  this.vx = 3;
  this.vy = 3;
}

var ball = new Block();


function gameLoop() {
  context.clearRect(0, 0, canvasWidth, canvasHeight);
  ball.draw().move();
  requestAnimationFrame(gameLoop);
}

Block.prototype.draw = function () {

  context.fillRect(this.x, this.y, this.width, this.height);
  return this;
};

// if(ball.y + ball.radius > h || ball.y - ball.radius < 0) {
// 	ball.vy = -ball.vy;
// }
// if(ball.x + ball.radius > w || ball.x - ball.radius < 0) {
// 	ball.vx = -ball.vx;
// }

Block.prototype.move = function () {
  if(this.x + this.width > canvasWidth || this.x - this.width < 0) {
    console.log('hit the fucking wall!')
  	this.vx = -this.vx;
  } else {
    this.x += this.vx, this.y, this.width, this.height;
  }
  return this;
};
//
// function checkEdge() {
//   if (this.x < canvasWidth )
// }

requestAnimationFrame(gameLoop);

canvas.addEventListener('click', function(event) {
  var location = {x: event.x, y: event.y};
  var newBlock = new Block(location);
  blocks.push(newBlock);
});<commit_msg>ball bounces all around beautifully<commit_after>
var canvas = document.getElementById('game');
var context = canvas.getContext('2d');
var canvasWidth = canvas.width;
var canvasHeight = canvas.height;

function Block(options) {
  options = options || {};
  this.x = options.x || 10;
  this.y = options.y || 10;
  this.width = options.width || 10;
  this.height = options.height || 10;
  this.vx = 2;
  this.vy = 3;
}

var ball = new Block();


function gameLoop() {
  context.clearRect(0, 0, canvasWidth, canvasHeight);
  ball.draw().move();
  requestAnimationFrame(gameLoop);
}

Block.prototype.draw = function () {

  context.fillRect(this.x, this.y, this.width, this.height);
  return this;
};

// if(ball.y + ball.radius > h || ball.y - ball.radius < 0) {
// 	ball.vy = -ball.vy;
// }
// if(ball.x + ball.radius > w || ball.x - ball.radius < 0) {
// 	ball.vx = -ball.vx;
// }



Block.prototype.move = function () {
  if(this.x + this.width > canvasWidth || this.x - this.width < 0) {
    this.vx = -this.vx;
  }
  if(this.y + this.height > canvasHeight || this.y - this.height < 0) {
    this.vy = -this.vy;
  }
  this.x += this.vx, this.y += this.vy, this.width, this.height;
  return this;
};
//
// function checkEdge() {
//   if (this.x < canvasWidth )
// }

requestAnimationFrame(gameLoop);

canvas.addEventListener('click', function(event) {
  var location = {x: event.x, y: event.y};
  var newBlock = new Block(location);
  blocks.push(newBlock);
});
{'fraction_non_alphanumeric': 0.1823943661971831, 'fraction_numerical': 0.011619718309859155, 'mean_word_length': 3.159590043923865, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 10, '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': '169883', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1007, 'n_words': 228}