<commit_before><%= render 'home' %>

<script>
$(function(){

  // initialize drag and drop elements with Jquery plugin //
  $('.draggable').draggable({
    snap: ".droppable",
    snapTolerance: 10,
    // revert pieces to original position if not valid move //
    stop: function(event, ui) {
      var piece = $(this);
      var pieceStyle = $(this).css('top');
      if (pieceStyle !== '0px') {
        piece.animate({
          top: 0,
          left: 0,
        }, 500);
      }
    },
    start: function(event, ui) {
      var startingPoint = $(this).closest('div').attr('id');
      var startingPosition = $(this).closest('div');
      var pieceType = $(this).attr('class');

      // set forward movement for pawns //
      if (pieceType.match(/glyphicon-pawn black/)) {
        $('.droppable').droppable("disable");
        $(this).parent().next().droppable('enable');
      }
      else if (pieceType.match(/glyphicon-pawn white/)) {
        $('.droppable').droppable("disable");
        $(this).parent().prev().droppable('enable');
      }
      // set vertical and horizontal movement for rooks //
      else if (pieceType.match(/glyphicon-tower/)) {
        $('.droppable').droppable("disable");
        var letterVar = startingPoint[4];
        var numberVar = startingPoint[5];
        $('.chess-holder').children('div[class*=col]').children('div[id*='+ letterVar +']').droppable('enable');
        $('.chess-holder').children('div[class*=col]').children('div[id*='+ numberVar +']').droppable('enable');

      }

      // set diagonal movement for bishops //

      else if (pieceType.match(/glyphicon-bishop black/)) {
        $('.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;
         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*=white]').length !== 0) {
             break;
           }

           xAxis += 1;
           yAxis += 1;
           if ($('.col-md-1').children('div[id*=' + letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
             break;
           }

         }
         divArray.forEach(enableElements);
         function enableElements(entry) {
           $('.chess-holder').children('div[class*=col]').children('div[id*='+ entry +']').droppable('enable');
         }
         // set -x-y diagonal //
         xAxis = letterArray.indexOf(letterVar) + 1;
         yAxis = parseInt(startingPoint[5]);
         while (xAxis >= 1 && yAxis >= 1 ) {

           var tempPosition = $('.col-md-1').children('div[id*=' + letterArray[xAxis -1] + yAxis + ']');
           if (tempPosition.children('span[id*=white]').length !== 0) {
             break;
           }

           divArray.push(letterArray[xAxis - 1] + yAxis);
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
             break;
           }
           xAxis -= 1;
           yAxis -= 1;
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
             break;
           }
         }
         divArray.forEach(enableElements);
         // set +x-y diagonal //
         xAxis = letterArray.indexOf(letterVar) + 1;
         yAxis = parseInt(startingPoint[5]);
         while (xAxis <= 8 && yAxis >= 1 ) {
           var tempPosition = $('.col-md-1').children('div[id*=' + letterArray[xAxis] + (yAxis-1) + ']');
           if (tempPosition.children('span[id*=white]').length !== 0) {
             break;
           }

           divArray.push(letterArray[xAxis - 1] + yAxis);
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
             break;
           }
           xAxis += 1;
           yAxis -= 1;
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
             break;
           }
         }
         divArray.forEach(enableElements);
         // set -x+y diagonal //
         xAxis = letterArray.indexOf(letterVar) + 1;
         yAxis = parseInt(startingPoint[5]);
         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*=white]').length !== 0) {
             break;
           }
           xAxis -= 1;
           yAxis += 1;
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
             break;
           }
         }
         divArray.forEach(enableElements);
         console.log(divArray);
       }
      // set diagonal movement for bishops //

      else if (pieceType.match(/glyphicon-bishop 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;
         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);<commit_msg>added no skips to rook behavior<commit_after><%= render 'home' %>

<script>
$(function(){

  // initialize drag and drop elements with Jquery plugin //
  $('.draggable').draggable({
    snap: ".droppable",
    snapTolerance: 10,
    // revert pieces to original position if not valid move //
    stop: function(event, ui) {
      var piece = $(this);
      var pieceStyle = $(this).css('top');
      if (pieceStyle !== '0px') {
        piece.animate({
          top: 0,
          left: 0,
        }, 500);
      }
    },
    start: function(event, ui) {
      var startingPoint = $(this).closest('div').attr('id');
      var startingPosition = $(this).closest('div');
      var pieceType = $(this).attr('class');

      // set forward movement for pawns //
      if (pieceType.match(/glyphicon-pawn black/)) {
        $('.droppable').droppable("disable");
        $(this).parent().next().droppable('enable');
      }
      else if (pieceType.match(/glyphicon-pawn white/)) {
        $('.droppable').droppable("disable");
        $(this).parent().prev().droppable('enable');
      }
      // set vertical and horizontal movement for rooks //
      else if (pieceType.match(/glyphicon-tower black/)) {
        $('.droppable').droppable("disable");
        var letterVar = startingPoint[4];
        var numberVar = startingPoint[5];
        $('.droppable').droppable("disable");

        // set +y vertical for black rook //

         var yAxis = parseInt(startingPoint[5]);
         var letterArray = ["a", "b", "c", "d", "e", "f", "g", "h"];
         var xAxis = letterArray.indexOf(letterVar) + 1;
         var divArray = [];
         while (yAxis <= 8 ) {
           divArray.push(letterArray[xAxis -1] + yAxis);

           //check for this white piece, then for next black piece //
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
             break;
           }

           yAxis += 1;

           if ($('.col-md-1').children('div[id*=' + letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
             break;
           }
         }
         // set -y vertical for black rook //
         xAxis = letterArray.indexOf(letterVar) + 1;
         yAxis = parseInt(startingPoint[5]);

         while (yAxis >= 1 ) {
           divArray.push(letterArray[xAxis -1] + yAxis);

           //check for this white piece, then for next black piece //
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
             break;
           }

           yAxis -= 1;

           if ($('.col-md-1').children('div[id*=' + letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
             break;
           }
         }

         // set + x horizontal for black rook //
         xAxis = letterArray.indexOf(letterVar) + 1;
         yAxis = parseInt(startingPoint[5]);

         while (xAxis <= 8 ) {
           divArray.push(letterArray[xAxis -1] + yAxis);

           //check for this white piece, then for next black piece //
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
             break;
           }

           xAxis += 1;

           if ($('.col-md-1').children('div[id*=' + letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
             break;
           }
         }

         // set - x horizontal for black rook //
         while (xAxis >= 1 ) {
           divArray.push(letterArray[xAxis -1] + yAxis);

           //check for this white piece, then for next black piece //
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
             break;
           }

           xAxis -= 1;

           if ($('.col-md-1').children('div[id*=' + letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
             break;
           }
         }
         console.log(divArray);
         divArray.forEach(enableElements);
         function enableElements(entry) {
           $('.chess-holder').children('div[class*=col]').children('div[id*='+ entry +']').droppable('enable');
         }

      }
      else if (pieceType.match(/glyphicon-tower white/)) {
        $('.droppable').droppable("disable");
        var letterVar = startingPoint[4];
        var numberVar = startingPoint[5];
        $('.droppable').droppable("disable");

        // set +y vertical for black rook //

         var yAxis = parseInt(startingPoint[5]);
         var letterArray = ["a", "b", "c", "d", "e", "f", "g", "h"];
         var xAxis = letterArray.indexOf(letterVar) + 1;
         var divArray = [];
         while (yAxis <= 8 ) {
           divArray.push(letterArray[xAxis -1] + yAxis);

           //check for this white piece, then for next black piece //
           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;
           }
         }
         // set -y vertical for black rook //
         xAxis = letterArray.indexOf(letterVar) + 1;
         yAxis = parseInt(startingPoint[5]);

         while (yAxis >= 1 ) {
           divArray.push(letterArray[xAxis -1] + yAxis);

           //check for this white piece, then for next black piece //
           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;
           }
         }

         // set + x horizontal for black rook //
         xAxis = letterArray.indexOf(letterVar) + 1;
         yAxis = parseInt(startingPoint[5]);

         while (xAxis <= 8 ) {
           divArray.push(letterArray[xAxis -1] + yAxis);

           //check for this white piece, then for next black piece //
           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;
           }
         }

         // set - x horizontal for black rook //
         while (xAxis >= 1 ) {
           divArray.push(letterArray[xAxis -1] + yAxis);

           //check for this white piece, then for next black piece //
           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;
           }
         }
         console.log(divArray);
         divArray.forEach(enableElements);
         function enableElements(entry) {
           $('.chess-holder').children('div[class*=col]').children('div[id*='+ entry +']').droppable('enable');
         }

      }

      // set diagonal movement for bishops //

      else if (pieceType.match(/glyphicon-bishop black/)) {
        $('.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;
         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*=white]').length !== 0) {
             break;
           }

           xAxis += 1;

           if ($('.col-md-1').children('div[id*=' + letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
             break;
           }

         }
         divArray.forEach(enableElements);
        //  function enableElements(entry) {
        //    $('.chess-holder').children('div[class*=col]').children('div[id*='+ entry +']').droppable('enable');
        //  }
         // set -x-y diagonal //
         xAxis = letterArray.indexOf(letterVar) + 1;
         yAxis = parseInt(startingPoint[5]);
         while (xAxis >= 1 && yAxis >= 1 ) {

           var tempPosition = $('.col-md-1').children('div[id*=' + letterArray[xAxis -1] + yAxis + ']');
           if (tempPosition.children('span[id*=white]').length !== 0) {
             break;
           }

           divArray.push(letterArray[xAxis - 1] + yAxis);
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
             break;
           }
           xAxis -= 1;
           yAxis -= 1;
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
             break;
           }
         }
         divArray.forEach(enableElements);
         // set +x-y diagonal //
         xAxis = letterArray.indexOf(letterVar) + 1;
         yAxis = parseInt(startingPoint[5]);
         while (xAxis <= 8 && yAxis >= 1 ) {
           var tempPosition = $('.col-md-1').children('div[id*=' + letterArray[xAxis] + (yAxis-1) + ']');
           if (tempPosition.children('span[id*=white]').length !== 0) {
             break;
           }

           divArray.push(letterArray[xAxis - 1] + yAxis);
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=white]').length !== 0) {
             break;
           }
           xAxis += 1;
           yAxis -= 1;
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
             break;
           }
         }
         divArray.forEach(enableElements);
         // set -x+y diagonal //
         xAxis = letterArray.indexOf(letterVar) + 1;
         yAxis = parseInt(startingPoint[5]);
         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*=white]').length !== 0) {
             break;
           }
           xAxis -= 1;
           yAxis += 1;
           if ($('.col-md-1').children('div[id*='+ letterArray[xAxis-1] + yAxis+']').children('span[class*=black]').length !== 0) {
             break;
           }
         }
         divArray.forEach(enableElements);
         console.log(divArray);
       }
      // set diagonal movement for bishops //

      else if (pieceType.match(/glyphicon-bishop 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;
         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);
{'fraction_non_alphanumeric': 0.19392238869183123, 'fraction_numerical': 0.01371168404891736, 'mean_word_length': 1.9790253903169848, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 19, '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': '4023824', 'n_tokens_mistral': 6046, 'n_tokens_neox': 5734, 'n_words': 1116}