注释后加空格
联网稍微推进
This commit is contained in:
@@ -23,10 +23,10 @@ local seqGenerators={
|
||||
local rndGen=P.seqRND
|
||||
local len=#seq0
|
||||
local bag=TABLE.shift(seq0)
|
||||
do--Get a good first-bag
|
||||
--Shuffle
|
||||
do-- Get a good first-bag
|
||||
-- Shuffle
|
||||
for i=1,len-1 do ins(bag,rem(bag,rndGen:random(len-i+1))) end
|
||||
--Skip Uncomfortable minoes
|
||||
-- Skip Uncomfortable minoes
|
||||
for _=1,len-1 do
|
||||
if
|
||||
bag[1]==1 or bag[1]==2 or bag[1]==6 or bag[1]==8 or bag[1]==9 or
|
||||
@@ -39,7 +39,7 @@ local seqGenerators={
|
||||
break
|
||||
end
|
||||
end
|
||||
--Finish
|
||||
-- Finish
|
||||
for i=1,len do P:getNext(bag[i]) end
|
||||
end
|
||||
bag={}
|
||||
@@ -63,7 +63,7 @@ local seqGenerators={
|
||||
while true do
|
||||
while #P.nextQueue<10 do
|
||||
local r
|
||||
for _=1,hisLen do--Reroll up to [hisLen] times
|
||||
for _=1,hisLen do-- Reroll up to [hisLen] times
|
||||
r=rndGen:random(len)
|
||||
for i=1,hisLen do
|
||||
if r==history[i] then
|
||||
@@ -86,17 +86,17 @@ local seqGenerators={
|
||||
local rndGen=P.seqRND
|
||||
local len=#seq0
|
||||
local hisLen=math.ceil(len*.5)
|
||||
local history=TABLE.new(0,hisLen)--Indexes of mino-index
|
||||
local history=TABLE.new(0,hisLen)-- Indexes of mino-index
|
||||
|
||||
local poolLen=5*len
|
||||
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
|
||||
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
|
||||
local function _poolPick()
|
||||
local r=rndGen:random(poolLen)
|
||||
local res=pool[r]
|
||||
|
||||
--Find droughtest(s) minoes
|
||||
local droughtList={1}--Droughtst minoes' indexes of seq0
|
||||
-- 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
|
||||
@@ -111,11 +111,11 @@ local seqGenerators={
|
||||
end
|
||||
end
|
||||
|
||||
--Update droughtTimes
|
||||
-- Update droughtTimes
|
||||
for i=1,len do droughtTimes[i]=droughtTimes[i]+1 end
|
||||
droughtTimes[res]=0
|
||||
|
||||
--Update pool
|
||||
-- Update pool
|
||||
-- print("Rem "..res)
|
||||
pool[r]=droughtList[rndGen:random(#droughtList)]
|
||||
-- print("Add "..pool[r])
|
||||
@@ -126,10 +126,10 @@ local seqGenerators={
|
||||
while true do
|
||||
while #P.nextQueue<10 do
|
||||
-- print"======================"
|
||||
--Pick a mino from pool
|
||||
-- Pick a mino from pool
|
||||
local tryTime=0
|
||||
::REPEAT_pickAgain::
|
||||
local r=_poolPick()--Random mino-index in pool
|
||||
local r=_poolPick()-- Random mino-index in pool
|
||||
for i=1,len do
|
||||
if r==history[i] then
|
||||
tryTime=tryTime+1
|
||||
@@ -139,7 +139,7 @@ local seqGenerators={
|
||||
end
|
||||
end
|
||||
|
||||
--Give mino to player & update history
|
||||
-- Give mino to player & update history
|
||||
if history[1]~=0 then
|
||||
P:getNext(seq0[r])
|
||||
end
|
||||
@@ -263,7 +263,7 @@ local seqGenerators={
|
||||
end
|
||||
end,
|
||||
}
|
||||
return function(P)--Return a piece-generating function for player P
|
||||
return function(P)-- Return a piece-generating function for player P
|
||||
local s=P.gameEnv.sequence
|
||||
if type(s)=='function' then
|
||||
return s
|
||||
|
||||
Reference in New Issue
Block a user