Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fs = require('fs');
- var raw_venture_data = [];
- var venture_dict = {}
- function getPercentageVal(level) {
- return venture_dict[level] / 100
- }
- (function() {
- const totalLevel = 90
- var currentLevel = 10
- var venture_amount = 0
- fs.readFile("Venture-Data.txt", 'utf8', function (err, data) {
- if (err) throw err;
- raw_venture_data = data.match(/\d+(?=%)|(?<=<tr>\r\n<td>)\d+/g)
- for (idx = 0; idx < raw_venture_data.length - 1; idx += 2) {
- venture_dict[parseInt(raw_venture_data[idx])] = parseInt(raw_venture_data[idx + 1])
- }
- while (currentLevel < totalLevel) {
- currentLevel += getPercentageVal(currentLevel | 0)
- venture_amount++
- }
- console.log(venture_amount)
- });
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement