Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var file = require("fs").readFileSync("C:/nodejs/MonsterValleNew/documentacao/sistemas pre-alpha.txt", "utf8");
- var statistics = {
- total: (file.match(new RegExp("{", "g")) || []).length,
- ready1_4: (file.match(new RegExp("{1/4}", "g")) || []).length,
- ready1_2: (file.match(new RegExp("{1/2}", "g")) || []).length,
- ready3_4: (file.match(new RegExp("{3/4}", "g")) || []).length,
- ready: (file.match(new RegExp("{x}", "g")) || []).length,
- notready: (file.match(new RegExp("{-}", "g")) || []).length,
- };
- statistics.ready1_4 *= 0.25;
- statistics.ready1_2 *= 0.5;
- statistics.ready1_4 *= 0.75;
- console.log(
- "\x1b[37m",
- "Numero total de sistemas:", statistics.total + "\n",
- "Sistemas completos:", statistics.ready + "\n",
- "Sistemas 1/4 completos:", statistics.ready1_4 + "\n",
- "Sistemas 1/2 completos:", statistics.ready1_2 + "\n",
- "Sistemas 3/4 completos:", statistics.ready3_4 + "\n",
- "Soma dos sistemas completos:", (statistics.ready + statistics.ready1_4 + statistics.ready1_2 + statistics.ready1_4) + "\n",
- "Sistemas que não estão prontos:", statistics.notready + "\n",
- "\x1b[41m",
- "Porcentagem aproximada de sistemas completos:",
- "\x1b[33m",
- Math.round(((statistics.ready + statistics.ready1_4 + statistics.ready1_2 + statistics.ready1_4) / statistics.total) * 100) + "%",
- "\x1b[0m"
- );
Advertisement
Add Comment
Please, Sign In to add comment