Skip to content

Instantly share code, notes, and snippets.

@dododome01
Last active June 3, 2022 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dododome01/36de37957c5b14764e45f784467889df to your computer and use it in GitHub Desktop.
Save dododome01/36de37957c5b14764e45f784467889df to your computer and use it in GitHub Desktop.
Calculates when/if Quadcast is possible in Cookie Clicker Grimoire Minigame
#! /usr/bin/python
#####Imports###########################################################################################################################
import math
from tabulate import tabulate #pip install tabulate
#####Vars##############################################################################################################################
lumpLevel = [10,50]
towerCount = [300,10000]
supreme_intellect_mod = [1,0.99,0.9,0.89]
#####Declare Functions##################################################################################################################
def max_Mana(sugar, tower):
return math.floor(4+pow(tower,0.6)+15*math.log(1+(tower+10*(sugar-1))/15))
def sell_Hundrets(x):
return x%100
def fthof_Cost(mana,mod):
return math.floor(mod*(10+(0.6*mana)))
def smaller(a, b):
if a>=b:
return b
else:
return a
#####Main Program#######################################################################################################################
result = [["Dragon","Lumps","TowerMax","TowerM","TowerMin","ManaMax","ManaM","ManaMin","CostMax","CostM","CostMin","Max/Min","Max/M"]]
towerMin = 1
for mod in supreme_intellect_mod:
for lumps in range(lumpLevel[0],lumpLevel[1]):
manaMin = max_Mana(lumps,towerMin)
costMin = fthof_Cost(manaMin,mod)
for towerMax in range(towerCount[0],towerCount[1]):
manaMax = max_Mana(lumps,towerMax)
costMax = fthof_Cost(manaMax,mod)
towerM = sell_Hundrets(towerMax)
if towerM == 0:
manaM = 0
costM = 0
max_m = False
else:
manaM = max_Mana(lumps,towerM)
costM = fthof_Cost(manaM,mod)
max_m = 2*costMax + 2*costM - manaMax - smaller(manaMax, 100) <= 0
max_min = 2*costMax + 2*costMin - manaMax - smaller(manaMax, 100) <= 0
if max_min or max_m:
result.append([mod,lumps,towerMax,towerM,towerMin,manaMax,manaM,manaMin,costMax,costM,costMin,max_min,max_m])
#####Output as File#####################################################################################################################
with open('output.txt', 'w') as f:
f.write("Dragon: Supreme Intellect multiplier\n")
f.write("TowerMin: Smallest amount of Towers (should be 1)\n")
f.write("TowerMax: Biggest amount of Towers, given from the loop\n")
f.write("TowerM: Amount you get if you sell all 100s from TowerMax -> Convenient if you want to do a fast Quadcast\n")
f.write("Mana*, Cost*: Mana/FTHOF_Cost depending on Tower*\n")
f.write("Max/Min, Max/M: If you are allowed to Quadcast\n\n")
f.write(tabulate(result, headers='firstrow'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment