anchor.diff:        }
   
         // set movements for white queen //
  -
         else if (pieceType.match(/glyphicon-queen white/)) {
           $('.droppable').droppable("disable");
   
           // set +x+y diagonal //
  -         var letterVar = startingPoint[4];
  -         var yAxis = parseInt(startingPoint[5]);
  -         var letterArray = ["a", "b", "c", "d", "e", "f", "g", "h"];
  -         var xAxis = letterArray.indexOf(letterVar) + 1;
  +        resetVars(yAxis, xAxis);
            var divArray = [];
            while (xAxis <= 8 && yAxis <= 8 ) {
  -
  -           divArray.push(letterArray[xAxis -1] + yAxis);
  -
  -           //check for this white piece, then for next black piece //
  -           var lastElement = divArray[divArray.length -1];
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
  -             break;
  -           }
  -
  -           xAxis += 1;
  -           yAxis += 1;
  -           if ($('.col-md-1').children('div[id*=' + letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
  -             break;
  -           }
  -
  -         }
  -         divArray.forEach(enableElements);
  -        //  function enableElements(entry) {
  -        //    $('.chess-holder').children('div[class*=col]').children('div[id*='+ entry +']').droppable('enable');
  -        //  }
  +           pushElementToArray(divArray, xAxis, yAxis);
  +           if (checkForBlockingWhite(xAxis, yAxis)) {break;};
  +           xAxis += 1;
  +           yAxis += 1;
  +           if (checkForBlockingBlack(xAxis, yAxis)) {break;};
  +         }
  +
            // set -x-y diagonal //
  -         xAxis = letterArray.indexOf(letterVar) + 1;
  -         yAxis = parseInt(startingPoint[5]);
  +         resetVars(yAxis, xAxis);
            while (xAxis >= 1 && yAxis >= 1 ) {
  -
  -           var tempPosition = $('.col-md-1').children('div[id*=' + letterArray[xAxis -1] + yAxis + ']');
  -           if (tempPosition.children('span[id*=black]').length !== 0) {
  -             break;
  -           }
  -
  -           divArray.push(letterArray[xAxis - 1] + yAxis);
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
  -             break;
  -           }
  -           xAxis -= 1;
  -           yAxis -= 1;
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
  -             break;
  -           }
  -         }
  -         divArray.forEach(enableElements);
  +           pushElementToArray(divArray, xAxis, yAxis);
  +           if (checkForBlockingWhite(xAxis, yAxis)) {break;};
  +           xAxis -= 1;
  +           yAxis -= 1;
  +           if (checkForBlockingBlack(xAxis, yAxis)) {break;};
  +         }
  +
            // set +x-y diagonal //
  -         xAxis = letterArray.indexOf(letterVar) + 1;
  -         yAxis = parseInt(startingPoint[5]);
  +         resetVars(yAxis, xAxis);
            while (xAxis <= 8 && yAxis >= 1 ) {
  -           var tempPosition = $('.col-md-1').children('div[id*=' + letterArray[xAxis] + (yAxis-1) + ']');
  -           if (tempPosition.children('span[id*=black]').length !== 0) {
  -             break;
  -           }
  -
  -           divArray.push(letterArray[xAxis - 1] + yAxis);
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
  -             break;
  -           }
  -           xAxis += 1;
  -           yAxis -= 1;
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
  -             break;
  -           }
  -         }
  -         divArray.forEach(enableElements);
  +           pushElementToArray(divArray, xAxis, yAxis);
  +           if (checkForBlockingWhite(xAxis, yAxis)) {break;};
  +           xAxis += 1;
  +           yAxis -= 1;
  +           if (checkForBlockingBlack(xAxis, yAxis)) {break;};
  +         }
  +        //  divArray.forEach(enableElements);
            // set -x+y diagonal //
  -         xAxis = letterArray.indexOf(letterVar) + 1;
  -         yAxis = parseInt(startingPoint[5]);
  +         resetVars(yAxis, xAxis);
            while (xAxis >= 1 && yAxis <= 8) {
  -
  -          var tempPosition = $('.col-md-1').children('div[id*=' + letterArray[xAxis] + (yAxis-1) + ']');
  -
  -
  -           divArray.push(letterArray[xAxis - 1] + yAxis);
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
  -             break;
  -           }
  -           xAxis -= 1;
  -           yAxis += 1;
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
  -             break;
  -           }
  -         }
  -         divArray.forEach(enableElements);
  -         console.log(divArray);
  +          pushElementToArray(divArray, xAxis, yAxis);
  +          if (checkForBlockingWhite(xAxis, yAxis)) {break;};
  +           xAxis -= 1;
  +           yAxis += 1;
  +          if (checkForBlockingBlack(xAxis, yAxis)) {break;};
  +
  +         }
   
            // set y+ vertical for white queen //
  -         xAxis = letterArray.indexOf(letterVar) + 1;
  -         yAxis = parseInt(startingPoint[5]);
  +         resetVars(yAxis, xAxis);
            while (yAxis <= 8) {
  -
  -          var tempPosition = $('.col-md-1').children('div[id*=' + letterArray[xAxis] + (yAxis-1) + ']');
  -
  -
  -           divArray.push(letterArray[xAxis - 1] + yAxis);
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
  -             break;
  -           }
  -
  -           yAxis += 1;
  -
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
  -             break;
  -           }
  -         }
  -         divArray.forEach(enableElements);
  -         console.log(divArray);
  +          pushElementToArray(divArray, xAxis, yAxis);
  +          if (checkForBlockingWhite(xAxis, yAxis)) {break;};
  +           yAxis += 1;
  +          if (checkForBlockingBlack(xAxis, yAxis)) {break;};
  +         }
   
            // set y- vertical for white queen //
  -         xAxis = letterArray.indexOf(letterVar) + 1;
  -         yAxis = parseInt(startingPoint[5]);
  +
            while (yAxis >= 1) {
  -
  -          var tempPosition = $('.col-md-1').children('div[id*=' + letterArray[xAxis] + (yAxis-1) + ']');
  -
  -
  -           divArray.push(letterArray[xAxis - 1] + yAxis);
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
  -             break;
  -           }
  -
  -           yAxis -= 1;
  -
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
  -             break;
  -           }
  -         }
  -         divArray.forEach(enableElements);
  -         console.log(divArray);
  +          pushElementToArray(divArray, xAxis, yAxis);
  +          if (checkForBlockingWhite(xAxis, yAxis)) {break;};
  +           yAxis -= 1;
  +          if (checkForBlockingBlack(xAxis, yAxis)) {break;};
  +         }
   
            // set x+ horizontal for white queen  //
  -         xAxis = letterArray.indexOf(letterVar) + 1;
  -         yAxis = parseInt(startingPoint[5]);
  +         resetVars(yAxis, xAxis);
            while (xAxis <= 8 ) {
  -
  -          var tempPosition = $('.col-md-1').children('div[id*=' + letterArray[xAxis] + (yAxis-1) + ']');
  -
  -
  -           divArray.push(letterArray[xAxis - 1] + yAxis);
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
  -             break;
  -           }
  -
  -           xAxis += 1;
  -
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
  -             break;
  -           }
  -         }
  -         divArray.forEach(enableElements);
  -         console.log(divArray);
  +          pushElementToArray(divArray, xAxis, yAxis);
  +          if (checkForBlockingWhite(xAxis, yAxis)) {break;};
  +           xAxis += 1;
  +          if (checkForBlockingBlack(xAxis, yAxis)) {break;};
  +         }
   
            // set x- horizontal for white Queen //
  -
  -         xAxis = letterArray.indexOf(letterVar) + 1;
  -         yAxis = parseInt(startingPoint[5]);
  +         resetVars(yAxis, xAxis);
            while (xAxis >= 1 ) {
  -
  -          var tempPosition = $('.col-md-1').children('div[id*=' + letterArray[xAxis] + (yAxis-1) + ']');
  -
  -
  -           divArray.push(letterArray[xAxis - 1] + yAxis);
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
  -             break;
  -           }
  -
  -           xAxis -= 1;
  -
  -           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
  -             break;
  -           }
  -         }
  -         divArray.forEach(enableElements);
  -         console.log(divArray);
  +          pushElementToArray(divArray, xAxis, yAxis);
  +          if (checkForBlockingWhite(xAxis, yAxis)) {break;};
  +           xAxis -= 1;
  +          if (checkForBlockingBlack(xAxis, yAxis)) {break;};
  +         }
  +         divArray.forEach(enableElements);
         }
   
         // set movements for black queen //
  
positive.code:         divArray.push(letterArray[xAxis] + (yAxis - 1));
  
          divArray.forEach(enableElements);
          console.log(divArray);
        }
  
        if (pieceType.match(/white/) !== null) {
          $('.white').parent().droppable("disable");
        }
        else if (pieceType.match(/black/) !== null) {
          $('.black').parent().droppable("disable");
        }
  
  
      }
    });
  
  
negative.code:     }
    });
  
  });
  </script>
  