Talk:Convert command

From Elanthipedia
Jump to navigation Jump to search

Converting Mechanical Lore

I used a variation of this python program to reverse engineer the formula for "bits per rank". This formula is now documented on the Experience#Ranks, however the python program below demonstrates how to estimate the number of ranks in skill you will end up with after conversion. I named the program convert.py. It should be simple to convert the program to JavaScript for an online calculator.

def bitsPerRank(n):
    return 200+n

def bits(n):
    total = 0
    for i in range(n+1):
        total += bitsPerRank(i)
    return total

mech = input('Enter your Mechanical Lore skill: ')
crafting = input('Enter your Crafting skill: ')
totalBits = bits(mech) + bits(crafting)
ranks = max(mech, crafting)

while bits(ranks+1) < totalBits:
    ranks += 1

print "You will end up with approximately", ranks, "ranks in your Crafting skill."

Examples:

$ python convert.py
Enter your Mechanical Lore skill: 100
Enter your Crafting skill: 100
You will end up with approximately 174 ranks in your Crafting skill.
$ python convert.py
Enter your Mechanical Lore skill: 541
Enter your Crafting skill: 306
You will end up with approximately 675 ranks in your Crafting skill.

Note the program does not take into account bits that are remainders (% of ranks earned), so the result may underestimate your result by a rank. I plan to work on a jsfiddle calculator in the coming days if someone doesn't beat me to it. - padhg (talk) 12:53, 20 December 2016 (CST)

https://jsfiddle.net/padhg/w0cmfy7p/ is my working calculator in JavaScript. It doesn't handle partial/split conversions yet, just whole conversions. - padhg (talk) 15:03, 20 December 2016 (CST)