序列生成模块改名,修正his4的”重复“概念为序列里的id重复而不是方块重复
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
local Player=require"parts.player.player"
|
local Player=require"parts.player.player"
|
||||||
local getSeqGen=require"parts.player.getSeqGen"
|
local seqGenerators=require"parts.player.seqGenerators"
|
||||||
local gameEnv0=require"parts.player.gameEnv0"
|
local gameEnv0=require"parts.player.gameEnv0"
|
||||||
|
|
||||||
local rnd,max=math.random,math.max
|
local rnd,max=math.random,math.max
|
||||||
@@ -314,7 +314,7 @@ local function applyGameEnv(P)--Finish gameEnv processing
|
|||||||
|
|
||||||
if ENV.nextCount==0 then ENV.nextPos=false end
|
if ENV.nextCount==0 then ENV.nextPos=false end
|
||||||
|
|
||||||
P.newNext=coroutine.wrap(getSeqGen(P))
|
P.newNext=coroutine.wrap(seqGenerators(P))
|
||||||
P.newNext(P,P.gameEnv.seqData)
|
P.newNext(P,P.gameEnv.seqData)
|
||||||
|
|
||||||
if P.mini then
|
if P.mini then
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
local ins,rem=table.insert,table.remove
|
local ins,rem=table.insert,table.remove
|
||||||
local yield=YIELD
|
local yield=YIELD
|
||||||
|
|
||||||
local seqGens={
|
local seqGenerators={
|
||||||
none=function()while true do yield()end end,
|
none=function()while true do yield()end end,
|
||||||
bag=function(P,seq0)
|
bag=function(P,seq0)
|
||||||
local len=#seq0
|
local len=#seq0
|
||||||
@@ -26,10 +26,10 @@ local seqGens={
|
|||||||
for n=1,4 do
|
for n=1,4 do
|
||||||
local j,i=0
|
local j,i=0
|
||||||
repeat
|
repeat
|
||||||
i=seq0[P:RND(len)]
|
i=P:RND(len)
|
||||||
j=j+1
|
j=j+1
|
||||||
until i~=his[1]and i~=his[2]and i~=his[3]and i~=his[4]or j==4
|
until i~=his[1]and i~=his[2]and i~=his[3]and i~=his[4]or j==4
|
||||||
his[n]=i
|
his[n]=seq0[i]
|
||||||
P:getNext(i)
|
P:getNext(i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -143,8 +143,8 @@ return function(P)--Return a piece-generating funtion for player P
|
|||||||
local s=P.gameEnv.sequence
|
local s=P.gameEnv.sequence
|
||||||
if type(s)=='function'then
|
if type(s)=='function'then
|
||||||
return s
|
return s
|
||||||
elseif type(s)=='string'and seqGens[s]then
|
elseif type(s)=='string'and seqGenerators[s]then
|
||||||
return seqGens[s]
|
return seqGenerators[s]
|
||||||
else
|
else
|
||||||
LOG.print(
|
LOG.print(
|
||||||
type(s)=='string'and
|
type(s)=='string'and
|
||||||
@@ -152,6 +152,6 @@ return function(P)--Return a piece-generating funtion for player P
|
|||||||
"Wrong sequence generator",
|
"Wrong sequence generator",
|
||||||
'warn')
|
'warn')
|
||||||
P.gameEnv.sequence='bag'
|
P.gameEnv.sequence='bag'
|
||||||
return seqGens.bag
|
return seqGenerators.bag
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user