Moving these into a branch in the main repo

This commit is contained in:
Kayne Ruse
2013-08-29 22:31:36 +10:00
commit a78f00d577
19 changed files with 1625 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
function CalcExp(base, mod, level)
return math.floor(base * mod ^ level)
end
function CalcSumExp(base, mod, level)
local ret = CalcExp(base, mod, level)
if (level > 1) then
return ret + CalcSumExp(base, mod, level-1)
else
return ret
end
end
function CalcExpTables(base, mod, levelCap)
local exp = {}
local sum = {}
for i = 1, levelCap do
exp[i] = CalcExp(base, mod, i)
sum[i] = CalcSumExp(base, mod, i)
end
return exp, sum
end
--the variables
base = 1000
mod = 1.14
levelCap = 20
--calc the tables
exp, sum = CalcExpTables(base, mod, levelCap)
--output the data
io.write("Level\t\tExp\t\tTotal\t\tLaps\n")
for i = 1, 60 do io.write("-") end
io.write("\n")
for i = 1, levelCap do
if i % 5 == 0 then
sep = "\t---\t"
else
sep = "\t\t"
end
io.write(i,
sep, exp[i],
sep, sum[i],
sep, math.floor(sum[i] / sum[1] * 10) / 10, --rounded
-- sep, sum[i] / sum[1], --real
"\n")
end