{"size": 1416, "ext": "js", "max_stars_repo_path": "code.js", "max_stars_repo_name": "yannicfreson/Bee-Movie-Ascii-Art-Brainf-ck", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "code.js", "max_issues_repo_name": "yannicfreson/Bee-Movie-Ascii-Art-Brainf-ck", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "code.js", "max_forks_repo_name": "yannicfreson/Bee-Movie-Ascii-Art-Brainf-ck", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.2222222222, "max_line_length": 79, "alphanum_fraction": 0.5628531073}
const fs = require("fs");
let asciiArt = fs.readFileSync("./barry_filtered.txt", "utf8");

function multiply(times) {
  let out = "";
  let asciiArtLines = asciiArt.split("\n");
  let outLine = "";
  asciiArtLines.forEach((line) => {
    letters = line.split("");
    for (let i = 0; i < letters.length - 1; i++) {
      for (let j = 0; j < times; j++) {
        outLine += letters[i];
      }
    }
    for (let i = 0; i < times; i++) {
      out += `${outLine}\n`;
    }
    outLine = "";
  });
  fs.writeFileSync("./asciiArtMultiplied.txt", out, "utf8");
  replace();
}

function replace() {
  let asciiArtMultiplied = fs.readFileSync("./asciiArtMultiplied.txt", "utf8");
  let beeMovieScriptBrainfuck = fs.readFileSync(
    "./bee_script_brainfuck.txt",
    "utf8"
  );
  let out = "";
  let place = 0;
  let asciiArtLines = asciiArtMultiplied.split("\n");
  let brainfuckScriptLetters = beeMovieScriptBrainfuck.split("");

  let outLine = "";
  asciiArtLines.forEach((line) => {
    let letters = line.split("");
    for (let i = 0; i < letters.length - 1; i++) {
      if (place < brainfuckScriptLetters.length) {
        if (letters[i] === "M") {
          outLine += brainfuckScriptLetters[place];
          place++;
        } else {
          outLine += letters[i];
        }
      }
    }
    out += `${outLine}\n`;
    outLine = "";
  });
  fs.writeFileSync("./replaced.txt", out, "utf8");
}
multiply(4);
