@ElBanditoVince/

partnairShitySystem

Nodejs

Fk u Tera FK U

fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var partnairsUsed = 0;

function getRandomInt(max) {
  return Math.floor(Math.random() * Math.floor(max) + 1);
}

function tryPartnairLvl10(tryNumber, target) {
  var strTry = "Try(" + tryNumber + "): ";
  var fellowship = 1;

  for (var i = 0; i < 9; i++) {
    var fellowshipUpgrade = getRandomInt(6);
    fellowship += fellowshipUpgrade;
      if (target - fellowship > (8 - i) * 6) {
        console.log(strTry + "You need " + (target - fellowship) + " but only have " + (8 - i) + " upgrades left so we better go next !");
        return [fellowship, i];
      }
  }
    console.log(strTry + "After 9 trys your partnair fellowship is: " + fellowship);
  return [fellowship, 10];
}

function try100kTimes(target) {
  for (var trys = 0; trys < 100000; trys ++) {
    var results  = tryPartnairLvl10(trys, target);
    var partnairFellowship = results[0];
    partnairsUsed += results[1];
    if (partnairFellowship >= target) {
      console.log("SUCCES AT TRY NUMBER = " + trys);
      return 1;
    }
  }
  return 0;
}

var sucess = try100kTimes(50);
if (sucess == 0)
  console.log("FAILED AFTER 100k TRYS");

console.log("PARTNAIRS USED = " + partnairsUsed);
node v10.16.0