<commit_before>function Puzzle() {

  this.gridOrigin = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ];
  this.gridGame = this.shuffle(this.gridOrigin);
  this.gridMoves = [
    [2, 5],      [1, 3, 6],      [2, 4, 7],       [3, 8],
    [1, 6, 9],   [2, 5, 7, 10],  [3, 6, 8, 11],   [4, 7, 12],
    [5, 10, 13], [6, 9, 11, 14], [7, 10, 12, 15], [8, 11, 16],
    [9, 14],     [10, 13, 15],   [11, 14, 16],    [12, 15]
  ];

  this.validMoves = this.getValidMoves();
  this.position = [0, 0];
  this.validClick = false;
  this.solved = false;
  this.count = 0;
  this.message = "You Won in " + this.count + " moves!";

  this.canvas = document.getElementById("canvas");
  this.context = canvas.getContext("2d");
  this.styles = {};

  this.restart();
  this.canvas.addEventListener("mousedown", this.updatePuzzle.bind(this), true);

};

Puzzle.prototype = {

  drawCanvas: function() {
    var canvas = this.canvas;
    canvas.width = this.styles.canvasDim;
    canvas.height = this.styles.canvasDim;
  },

  setStyles: function() {
    this.styles.canvasDim = 400;
    this.styles.tileDim = this.styles.canvasDim/4;
    this.styles.stroke = this.styles.tileDim/10;
    this.styles.light = "White";
    this.styles.med = "DarkTurquoise";
    this.styles.dark = "DarkSlateGray";
    this.styles.fontSize = this.styles.tileDim/5;
    this.styles.fontFamily = "sans-serif";
    this.styles.font = this.styles.fontSize + "px " + this.styles.fontFamily;
    this.styles.fontLarge = this.styles.fontSize*2 + "px " + this.styles.fontFamily;
  },

  shuffle: function(arr) {
    var currentIndex = arr.length, temporaryValue, randomIndex ;
    while (0 !== currentIndex) {
      randomIndex = Math.floor(Math.random() * currentIndex);
      currentIndex -= 1;
      temporaryValue = arr[currentIndex];
      arr[currentIndex] = arr[randomIndex];
      arr[randomIndex] = temporaryValue;
    }
    var newArr = arr;
    return newArr;
  },

  drawTile: function(x, y, i) {
    var styles = this.styles,
        context = this.context,
        s = styles.tileDim;

    if (i === 16) {
      context.fillStyle = this.solved ? styles.med : styles.dark;<commit_msg>added credit<commit_after>function Puzzle() {

  this.gridOrigin = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ];
  this.gridGame = this.shuffle(this.gridOrigin);
  this.gridMoves = [
    [2, 5],      [1, 3, 6],      [2, 4, 7],       [3, 8],
    [1, 6, 9],   [2, 5, 7, 10],  [3, 6, 8, 11],   [4, 7, 12],
    [5, 10, 13], [6, 9, 11, 14], [7, 10, 12, 15], [8, 11, 16],
    [9, 14],     [10, 13, 15],   [11, 14, 16],    [12, 15]
  ];

  this.validMoves = this.getValidMoves();
  this.position = [0, 0];
  this.validClick = false;
  this.solved = false;
  this.count = 0;
  this.message = "You Won in " + this.count + " moves!";

  this.canvas = document.getElementById("canvas");
  this.context = canvas.getContext("2d");
  this.styles = {};

  this.restart();
  this.canvas.addEventListener("mousedown", this.updatePuzzle.bind(this), true);

};

Puzzle.prototype = {

  drawCanvas: function() {
    var canvas = this.canvas;
    canvas.width = this.styles.canvasDim;
    canvas.height = this.styles.canvasDim;
  },

  setStyles: function() {
    this.styles.canvasDim = 400;
    this.styles.tileDim = this.styles.canvasDim/4;
    this.styles.stroke = this.styles.tileDim/10;
    this.styles.light = "White";
    this.styles.med = "DarkTurquoise";
    this.styles.dark = "DarkSlateGray";
    this.styles.fontSize = this.styles.tileDim/5;
    this.styles.fontFamily = "sans-serif";
    this.styles.font = this.styles.fontSize + "px " + this.styles.fontFamily;
    this.styles.fontLarge = this.styles.fontSize*2 + "px " + this.styles.fontFamily;
  },
  // Fisher–Yates shuffle: http://sedition.com/perl/javascript-fy.html
  shuffle: function(arr) {
    var currentIndex = arr.length, temporaryValue, randomIndex ;
    while (0 !== currentIndex) {
      randomIndex = Math.floor(Math.random() * currentIndex);
      currentIndex -= 1;
      temporaryValue = arr[currentIndex];
      arr[currentIndex] = arr[randomIndex];
      arr[randomIndex] = temporaryValue;
    }
    var newArr = arr;
    return newArr;
  },

  drawTile: function(x, y, i) {
    var styles = this.styles,
        context = this.context,
        s = styles.tileDim;

    if (i === 16) {
      context.fillStyle = this.solved ? styles.med : styles.dark;
{'fraction_non_alphanumeric': 0.17042606516290726, 'fraction_numerical': 0.04921394395078606, 'mean_word_length': 2.871252204585538, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2292750', 'n_tokens_mistral': 1766, 'n_tokens_neox': 1569, 'n_words': 355}