Optimal Singularity Level

Display the optimal singularity level

  1. // ==UserScript==
  2. // @name Optimal Singularity Level
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Display the optimal singularity level
  6. // @author hexy
  7. // @match https://patcailmemer.github.io/Ordinal-Markup/
  8. // @grant MIT
  9. // ==/UserScript==
  10.  
  11. function numManifolds(singLevel) {
  12. return (getSingLevel() + game.manifolds - game.sing.m) - singLevel
  13. }
  14.  
  15. function getManifoldEffectWSingLevel(singLevel) {
  16. return (Math.max(1,numManifolds(singLevel)+1)**0.5)*(game.iups[4-1]==1?3:1)*(game.iups[4]==1?1.26:1)
  17. }
  18.  
  19. function calcBupTotalMultWOFactorWSingLevel(singLevel) {
  20. return 2*getBoostFromBoosters()*game.assCard[1].mult.toNumber()*(game.aups.includes(1)?getManifoldEffectWSingLevel(singLevel):1)*(1.2**game.dups[2])
  21. }
  22.  
  23. function calcOptimalSingLevel() {
  24. let timeForAllFactorShifts=0
  25. let maxChallengeCompMult=1
  26. for (let i=1;i<9;i++) {
  27. timeForAllFactorShifts += calcFactorShiftTime(i)
  28. if (i != 8) maxChallengeCompMult *= (([9,8,7,4,4,3,2][i-1]+1+(game.upgrades.includes(11)?3:0))*(game.upgrades.includes(1)?2:1))**([0,0.5,0.75,1][game.challengeCompletion[i-1]])
  29. if (i == 8) maxChallengeCompMult *= getDynamicFactorCap()**getChalCurve([game.chal8Comp])
  30. }
  31. let tier3BoostTime = 1/game.boostAuto.toNumber()
  32. let optimalFBRate = 0
  33. let optimalSingLevel = 0
  34. let maxSingLevel = getSingLevel() + game.manifolds - game.sing.m
  35. for (let singLevel = 1; singLevel <= maxSingLevel; singLevel++) {
  36. let tier2AutoRate = 1e270*calcBupTotalMultWOFactorWSingLevel(singLevel)*maxChallengeCompMult*calcIncrementyMult(game.maxIncrementyRate.pow(0.9))*(game.aups.includes(4)?Math.log10(Math.log10(1e280)):1)
  37. let FBRate = (2*singLevel-1)/Math.max(tier3BoostTime,timeForAllFactorShifts+V(27)*3**(singLevel-1)/tier2AutoRate)
  38. if (FBRate >= optimalFBRate) {
  39. optimalFBRate = FBRate
  40. optimalSingLevel = singLevel
  41. }
  42. }
  43.  
  44. return optimalSingLevel
  45. }
  46.  
  47. (function() {
  48. 'use strict';
  49.  
  50. let optimalSingPara = document.createElement('p')
  51. optimalSingPara.id = 'optimalSing'
  52. optimalSingPara.style = 'text-align: center'
  53. document.getElementById('csubTab5').appendChild(optimalSingPara)
  54.  
  55. window.setInterval(function() {
  56. optimalSingPara.innerText = 'Optimal singularity level: ' + calcOptimalSingLevel()
  57. }, game.msint)
  58. })();