better skill calculation
This commit is contained in:
parent
061d763a83
commit
1a04105afb
@ -20,7 +20,7 @@ function split(s,d)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function clearTmp()
|
function clearTmp()
|
||||||
for file in io.popen([[dir "./tmp" /b]]):lines() do os.remove('./tmp/'..file) end
|
for file in io.popen([[dir "./tmp" /b]]):lines() do if file then os.remove('./tmp/'..file) end end
|
||||||
end
|
end
|
||||||
|
|
||||||
commands:Add('yt',{},"wip", function(t)
|
commands:Add('yt',{},"wip", function(t)
|
||||||
|
@ -52,26 +52,28 @@ commands:Add('skill',{},'skill <username|mention|"me"> <game> <style>', function
|
|||||||
end
|
end
|
||||||
print('times:',#times)
|
print('times:',#times)
|
||||||
t.message:reply('ETA: '..(math.floor(#times*3/100))..' minutes '..((#times*3)%60)..' seconds (found '..#times..' times out of '..API.MAPS[game].count..' maps)')
|
t.message:reply('ETA: '..(math.floor(#times*3/100))..' minutes '..((#times*3)%60)..' seconds (found '..#times..' times out of '..API.MAPS[game].count..' maps)')
|
||||||
local i = 1
|
local test_a,test_b = 0,0
|
||||||
for _,time in next,times do
|
for _,time in next,times do
|
||||||
local rank = API:GetTimeRank(time.ID).Rank
|
local rank = API:GetTimeRank(time.ID).Rank
|
||||||
local count = API:GetMapCompletionCount(time.Map,style)
|
local count = tonumber(API:GetMapCompletionCount(time.Map,style))
|
||||||
|
time.Points = API:CalculatePoint(rank,count)
|
||||||
time.Rank = rank
|
time.Rank = rank
|
||||||
time.MapCompletionCount = count
|
time.MapCompletionCount = count
|
||||||
time.Skill = API:FormatSkill(1-((rank-1)/tonumber(count)))
|
time.Skill = API:FormatSkill((count-rank)/(count-1))
|
||||||
time.SkillRaw = 1-((rank-1)/tonumber(count))
|
time.SkillRaw = (count-rank)/(count-1)
|
||||||
i=i+1
|
test_a=test_a+(count-rank)
|
||||||
|
test_b=test_b+(count-1)
|
||||||
end
|
end
|
||||||
table.sort(times,function(t1,t2)
|
table.sort(times,function(t1,t2)
|
||||||
return t1.SkillRaw<t2.SkillRaw
|
return t1.SkillRaw<t2.SkillRaw
|
||||||
end)
|
end)
|
||||||
local average = 0
|
local points = 0
|
||||||
for _,time in next,times do
|
for _,time in next,times do
|
||||||
local skill = time.SkillRaw
|
points = points+time.Points
|
||||||
average = average+skill
|
|
||||||
end
|
end
|
||||||
average = average/#times
|
local msg = 'Average Skill: '..API:FormatSkill((test_a+1)/(test_b-1))..'\n'..
|
||||||
local msg = 'Average Skill: '..API:FormatSkill(average)..'\n'
|
'Points: '..points..'\n'
|
||||||
|
|
||||||
for _,time in next,times do
|
for _,time in next,times do
|
||||||
-- msg = msg..'['..time.Rank..'/'..time.MapCompletionCount..'] '..time.Map..' ('..time.Skill..')\n'
|
-- msg = msg..'['..time.Rank..'/'..time.MapCompletionCount..'] '..time.Map..' ('..time.Skill..')\n'
|
||||||
msg = msg..API.MAPS[game][time.Map].DisplayName..' ('..time.Map..'): '..time.Skill..' for '..time.Rank..'/'..time.MapCompletionCount..' with '..API:FormatTime(time.Time)..'\n'
|
msg = msg..API.MAPS[game][time.Map].DisplayName..' ('..time.Map..'): '..time.Skill..' for '..time.Rank..'/'..time.MapCompletionCount..' with '..API:FormatTime(time.Time)..'\n'
|
||||||
|
@ -7,6 +7,8 @@ local ROVER_API_URL = 'https://verify.eryn.io/api/'
|
|||||||
local ROBLOX_API_URL = 'https://users.roblox.com/v1/'
|
local ROBLOX_API_URL = 'https://users.roblox.com/v1/'
|
||||||
local ROBLOX_API_URL2 = 'https://api.roblox.com/'
|
local ROBLOX_API_URL2 = 'https://api.roblox.com/'
|
||||||
|
|
||||||
|
local RANK_CONSTANT = 0.5
|
||||||
|
|
||||||
local t=tostring
|
local t=tostring
|
||||||
local r=function(n,nd) return tonumber(string.format('%.' .. (nd or 0) .. 'f', n)) end
|
local r=function(n,nd) return tonumber(string.format('%.' .. (nd or 0) .. 'f', n)) end
|
||||||
|
|
||||||
@ -149,10 +151,17 @@ function API:GetMapCompletionCount(MAP_ID,STYLE_ID)
|
|||||||
if not MAP_ID or not STYLE_ID then return 'empty id' end
|
if not MAP_ID or not STYLE_ID then return 'empty id' end
|
||||||
local _,headers = API:GetMapTimes(MAP_ID,STYLE_ID)
|
local _,headers = API:GetMapTimes(MAP_ID,STYLE_ID)
|
||||||
local pages = headers['Pagination-Count']
|
local pages = headers['Pagination-Count']
|
||||||
local res = API:GetMapTimes(MAP_ID,STYLE_ID,pages)
|
local res,h = API:GetMapTimes(MAP_ID,STYLE_ID,pages)
|
||||||
|
if not res then
|
||||||
|
table.foreach(h,print)
|
||||||
|
end
|
||||||
return ((pages-1)*200)+#res
|
return ((pages-1)*200)+#res
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function API:CalculatePoint(rank,count)
|
||||||
|
return RANK_CONSTANT*(math.exp(RANK_CONSTANT)-1)/(1-math.exp(math.max(-700, -RANK_CONSTANT*count)))*math.exp(math.max(-700, -RANK_CONSTANT*rank))+(1-RANK_CONSTANT)*(1+2*(count-rank))/(count*count)
|
||||||
|
end
|
||||||
|
|
||||||
-- [[ ROBLOX / ROVER AND OTHER APIs ]] --
|
-- [[ ROBLOX / ROVER AND OTHER APIs ]] --
|
||||||
|
|
||||||
function API:GetRobloxInfoFromUserId(USER_ID)
|
function API:GetRobloxInfoFromUserId(USER_ID)
|
||||||
|
Loading…
Reference in New Issue
Block a user