<< Back to Programming Forum   Search

Posts 1 - 6 of 6   
Simple Gold Cost Modifier graph-maker (python): 2021-04-23 02:26:14


Svitz
Level 39
Report
For those interested, simply copypaste the following code into a notepad, save it as a .py file, run it with a python module, and you'll get a graph of all incomes up to 3000 and each of their potential troop placements per turn. Its a simple calculation, but having it all at a glance lets you quickly see what all of your competition can place in troops per turn based on their gold incomes.
Simply replace the "50" in "ArmyEstimator(50)" with whatever gold cost modifier your game has. The x axis is gold, the y axis is troops.


import numpy as np
import matplotlib.pyplot as plt
def ArmyEstimator(modifier):
	x=list(range(10, 3000, 10))
	x.sort()
	y=list()
	for i in x:
		army=0
		z=1
		while i>=modifier*z:
			i-=modifier*z
			army+=modifier
			z+=1
		army+=int(i/z)
		i=int(i/z)
		y.append(army)

	plt.plot(x, y, 'bo')
	plt.show()

ArmyEstimator(50)


Hope somebody finds this useful, I've been using it for ages and finally decided to share.
Simple Gold Cost Modifier graph-maker (python): 2021-04-23 09:37:27


{Canidae} Kretoma 
Level 59
Report
Sound useful, but is a python module an extra programm?
Simple Gold Cost Modifier graph-maker (python): 2021-04-23 17:14:35


Svitz
Level 39
Report
by "python module" I just mean any version of python installed with numpy and matplotlib. Anaconda, jupyter notebook, or the command line, etc, all work as means to install python and numpy and matplotlib. They're just coding thingies.
Simple Gold Cost Modifier graph-maker (python): 2021-04-23 18:45:13


Svitz
Level 39
Report
Here! I placed it into an online python emulator. Just change the 50 at the bottom and run the code. :)

https://trinket.io/python3/61431150eb

You may want to change the "3000" in the beginning to a smaller number too, if high incomes aren't present in your game.
Simple Gold Cost Modifier graph-maker (python): 2021-04-23 18:49:15


{Canidae} Kretoma 
Level 59
Report
Awesome! That is exactly what i was missing. :D THANK YOU!
Simple Gold Cost Modifier graph-maker (python): 2021-04-26 10:21:32


JK_3 
Level 63
Report
This is very nice, thanks!
Posts 1 - 6 of 6