<commit_before>var stats = new Stats();

var TAU = Math.PI * 2;

var CLOUD_COUNT = 5;
// how much to wiggle the points around
var POINT_WIGGLE = 10;
// how much to wiggle the curves around
var WIGGLE = 10;

// the length of the segment in relation to the circle's radius
var SEGMENT_FACTOR = 3;

var context;
var width, height;

var clouds = [];

// A simple Linear Congruential Generator

// Establish the parameters of the generator
var m = 25;
// a - 1 should be divisible by m's prime factors
var a = 11;
// c and m should be co-prime
var c = 17;
// Setting the seed
var seed = 3;

var rand = function() {
  // define the recurrence relationship
  seed = (a * seed + c) % m;
  // return float in (0, 1)
  return seed / m;
};

var wiggle = function (size) {
  return Math.random() * size - size/2;
};

var setupClouds = function () {
  for (var i = 0; i < CLOUD_COUNT; i++) {
    createCloud();
  }
};

var createCloudCircle = function (x, y) {
  return {
    x: x,
    y: y,
    radius: (height / 5) + wiggle(height/6),
    points: []
  };
};

var generateTriange = function () {
  var h = (height / 4) + wiggle(30);
  var base = (2 * height / 5) + wiggle(30);
  var top   = {x: 0, y: -h};
  var left  = {x: -base/2 + wiggle(base/5), y: 0};
  var right = {x: base + left.x, y: 0};
  // start on the right to match our line drawing starting point
  return [
    {
      start: right,
      end: left,
      distance: right.x - left.x,
      circles: []
    },
    {
      start: left,
      end: top,
      distance: Math.sqrt(left.x*left.x + h*h),
      circles: []
    },
    {
      start: top,
      end: right,
      distance: Math.sqrt(right.x*right.x + h*h),
      circles: []
    }
  ];
};

var generateCircles = function (legs) {
  var circles = [];
  var startCircle = createCloudCircle(legs[0].start.x, legs[0].start.y);
  circles.push(startCircle);

  for (var i = 0; i < legs.length; i++) {
    var leg = legs[i];
    var endCircle;
    leg.circles.push(startCircle);
    if (i == legs.length-1) {
      endCircle = legs[0].circles[0];
    } else {
      endCircle = createCloudCircle(leg.end.x, leg.end.y);
      circles.push(endCircle);
    }
    leg.circles.push(endCircle);
    var total = startCircle.radius + endCircle.radius;
    startCircle = endCircle;
    // add more if needed
    while (total < leg.distance * 2) {
      var x = 0;
      var y = 0;
      for (var j = 0; j < leg.circles.length; j++) {
        var legCircle = leg.circles[j];
        x += legCircle.x;
        y += legCircle.y;
      }
      x = x / leg.circles.length;
      y = y / leg.circles.length;
      var circle = createCloudCircle(x, y);
      circles.push(circle);
      leg.circles.push(circle);
      total += circle.radius * 2;
    }
  }
  return circles;
};

var traceCircles = function (circles) {
  var cuspPoints = [];
  var points = [];
  var start = 0;
  var currentCircle = circles[0];
  var segments = currentCircle.radius / SEGMENT_FACTOR;
  var increment = TAU / segments;
  var i = 0;
  // do until we're back on the first circle and run out of segments
  while (i < segments || currentCircle != circles[0]) {
    var x = Math.cos(i * increment) * currentCircle.radius + wiggle(POINT_WIGGLE);<commit_msg>extend first circle so it has the rightmost point<commit_after>var stats = new Stats();

var TAU = Math.PI * 2;

var CLOUD_COUNT = 5;
// how much to wiggle the points around
var POINT_WIGGLE = 10;
// how much to wiggle the curves around
var WIGGLE = 10;

// the length of the segment in relation to the circle's radius
var SEGMENT_FACTOR = 3;

var context;
var width, height;

var clouds = [];

// A simple Linear Congruential Generator

// Establish the parameters of the generator
var m = 25;
// a - 1 should be divisible by m's prime factors
var a = 11;
// c and m should be co-prime
var c = 17;
// Setting the seed
var seed = 3;

var rand = function() {
  // define the recurrence relationship
  seed = (a * seed + c) % m;
  // return float in (0, 1)
  return seed / m;
};

var wiggle = function (size) {
  return Math.random() * size - size/2;
};

var setupClouds = function () {
  for (var i = 0; i < CLOUD_COUNT; i++) {
    createCloud();
  }
};

var createCloudCircle = function (x, y) {
  return {
    x: x,
    y: y,
    radius: (height / 5) + wiggle(height/5),
    points: []
  };
};

var generateTriange = function () {
  var h = (height / 4) + wiggle(30);
  var base = (2 * height / 5) + wiggle(30);
  var top   = {x: 0, y: -h};
  var left  = {x: -base/2 + wiggle(base/5), y: 0};
  var right = {x: base + left.x, y: 0};
  // start on the right to match our line drawing starting point
  return [
    {
      start: right,
      end: left,
      distance: right.x - left.x,
      circles: []
    },
    {
      start: left,
      end: top,
      distance: Math.sqrt(left.x*left.x + h*h),
      circles: []
    },
    {
      start: top,
      end: right,
      distance: Math.sqrt(right.x*right.x + h*h),
      circles: []
    }
  ];
};

var generateCircles = function (legs) {
  var circles = [];
  var startCircle = createCloudCircle(legs[0].start.x, legs[0].start.y);
  circles.push(startCircle);

  for (var i = 0; i < legs.length; i++) {
    var leg = legs[i];
    var endCircle;
    leg.circles.push(startCircle);
    if (i == legs.length-1) {
      endCircle = legs[0].circles[0];
    } else {
      endCircle = createCloudCircle(leg.end.x, leg.end.y);
      circles.push(endCircle);
    }
    leg.circles.push(endCircle);
    var total = startCircle.radius + endCircle.radius;
    startCircle = endCircle;
    // add more if needed
    while (total < leg.distance * 2) {
      var x = 0;
      var y = 0;
      for (var j = 0; j < leg.circles.length; j++) {
        var legCircle = leg.circles[j];
        x += legCircle.x;
        y += legCircle.y;
      }
      x = x / leg.circles.length;
      y = y / leg.circles.length;
      var circle = createCloudCircle(x, y);
      circles.push(circle);
      leg.circles.push(circle);
      total += circle.radius;
    }
  }

  // make the first circle have the rightmost point
  var rightMostPoint = circles[0].x + circles[0].radius;
  for (var i = 1; i < circles.length; i++) {
    var candidate = circles[i].x + circles[i].radius;
    if (candidate > rightMostPoint) {
      circles[0].x += candidate - rightMostPoint + 1;
      rightMostPoint = circles[0].x + circles[0].radius;
    }
  }

  return circles;
};

var traceCircles = function (circles) {
  var cuspPoints = [];
  var points = [];
  var start = 0;
  var currentCircle = circles[0];
  var segments = currentCircle.radius / SEGMENT_FACTOR;
  var increment = TAU / segments;
  var i = 0;
  // do until we're back on the first circle and run out of segments
  while (i < segments || currentCircle != circles[0]) {
    var x = Math.cos(i * increment) * currentCircle.radius + wiggle(POINT_WIGGLE);
{'fraction_non_alphanumeric': 0.1404994888272236, 'fraction_numerical': 0.01489703519789689, 'mean_word_length': 2.4446680080482897, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 4, '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': '571532', 'n_tokens_mistral': 2523, 'n_tokens_neox': 2428, 'n_words': 743}