Talk:Level Costs: Difference between revisions

From Drunkapedia
Jump to: navigation, search
imported>Widgeon
No edit summary
imported>Arkalor
(moved Talk:Level Costs to Talk:Experience Points: Sub topic for main Experience Points page.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
It looks like the calculation uses round() for levels above 126, ceil() for other levels, and then level 2 should be 1000 xp, not 1004.  I've updated the script below. --[[User:Widgeon|Widgeon]] 00:04, 23 February 2009 (CST)
#REDIRECT [[Talk:Experience Points]]
 
----
 
For what it's worth, here's the python script I used to generate the table:
 
<pre>
<nowiki>
#!/usr/bin/python                                                                                                                                             
 
import math
import locale
 
def total_level_xp(level):
    if (level < 2):
        return 0;
 
    if (level == 2):
        return 1000;
 
    if (level <= 126):
        return int(math.ceil( ((level + 5) ** 5 - (6 ** 5)) / 9.))
 
    return int(round( ((level + 5) ** 5 - (6 ** 5)) / 9.))
 
def next_level_xp(level):
    return total_level_xp(level) - total_level_xp(level - 1)
 
locale.setlocale(locale.LC_ALL, "")
 
for level in range(1,276):
    next_xp = next_level_xp(level)
    total_xp = total_level_xp(level)
    print "| %d || %s || %s" % (level, locale.format("%.*d", (1, next_xp), True), locale.format("%.*d", (1, total_xp), True))
    print "|-"
</nowiki>
</pre>
 
--[[User:Widgeon|Widgeon]] 22:35, 7 July 2008 (CDT)

Latest revision as of 14:43, 12 February 2013