新增hisPool出块算法,微调his出块算法
This commit is contained in:
@@ -119,7 +119,7 @@ MODOPT={--Mod options
|
|||||||
},
|
},
|
||||||
{no=19,id="CS",name="customSeq",
|
{no=19,id="CS",name="customSeq",
|
||||||
key="b",x=680,y=470,color='B',
|
key="b",x=680,y=470,color='B',
|
||||||
list={'bag','his4','c2','rnd','mess','reverb'},
|
list={'bag','his','hisPool','c2','rnd','mess','reverb'},
|
||||||
func=function(P,O)P.gameEnv.sequence=O end,
|
func=function(P,O)P.gameEnv.sequence=O end,
|
||||||
unranked=true,
|
unranked=true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ return{
|
|||||||
drop=0,lock=15,
|
drop=0,lock=15,
|
||||||
wait=15,fall=6,
|
wait=15,fall=6,
|
||||||
nextCount=3,
|
nextCount=3,
|
||||||
|
sequence='hisPool',
|
||||||
visible='fast',
|
visible='fast',
|
||||||
freshLimit=15,
|
freshLimit=15,
|
||||||
dropPiece=score,
|
dropPiece=score,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ return{
|
|||||||
drop=0,lock=15,
|
drop=0,lock=15,
|
||||||
wait=10,fall=10,
|
wait=10,fall=10,
|
||||||
nextCount=2,
|
nextCount=2,
|
||||||
sequence='his4',
|
sequence='his',
|
||||||
task=function(P)P.modeData.target=12 end,
|
task=function(P)P.modeData.target=12 end,
|
||||||
dropPiece=function(P)
|
dropPiece=function(P)
|
||||||
local p=P.modeData.pt+P.lastPiece.row
|
local p=P.modeData.pt+P.lastPiece.row
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
local ins,rem=table.insert,table.remove
|
local ins,rem=table.insert,table.remove
|
||||||
|
local ceil=math.ceil
|
||||||
local yield=YIELD
|
local yield=YIELD
|
||||||
|
|
||||||
local seqGenerators={
|
local seqGenerators={
|
||||||
@@ -18,21 +19,76 @@ local seqGenerators={
|
|||||||
yield()
|
yield()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
his4=function(P,seq0)
|
his=function(P,seq0)
|
||||||
local len=#seq0
|
local len=#seq0
|
||||||
local his={0,0,0,0}
|
local hisLen=ceil(len*.5)
|
||||||
|
local history=TABLE.new(0,hisLen)
|
||||||
while true do
|
while true do
|
||||||
while #P.nextQueue<6 do
|
while #P.nextQueue<6 do
|
||||||
for n=1,4 do
|
local r
|
||||||
local j,i=0
|
for _=1,hisLen do--Reroll up to [hisLen] times
|
||||||
repeat
|
r=P:RND(len)
|
||||||
i=P:RND(len)
|
for i=1,hisLen do
|
||||||
j=j+1
|
if r==history[i]then
|
||||||
until i~=his[1]and i~=his[2]and i~=his[3]and i~=his[4]or j==4
|
goto CONTINUE_rollAgain
|
||||||
his[n]=seq0[i]
|
|
||||||
P:getNext(i)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
do break end
|
||||||
|
::CONTINUE_rollAgain::
|
||||||
|
end
|
||||||
|
if history[1]~=0 then P:getNext(r)end
|
||||||
|
rem(history,1)ins(history,r)
|
||||||
|
end
|
||||||
|
yield()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
hisPool=function(P,seq0)
|
||||||
|
local len=#seq0
|
||||||
|
local hisLen=ceil(len*.5)
|
||||||
|
local poolLen=5*len
|
||||||
|
|
||||||
|
local history=TABLE.new(0,hisLen)--Indexes of pool
|
||||||
|
local droughtTimes=TABLE.new(len,len)--Drought times of seq0
|
||||||
|
local pool={}for i=1,len do for _=1,5 do ins(pool,i)end end--5 times indexes of seq0
|
||||||
|
|
||||||
|
while true do
|
||||||
|
while #P.nextQueue<6 do
|
||||||
|
--Roll mino
|
||||||
|
local r--Random index of pool
|
||||||
|
for _=1,hisLen do
|
||||||
|
r=P:RND(poolLen)
|
||||||
|
for i=1,hisLen do
|
||||||
|
if pool[r]==history[i]then
|
||||||
|
goto CONTINUE_rollAgain
|
||||||
|
end
|
||||||
|
end
|
||||||
|
do break end
|
||||||
|
::CONTINUE_rollAgain::
|
||||||
|
end
|
||||||
|
|
||||||
|
--Give mino to player & update history
|
||||||
|
if history[1]~=0 then P:getNext(seq0[pool[r]])end
|
||||||
|
rem(history,1)ins(history,pool[r])
|
||||||
|
|
||||||
|
--Find droughtest(s) minoes
|
||||||
|
local droughtList={1}--Droughtst minoes' indexes of seq0
|
||||||
|
local maxTime=droughtTimes[1]
|
||||||
|
for i=2,len do
|
||||||
|
if droughtTimes[i]>maxTime then
|
||||||
|
maxTime=droughtTimes[i]
|
||||||
|
if #droughtList==1 then droughtList[1]=i else droughtList={i}end
|
||||||
|
elseif droughtTimes[i]==maxTime then
|
||||||
|
ins(droughtList,i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--Update droughtTimes
|
||||||
|
for i=1,len do droughtTimes[i]=droughtTimes[i]+1 end
|
||||||
|
droughtTimes[pool[r]]=0
|
||||||
|
|
||||||
|
--Update pool
|
||||||
|
pool[r]=droughtList[P:RND(#droughtList)]
|
||||||
|
end
|
||||||
yield()
|
yield()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ local kb=love.keyboard
|
|||||||
|
|
||||||
local sin=math.sin
|
local sin=math.sin
|
||||||
local ins,rem=table.insert,table.remove
|
local ins,rem=table.insert,table.remove
|
||||||
local sub=string.sub
|
|
||||||
|
|
||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
@@ -194,7 +193,7 @@ scene.widgetList={
|
|||||||
WIDGET.newText{name="subTitle",x=530,y=50,font=35,align='L',color='H'},
|
WIDGET.newText{name="subTitle",x=530,y=50,font=35,align='L',color='H'},
|
||||||
|
|
||||||
WIDGET.newSelector{name="sequence",x=1080,y=60,w=200,color='Y',
|
WIDGET.newSelector{name="sequence",x=1080,y=60,w=200,color='Y',
|
||||||
list={'bag','his4','c2','rnd','mess','reverb','loop','fixed'},
|
list={'bag','his','hisPool','c2','rnd','mess','reverb','loop','fixed'},
|
||||||
disp=CUSval("sequence"),
|
disp=CUSval("sequence"),
|
||||||
code=CUSsto("sequence")
|
code=CUSsto("sequence")
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user