<commit_before>{% extends "task.html" %}

{% block styles %}
  {{ super() }}
  <link rel="stylesheet" href="{{ url_for('static', filename='chessboard-0.3.0.min.css') }}">
  <style type="text/css">
    #board {
      width: 400px;
      padding-bottom: 20px;
    }
  </style>
{% endblock %}

{% block scripts %}
  {{ super() }}
  <script src="{{ url_for('static', filename='chessboard-0.3.0.min.js') }}"></script>
  <script src="{{ url_for('static', filename='chess.min.js') }}"></script>
  <script>
    $(document).ready(function() {
      var board,
        game = new Chess('{{ parameters.board }}'),
        moved = false;

      var onDragStart = function(source, piece, position, orientation) {
        if (game.game_over() === true ||
            (game.turn() === 'w' && piece.search(/^b/) !== -1) ||
            (game.turn() === 'b' && piece.search(/^w/) !== -1) ||
            moved) {
          return false;
        }
      };

      var onDrop = function(source, target) {
        var move = game.move({
          from: source,
          to: target,
          promotion: 'q'  // NOTE: always promote to a queen for simplicity.
        });

        // Illegal move.
        if (move === null) {
          return 'snapback';
        }
      };

      // Update the board position after the piece snap for castling, en
      // passant, and pawn promotion.
      var onSnapEnd = function() {
        board.position(game.fen());
        Judicious.result = { board: game.fen() };
        moved = true;
      };

      var cfg = {
        draggable: true,
        position: '{{ parameters.board }}',
        orientation: '{{ parameters.turn }}',
        onDragStart: onDragStart,
        onDrop: onDrop,
        onSnapEnd: onSnapEnd,
        showNotation: false,
      };

      board = ChessBoard('board', cfg);
    });
  </script>
{% endblock %}

{% block task %}
  <p><strong>Instructions:</strong> This is a game of chess. Take the next move for the {{ parameters.turn }} side.</p>
  <div id="board"></div>
{% endblock %}<commit_msg>Require chess move before submission<commit_after>{% extends "task.html" %}

{% block styles %}
  {{ super() }}
  <link rel="stylesheet" href="{{ url_for('static', filename='chessboard-0.3.0.min.css') }}">
  <style type="text/css">
    #board {
      width: 400px;
      padding-bottom: 20px;
    }
  </style>
{% endblock %}

{% block scripts %}
  {{ super() }}
  <script src="{{ url_for('static', filename='chessboard-0.3.0.min.js') }}"></script>
  <script src="{{ url_for('static', filename='chess.min.js') }}"></script>
  <script>
    $(document).ready(function() {
      var board,
        game = new Chess('{{ parameters.board }}'),
        moved = false;

      var onDragStart = function(source, piece, position, orientation) {
        if (game.game_over() === true ||
            (game.turn() === 'w' && piece.search(/^b/) !== -1) ||
            (game.turn() === 'b' && piece.search(/^w/) !== -1) ||
            moved) {
          return false;
        }
      };

      var onDrop = function(source, target) {
        var move = game.move({
          from: source,
          to: target,
          promotion: 'q'  // NOTE: always promote to a queen for simplicity.
        });

        // Illegal move.
        if (move === null) {
          return 'snapback';
        }
      };

      // Update the board position after the piece snap for castling, en
      // passant, and pawn promotion.
      var onSnapEnd = function() {
        board.position(game.fen());
        Judicious.result = { board: game.fen() };
        moved = true;
      };

      var cfg = {
        draggable: true,
        position: '{{ parameters.board }}',
        orientation: '{{ parameters.turn }}',
        onDragStart: onDragStart,
        onDrop: onDrop,
        onSnapEnd: onSnapEnd,
        showNotation: false,
      };

      board = ChessBoard('board', cfg);

      Judicious.validate = function () {
        return moved;
      }
    });
  </script>
{% endblock %}

{% block task %}
  <p><strong>Instructions:</strong> This is a game of chess. Take the next move for the {{ parameters.turn }} side.</p>
  <div id="board"></div>
{% endblock %}
{'fraction_non_alphanumeric': 0.17827231395070592, 'fraction_numerical': 0.006221584111031347, 'mean_word_length': 2.1310861423220975, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '6408007', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1274, 'n_words': 320}