Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def CalculateCivBuildTime(civs,mills,bonus,consumerGoods, infastructure):
- civsAvailable = CalculateCivsAvailable(civs , mills , consumerGoods)
- constructionSpeed = CalculateConstructionSpeed(civsAvailable , bonus , infastructure)
- return civCost / constructionSpeed
- def CalculateCivsAvailable(civs, mills , consumerGoods):
- return civs - (civs+mills)*(consumerGoods/100)
- def CalculateConstructionSpeed(civsAvailable , bonus , infastructure):
- return 5*(1+bonus/100) * (1+infastructure / 10) * civsAvailable
- def AddCivs(number):
- global civs
- civs += number
- def AddMills(number):
- global mills
- mills += number
- def AddBonus(number):
- global bonus
- bonus += number
- def AddCivBonus(number):
- global civBonus
- civBonus += number
- def AddMillBonus(number):
- global millBonus
- millBonus += number
- def SetGoods(number):
- global goods
- goods = number
- def BuildCivs(maxTime):
- global civs , mills , goods , bonus , infastructure, civBonus
- time = 0
- civCost = 10800
- costRemaining = civCost
- while(time < maxTime):
- for key in focusBased:
- if key <= time:
- focusBased[key]()
- del focusBased[key]
- break
- if (costRemaining <= 0):
- costRemaining = civCost
- civs += 1
- else:
- civsAvailable = CalculateCivsAvailable(civs, mills , goods)
- costRemaining -= CalculateConstructionSpeed(civsAvailable , bonus , infastructure) * (1+civBonus/100)
- time +=1
- def BuildMills(maxTime):
- global civs , mills , goods , bonus , infastructure, millBonus
- time = 0
- milCost = 7200
- costRemaining = milCost
- while(time < maxTime):
- for key in focusBased:
- if key <= time:
- focusBased[key]()
- del focusBased[key]
- break
- if (costRemaining <= 0):
- costRemaining = milCost
- mills += 1
- else:
- civsAvailable = CalculateCivsAvailable(civs, mills , goods)
- costRemaining -= CalculateConstructionSpeed(civsAvailable , bonus , infastructure) * (1+millBonus/100)
- time +=1
- ##maxTime = 365 * 3 + 121
- ##
- ##civTime = 100
- ##BuildCivs(civTime)
- ##millTime = maxTime -civTime
- ##BuildMills(millTime)
- ##
- ##
- ##
- ##
- ##print("Civilian Factories :",civs)
- ##print("Military Factories :",mills)
- civs = 43
- mills = 9
- # %
- bonus = 10
- civBonus = -30
- millBonus = -30
- goods = 35
- #Value 0,1,2....,10
- infastructure = 8
- #Time , command to be ran
- focusBased = {
- 210 : lambda : AddCivs(5),
- 280 : lambda : AddMills(5),
- 490 : lambda : SetGoods(30),
- 491 : lambda : AddCivBonus(20),
- 492 : lambda : AddMillBonus(20),
- 770 : lambda : SetGoods(25),
- 771 : lambda : AddCivBonus(10),
- 772 : lambda : AddMillBonus(20)
- }
- def setVariables():
- global civs , mills , bonus, civBonus , millBonus , goods, infastructure , focusBased
- civs = 43
- mills = 9
- # %
- bonus = 10
- civBonus = -30
- millBonus = -30
- goods = 35
- #Value 0,1,2....,10
- infastructure = 8
- #Time , command to be ran
- focusBased = {
- 210 : lambda : AddCivs(5),
- 280 : lambda : AddMills(5),
- 490 : lambda : SetGoods(30),
- 491 : lambda : AddCivBonus(20),
- 492 : lambda : AddMillBonus(20),
- 770 : lambda : SetGoods(25),
- 771 : lambda : AddCivBonus(10),
- 772 : lambda : AddMillBonus(20)
- }
- maxMills = 0
- bestTime = 0
- maxTime = 1600
- for i in range(0,maxTime):
- setVariables()
- civTime = i
- BuildCivs(civTime)
- millTime = maxTime -civTime
- BuildMills(millTime)
- if (mills > maxMills):
- maxMills = mills
- print(maxMills)
- bestTime = i
- i
- print("max mills ",maxMills)
- print("best Time " ,bestTime)
Advertisement
Add Comment
Please, Sign In to add comment