<commit_before>var Tetrinimo = function(args) {
  this.element = args.element;
  var shape = args.shape;

  this.blocks = shape.map(function(block) {
    return {x: new Number(block.x), y: new Number(block.y)};
  });

  this.row = 0;
  this.col = 5;

  for(var block in this.blocks) {
    this.blocks[block].y += this.row;
    this.blocks[block].x += this.col;
  }
}
Tetrinimo.prototype.raise = function() {
  this.row--;
  for(var block in this.blocks) {
    this.blocks[block].y--;
  }
};
Tetrinimo.prototype.drop = function() {
  this.row++;
  for(var block in this.blocks) {
    this.blocks[block].y++;
  }
};
var directToInt = {
  'left': -1,
  'right': 1
};
Tetrinimo.prototype.slide = function(direction) {
  this.blocks.forEach(function(block) {
    block.x += directToInt[direction];
  });
};
Tetrinimo.prototype.rotate = function(direction) {
  var modX, modY;
  var center = this.blocks[0];

  this.blocks.forEach(function(block) {
    console.log('block', block, 'center', center);
    modX = block.y - center.y;
    modY = block.x - center.x;
    if(modY !== 0) modY * -1;

    console.log('modX', modX, 'modY', modY);
    block.x = center.x + modX;
    block.y = center.y + modY;
  });
};<commit_msg>Update tetrinimo rotate to use different directions<commit_after>var Tetrinimo = function(args) {
  this.element = args.element;
  var shape = args.shape;

  this.blocks = shape.map(function(block) {
    return {x: new Number(block.x), y: new Number(block.y)};
  });

  this.row = 0;
  this.col = 5;

  for(var block in this.blocks) {
    this.blocks[block].y += this.row;
    this.blocks[block].x += this.col;
  }
}
Tetrinimo.prototype.raise = function() {
  this.row--;
  for(var block in this.blocks) {
    this.blocks[block].y--;
  }
};
Tetrinimo.prototype.drop = function() {
  this.row++;
  for(var block in this.blocks) {
    this.blocks[block].y++;
  }
};
var directToInt = {
  'left': -1,
  'right': 1
};
Tetrinimo.prototype.slide = function(direction) {
  this.blocks.forEach(function(block) {
    block.x += directToInt[direction];
  });
};
Tetrinimo.prototype.rotate = function(direction) {
  var modX, modY;
  var center = this.blocks[0];

  this.blocks.forEach(function(block) {
    console.log('block', block, 'center', center);
    modX = block.y - center.y;
    modY = block.x - center.x;
    if(direction == 'counter') {
      if(modY !== 0) modY *= -1;
    }
    else {
      if(modX !== 0) modX *= -1;
    }

    console.log('modX', modX, 'modY', modY);
    block.x = center.x + modX;
    block.y = center.y + modY;
  });
};
{'fraction_non_alphanumeric': 0.18060985144644254, 'fraction_numerical': 0.006254886630179828, 'mean_word_length': 3.0362776025236595, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4387469', 'n_tokens_mistral': 973, 'n_tokens_neox': 949, 'n_words': 191}