<commit_before>export function drawBackground (ctx, client, color = null) {
    ctx.save();
    ctx.fillStyle = color || '#80d735';
    ctx.fillRect(client.transform.x, client.transform.y, client.size.width, client.size.height);
    ctx.restore();
  }

export function getRandomColor() {
  var letters = '0123456789ABCDEF';
  var color = '#';
  for (var i = 0; i < 6; i++) {
    color += letters[Math.floor(Math.random() * 16)];
  }
  return color;
}

export function drawWalls (ctx, client) {
    var openings = client.openings;
    var transformX = client.transform.x;
    var transformY = client.transform.y;
    var width = client.size.width;
    var height = client.size.height;

    ctx.save();
    ctx.lineWidth = 40;
    ctx.shadowColor = '#a3a1a1';
    ctx.shadowBlur = 10;
    ctx.strokeStyle = '#dddddd';

    // left
    ctx.beginPath();
    ctx.moveTo(transformX, transformY);

    openings.left.sort(openingSort).forEach(function (opening) {
      ctx.lineTo(transformX, opening.start + transformY);
      ctx.stroke();
      ctx.beginPath();
      ctx.moveTo(transformX, opening.end + transformY);
    });

    ctx.lineTo(transformX, height + transformY);
    ctx.stroke();

    // right
    ctx.beginPath();
    ctx.moveTo(width + transformX, transformY);

    openings.right.sort(openingSort).forEach(function (opening) {
      ctx.lineTo(width + transformX, opening.start + transformY);
      ctx.stroke();
      ctx.beginPath();
      ctx.moveTo(width + transformX, opening.end + transformY);
    });

    ctx.lineTo(width + transformX, height + transformY);
    ctx.stroke();

    // top
    ctx.beginPath();
    ctx.moveTo(transformX, transformY);

    openings.top.sort(openingSort).forEach(function (opening) {
      ctx.lineTo(opening.start + transformX, transformY);
      ctx.stroke();
      ctx.beginPath();
      ctx.moveTo(opening.end + transformX, transformY);
    });

    ctx.lineTo(width + transformX, transformY);
    ctx.stroke();

    // bottom
    ctx.beginPath();
    ctx.moveTo(transformX, height + transformY);

    openings.bottom.sort(openingSort).forEach(function (opening) {
      ctx.lineTo(opening.start + transformX, height + transformY);
      ctx.stroke();
      ctx.beginPath();
      ctx.moveTo(opening.end + transformX, height + transformY);
    });

    ctx.lineTo(width + transformX, height + transformY);
    ctx.stroke();
    ctx.restore();
  }

export function openingSort (openingA, openingB) {
    return openingB.start - openingA.start;
  }

export function drawCircle(ctx, character) {
    ctx.save();

    ctx.fillStyle = 'rgba(255, 0, 0, 0.2)';
    ctx.shadowBlur = 10;
    ctx.shadowColor = 'rgba(0, 0, 0, 0.2)';

    ctx.beginPath();
    ctx.arc(character.x, character.y, character.radius, 0, 2 * Math.PI);
    ctx.fill();

    ctx.restore();
  }

export function drawRect(ctx, character) {
    const {x, y, width, height} = character;
    ctx.save();

    ctx.fillStyle = 'rgba(255, 0, 0, 0.6)';
    ctx.shadowBlur = 10;
    ctx.shadowColor = 'rgba(0, 0, 0, 0.2)';
    ctx.fillRect(x, y, width, height);
    //ctx.fillRect(x, y, width, height);

    ctx.restore();
  }


export function drawArrow(ctx, character, dragPosition) {
    var angle;

    ctx.save();

    ctx.fillStyle = 'rgba(255, 255, 255, 0.6)';
    ctx.lineWidth = 3;
    ctx.shadowBlur = 5;

    angle = -Math.atan2(dragPosition.x - character.x, dragPosition.y - character.y) + Math.PI / 2;

    ctx.beginPath();
    ctx.arc(character.x + character.width/2, character.y + character.height/2, character.width / 2, angle + Math.PI / 2, angle - Math.PI / 2);
    ctx.arc(dragPosition.x, dragPosition.y, character.height / 4, angle - Math.PI / 2 , angle + Math.PI / 2);
    ctx.fill();

    ctx.restore();
  }

export function drawHole (ctx, hole) {
    console.log(hole)
    ctx.save();

    ctx.fillStyle = 'black';
    ctx.strokeStyle = '#4b7f1f';<commit_msg>add parameters in renderRect<commit_after>export function drawBackground (ctx, client, color = null) {
    ctx.save();
    ctx.fillStyle = color || '#80d735';
    ctx.fillRect(client.transform.x, client.transform.y, client.size.width, client.size.height);
    ctx.restore();
  }

export function getRandomColor() {
  var letters = '0123456789ABCDEF';
  var color = '#';
  for (var i = 0; i < 6; i++) {
    color += letters[Math.floor(Math.random() * 16)];
  }
  return color;
}

export function drawWalls (ctx, client) {
    var openings = client.openings;
    var transformX = client.transform.x;
    var transformY = client.transform.y;
    var width = client.size.width;
    var height = client.size.height;

    ctx.save();
    ctx.lineWidth = 40;
    ctx.shadowColor = '#a3a1a1';
    ctx.shadowBlur = 10;
    ctx.strokeStyle = '#dddddd';

    // left
    ctx.beginPath();
    ctx.moveTo(transformX, transformY);

    openings.left.sort(openingSort).forEach(function (opening) {
      ctx.lineTo(transformX, opening.start + transformY);
      ctx.stroke();
      ctx.beginPath();
      ctx.moveTo(transformX, opening.end + transformY);
    });

    ctx.lineTo(transformX, height + transformY);
    ctx.stroke();

    // right
    ctx.beginPath();
    ctx.moveTo(width + transformX, transformY);

    openings.right.sort(openingSort).forEach(function (opening) {
      ctx.lineTo(width + transformX, opening.start + transformY);
      ctx.stroke();
      ctx.beginPath();
      ctx.moveTo(width + transformX, opening.end + transformY);
    });

    ctx.lineTo(width + transformX, height + transformY);
    ctx.stroke();

    // top
    ctx.beginPath();
    ctx.moveTo(transformX, transformY);

    openings.top.sort(openingSort).forEach(function (opening) {
      ctx.lineTo(opening.start + transformX, transformY);
      ctx.stroke();
      ctx.beginPath();
      ctx.moveTo(opening.end + transformX, transformY);
    });

    ctx.lineTo(width + transformX, transformY);
    ctx.stroke();

    // bottom
    ctx.beginPath();
    ctx.moveTo(transformX, height + transformY);

    openings.bottom.sort(openingSort).forEach(function (opening) {
      ctx.lineTo(opening.start + transformX, height + transformY);
      ctx.stroke();
      ctx.beginPath();
      ctx.moveTo(opening.end + transformX, height + transformY);
    });

    ctx.lineTo(width + transformX, height + transformY);
    ctx.stroke();
    ctx.restore();
  }

export function openingSort (openingA, openingB) {
    return openingB.start - openingA.start;
  }

export function drawCircle(ctx, character) {
    ctx.save();

    ctx.fillStyle = 'rgba(255, 0, 0, 0.2)';
    ctx.shadowBlur = 10;
    ctx.shadowColor = 'rgba(0, 0, 0, 0.2)';

    ctx.beginPath();
    ctx.arc(character.x, character.y, character.radius, 0, 2 * Math.PI);
    ctx.fill();

    ctx.restore();
  }

export function drawRect(ctx, rect, fillStyle = 'rgba(255, 0, 0, 0.6)', shadowColor = 'rgba(0, 0, 0, 0.2)') {
  const {x, y, width, height} = rect;
  ctx.save();

  ctx.fillStyle = fillStyle;
  ctx.shadowBlur = 10;
  ctx.shadowColor = shadowColor;
  ctx.fillRect(x, y, width, height);
  ctx.restore();
}


export function drawArrow(ctx, character, dragPosition) {
    var angle;

    ctx.save();

    ctx.fillStyle = 'rgba(255, 255, 255, 0.6)';
    ctx.lineWidth = 3;
    ctx.shadowBlur = 5;

    angle = -Math.atan2(dragPosition.x - character.x, dragPosition.y - character.y) + Math.PI / 2;

    ctx.beginPath();
    ctx.arc(character.x + character.width/2, character.y + character.height/2, character.width / 2, angle + Math.PI / 2, angle - Math.PI / 2);
    ctx.arc(dragPosition.x, dragPosition.y, character.height / 4, angle - Math.PI / 2 , angle + Math.PI / 2);
    ctx.fill();

    ctx.restore();
  }


export function drawHole (ctx, hole) {
    console.log(hole)
    ctx.save();

    ctx.fillStyle = 'black';
    ctx.strokeStyle = '#4b7f1f';
{'fraction_non_alphanumeric': 0.15466700951401388, 'fraction_numerical': 0.02108511185394703, 'mean_word_length': 2.970903522205207, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4253175', 'n_tokens_mistral': 2787, 'n_tokens_neox': 2590, 'n_words': 546}