Golf. Now 8161 tokens (from 8185).

This commit is contained in:
Kistaro Windrider 2023-07-23 16:08:54 -07:00
parent be0f1349ae
commit 09ef3617f7
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -1960,31 +1960,26 @@ 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
if (s[i]!=0 and s[i+1]*inv<=s[i]*inv) break
s[i+1],s[i]=s[i],s[i+1]
else break end
i-=1
end
if(invscr_ordering)inv_scores(s)
mode-=1
for n=1,3 do
dset(15+3*mode+n,s[n])
@ -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