Golf. Now 8161 tokens (from 8185).
This commit is contained in:
parent
be0f1349ae
commit
09ef3617f7
@ -1960,30 +1960,25 @@ function readdata()
|
||||
end
|
||||
|
||||
function getscores(mode)
|
||||
mode-=1
|
||||
local scores={}
|
||||
for i=1,3 do
|
||||
scores[i]=dget(15+3*mode+i)
|
||||
end
|
||||
return scores
|
||||
mode *= 3
|
||||
return {
|
||||
dget(13+mode),
|
||||
dget(14+mode),
|
||||
dget(15+mode)
|
||||
}
|
||||
end
|
||||
|
||||
function addscore(mode,score)
|
||||
if (score==0)return -1
|
||||
local s=getscores(mode)
|
||||
if (score==0)return
|
||||
local s,inv=getscores(mode), invscr_ordering and -1 or 1
|
||||
s[4]=score
|
||||
|
||||
if(invscr_ordering)inv_scores(s)
|
||||
|
||||
local i=3
|
||||
while 0<i do
|
||||
if s[i+1]>s[i]or 0==s[i]then
|
||||
s[i+1],s[i]=s[i],s[i+1]
|
||||
else break end
|
||||
if (s[i]!=0 and s[i+1]*inv<=s[i]*inv) break
|
||||
s[i+1],s[i]=s[i],s[i+1]
|
||||
i-=1
|
||||
end
|
||||
|
||||
if(invscr_ordering)inv_scores(s)
|
||||
|
||||
mode-=1
|
||||
for n=1,3 do
|
||||
@ -1993,11 +1988,6 @@ function addscore(mode,score)
|
||||
return i+1
|
||||
end
|
||||
|
||||
function inv_scores(s)
|
||||
for i=1,#s do
|
||||
s[i]*=-1
|
||||
end
|
||||
end
|
||||
-->8
|
||||
--animations
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user