<commit_before>class /*instance:*//*instance:*/TreeScene/*{"id":"093a_a0fc_333a","name":{"mode":"input","value":"Cherry at day"},"values":{"stemHeight":{"mode":"input","value":"100"},"stemWidth":{"mode":"input","value":"30"},"treeKind":{"mode":"input","value":"TreeScene.CHERRY"},"time":{"mode":"input","value":"TreeScene.DAY"}}}*//*{"id":"4e7a_5f39_3409","name":{"mode":"input","value":"Birch at night"},"values":{"stemHeight":{"mode":"input","value":"70"},"stemWidth":{"mode":"input","value":"20"},"treeKind":{"mode":"input","value":"TreeScene.BIRCH"},"time":{"mode":"input","value":"TreeScene.NIGHT"}}}*/ {
  constructor(stemHeight, stemWidth, treeKind, time) {
    if(!(treeKind in TreeScene.treeProps)) {
      throw new Error(`Unknown tree kind: ${treeKind}`)
    }
    if(!(time in TreeScene.timeProps)) {
      throw new Error(`Unknown tree kind: ${time}`)
    }
    this.stemHeight = stemHeight;
    this.stemWidth = stemWidth;
    this.treeProps = TreeScene.treeProps[treeKind];
    this.timeProps = TreeScene.timeProps[time];
  }
  
  // Scene
  /*example:*//*example:*/drawTo/*{"id":"b399_785f_5374","name":{"mode":"input","value":"Cherry at day"},"color":"hsl(30, 30%, 70%)","values":{"canvas":{"mode":"connect","value":"b399_785f_5374_canvas"}},"instanceId":{"mode":"select","value":"093a_a0fc_333a"},"prescript":"","postscript":""}*//*{"id":"60bc_a4a6_7b11","name":{"mode":"input","value":"Birch at night"},"color":"hsl(150, 30%, 70%)","values":{"canvas":{"mode":"connect","value":"60bc_a4a6_7b11_canvas"}},"instanceId":{"mode":"select","value":"4e7a_5f39_3409"},"prescript":"","postscript":""}*/(canvas) {
    this.ctx = canvas.getContext('2d');

    this.canvasWidth = canvas.width;
    this.canvasHeight = canvas.height;

    this.drawSky();
    this.drawMountains();
    this.drawTree();
  }

  // Sky
  drawSky() {
    this.ctx.save();

    var gradient = this.ctx.createLinearGradient(0, 0, 0, this.canvasHeight);
    gradient.addColorStop(0, this.timeProps.skyColors[0]);
    gradient.addColorStop(1, this.timeProps.skyColors[1]);

    this.ctx.fillStyle = gradient;
    this.ctx.fillRect(0, 0, this.canvasWidth, this.canvasHeight);

    this.ctx.restore();
    
    this.ctx.beginPath();
    this.ctx.fillStyle = this.timeProps.sunColor;
    this.ctx.arc(
      this.canvasWidth / this.timeProps.sunXRatio,
      this.canvasHeight / this.timeProps.sunYRatio,
      this.timeProps.sunSize,
      0,
      Math.PI*2
    );
    /*probe:*/this.ctx/*{}*/.fill();
  }

  // Mountains
  drawMountains() {
    this.drawMountain(130, this.timeProps.mountainColors[0]);
    this.drawMountain(50, this.timeProps.mountainColors[1]);
  }

  /*slider:*/drawMountain/*{}*/ (offset, fillStyle) {
    var x = 0;
    var y = this.canvasHeight - offset;

    this.ctx.beginPath();
    this.ctx.moveTo(x, y);

    while (x >= 0 && x < this.canvasWidth) {
      x += random(2, 10);
      y += random(-4, 3);
      this.ctx.lineTo(x, y);
    }

    this.ctx.lineTo(this.canvasWidth, this.canvasHeight);
    this.ctx.lineTo(0, this.canvasHeight);
    this.ctx.closePath();

    this.ctx.fillStyle = fillStyle;
    /*probe:*/this.ctx/*{}*/.fill();
  }

  // Tree
  drawTree() {
    var blossomPoints = [];

    //resetRandom();
    this.drawBranches(0, -Math.PI/2, this.canvasWidth/2, this.canvasHeight, this.stemWidth, blossomPoints);

    //resetRandom();
    this.drawBlossoms(blossomPoints)
  }

  // Branches
  drawBranches (i, angle, x, y, width, blossomPoints) {
    this.ctx.save();

    var length = random(this.stemHeight/3, this.stemHeight/2) * (1 - i/20);
    if (i == 0) { length = this.stemHeight; }

    this.ctx.translate(x, y);
    this.ctx.rotate(angle);
    this.ctx.fillStyle = this.treeProps.color;<commit_msg>Code Mirror Setup<commit_after>class /*instance:*//*instance:*/TreeScene/*{"id":"093a_a0fc_333a","name":{"mode":"input","value":"Cherry at day"},"values":{"stemHeight":{"mode":"input","value":"100"},"stemWidth":{"mode":"input","value":"30"},"treeKind":{"mode":"input","value":"TreeScene.CHERRY"},"time":{"mode":"input","value":"TreeScene.DAY"}}}*//*{"id":"4e7a_5f39_3409","name":{"mode":"input","value":"Birch at night"},"values":{"stemHeight":{"mode":"input","value":"70"},"stemWidth":{"mode":"input","value":"20"},"treeKind":{"mode":"input","value":"TreeScene.BIRCH"},"time":{"mode":"input","value":"TreeScene.NIGHT"}}}*/ {
  constructor(stemHeight, stemWidth, treeKind, time) {
    if(!(treeKind in TreeScene.treeProps)) {
      throw new Error(`Unknown tree kind: ${treeKind}`)
    }
    if(!(time in TreeScene.timeProps)) {
      throw new Error(`Unknown tree kind: ${time}`)
    }
    this.stemHeight = stemHeight;
    this.stemWidth = stemWidth;
    this.treeProps = TreeScene.treeProps[treeKind];
    this.timeProps = TreeScene.timeProps[time];
  }
  
  // Scene
  /*example:*//*example:*/drawTo/*{"id":"b399_785f_5374","name":{"mode":"input","value":"Cherry at day"},"color":"hsl(30, 30%, 70%)","values":{"canvas":{"mode":"connect","value":"b399_785f_5374_canvas"}},"instanceId":{"mode":"select","value":"093a_a0fc_333a"},"prescript":"","postscript":""}*//*{"id":"60bc_a4a6_7b11","name":{"mode":"input","value":"Birch at night"},"color":"hsl(150, 30%, 70%)","values":{"canvas":{"mode":"connect","value":"60bc_a4a6_7b11_canvas"}},"instanceId":{"mode":"select","value":"4e7a_5f39_3409"},"prescript":"","postscript":""}*/(canvas) {
    this.ctx = canvas.getContext('2d');

    this.canvasWidth = canvas.width;
    this.canvasHeight = canvas.height;

    this.drawSky();
    this.drawMountains();
    this.drawTree();
  }

  // Sky
  drawSky() {
    this.ctx.save();

    var gradient = this.ctx.createLinearGradient(0, 0, 0, this.canvasHeight);
    gradient.addColorStop(0, this.timeProps.skyColors[0]);
    gradient.addColorStop(1, this.timeProps.skyColors[1]);

    this.ctx.fillStyle = gradient;
    this.ctx.fillRect(0, 0, this.canvasWidth, this.canvasHeight);

    this.ctx.restore();
    
    this.ctx.beginPath();
    this.ctx.fillStyle = this.timeProps.sunColor;
    this.ctx.arc(
      this.canvasWidth / this.timeProps.sunXRatio,
      this.canvasHeight / this.timeProps.sunYRatio,
      this.timeProps.sunSize,
      0,
      Math.PI*2
    /*probe:*//*{}*/);
    /*probe:*/this.ctx/*{}*/.fill();
  }

  // Mountains
  drawMountains() {
    this.drawMountain(130, this.timeProps.mountainColors[0]);
    this.drawMountain(50, this.timeProps.mountainColors[1]);
  }

  drawMountain (offset, fillStyle) {
    var x = 0;
    var y = this.canvasHeight - offset;

    this.ctx.beginPath();
    this.ctx.moveTo(x, y);

    while (x >= 0 && x < this.canvasWidth) {
      x += random(2, 10);
      y += random(-4, 3);
      this.ctx.lineTo(x, y);
    }

    this.ctx.lineTo(this.canvasWidth, this.canvasHeight);
    this.ctx.lineTo(0, this.canvasHeight);
    this.ctx.closePath();

    /*probe:*/this.ctx/*{}*/.fillStyle = fillStyle;
    this.ctx.fill();
  }

  // Tree
  drawTree() {
    var blossomPoints = [];

    //resetRandom();
    this.drawBranches(0, -Math.PI/2, this.canvasWidth/2, this.canvasHeight, this.stemWidth, blossomPoints);

    //resetRandom();
    this.drawBlossoms(blossomPoints)
  }

  // Branches
  drawBranches (i, angle, x, y, width, blossomPoints) {
    this.ctx.save();

    var length = random(this.stemHeight/3, this.stemHeight/2) * (1 - i/20);
    if (i == 0) { length = this.stemHeight; }

    this.ctx.translate(x, y);
    this.ctx.rotate(angle);
    this.ctx.fillStyle = this.treeProps.color;
{'fraction_non_alphanumeric': 0.22216266916789496, 'fraction_numerical': 0.033230604314618786, 'mean_word_length': 4.312455516014235, 'pattern_counts': {'":': 124, '<': 5, '<?xml version=': 0, '>': 5, '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': '5759155', 'n_tokens_mistral': 2810, 'n_tokens_neox': 2567, 'n_words': 332}