

function Square(number) {
  this.number = number;
}

function Board(string) {
  this.input = string;
  this.board = [];
  var smallArray = [new Square(0), new Square(0), new Square(0), new Square(0)];
  for (i=0; i<4; i++) {
    this.board.push(smallArray);
  }
}

Board.prototype.setUp = function() {
  var initialValues = this.input.split("");
  // find the index of values are NOT 0.
  for (i=0; i<initialValues.length; i++) {
      // find index of the value IF it's not zero
      var numToTest = parseInt(initialValues[i]);
    if (numToTest !== 0) {
      // convert that index to the index of this.board
      var innerArrayIndex = i%4;
      var outerArrayIndex = parseInt(i/4);
    // change the number property of the square at that index
    //   to the value from the input string.
      this.board[outerArrayIndex][innerArrayIndex].number = parseInt(initialValues[i]);
    }
  }
}


Board.prototype.toString = function(){
  console.log(_.flatten(this.board));
}



@@ -116,29 +116,85 @@
  = %5B
-%5D;%0A  var smallArray =
+%5Bnew Square(0), new Square(0), new Square(0), new Square(0)%5D,%0A               
  %5Bne
@@ -254,70 +254,166 @@
 (0)%5D
-;%0A  for (i=0; i%3C4; i++) %7B%0A    this.board.push(smallArray);%0A  %7D
+,%0A                %5Bnew Square(0), new Square(0), new Square(0), new Square(0)%5D,%0A                %5Bnew Square(0), new Square(0), new Square(0), new Square(0)%5D%5D;
 %0A%7D%0A%0A
@@ -497,49 +497,8 @@
 %22);%0A
-  // find the index of values are NOT 0.%0A
   fo
@@ -540,58 +540,8 @@
 ) %7B%0A
-      // find index of the value IF it's not zero%0A
     
@@ -617,63 +617,8 @@
 ) %7B%0A
-      // convert that index to the index of this.board%0A
     
@@ -693,115 +693,8 @@
 4);%0A
-    // change the number property of the square at that index%0A    //   to the value from the input string.%0A
     
@@ -836,40 +836,291 @@
 %7B%0A  
-console.log(_.flatten(this.board
+var flattenedBoard = _.flatten(this.board);%0A  // console.log(flattenedBoard);%0A  for (i=0; i%3CflattenedBoard.length; i++)%7B%0A    flattenedBoard%5Bi%5D = flattenedBoard%5Bi%5D.number.toString();%0A    if (i%254 === 3)%7B%0A      flattenedBoard%5Bi%5D += %22%5Cn%22;%0A    %7D%0A  %7D%0A  console.log(flattenedBoard.toString(
 ));%0A

debug accidentally cloning arrays in Board initialization; toString is working for testing