-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscore.lua
More file actions
executable file
·50 lines (50 loc) · 1.07 KB
/
score.lua
File metadata and controls
executable file
·50 lines (50 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env lua
local f = io.open("publications.txt")
local t = {}
local highests = {}
for line in f:lines() do
local m,name,category,score = line:match("(((%a+)%.%w+)=(%d+)@%d+%|%x+)")
if m then
print(m)
table.insert(t, {m, name=name, category=category, score=score})
local c = highests[category]
if not c then
c = {}
highests[category] = c
end
if c[name] then
c[name] = math.max(c[name], tonumber(score))
else
c[name] = tonumber(score)
end
end
end
f:close()
local categories = {}
for k,v in pairs(highests) do
local s = 0
for name,t in pairs(v) do
s = s + t
end
categories[k] = s
end
local categories_ = {"INTRO","CIRCS","BLNCE","BLACK","BASIC","ANTWO","ADVTR","ADVIS"}
local total = 0
for k,v in ipairs(categories_) do
local s = categories[v] or 0
print(v, s)
total = total + s
end
print("Total",total)
--[[
local p = io.popen("./run umix.um", "w")
p:write("ftd\n")
p:write("falderal90\n")
p:write("icfp.exe\n")
for i,v in ipairs(t) do
p:write(v[1] .. "\n")
end
p:write("\n")
p:write("logout\n")
p:close()
]]