整 理 代 码

(应该没有改到字符串里面的东西吧…)起码不直接影响运行
This commit is contained in:
MrZ_26
2022-10-01 11:32:11 +08:00
parent 6e00ff96ec
commit 06f4bb4e1a
236 changed files with 2087 additions and 2114 deletions

View File

@@ -38,8 +38,8 @@ local FCL={
local LclearScore={[0]=0,-200,-150,-100,200}
local HclearScore={[0]=0,100,140,200,500}
local function _ifoverlapAI(f,bk,x,y)
for i=1,#bk do for j=1,#bk[1]do
if f[y+i-1]and bk[i][j]and f[y+i-1][x+j-1]>0 then
for i=1,#bk do for j=1,#bk[1] do
if f[y+i-1] and bk[i][j] and f[y+i-1][x+j-1]>0 then
return true
end
end end
@@ -157,28 +157,28 @@ function bot_9s.thread(bot)
if ifhold==0 then
bn=P.cur and P.cur.id
else
bn=P.holdQueue[1]and P.holdQueue[1].id or P.nextQueue[1]and P.nextQueue[1].id
bn=P.holdQueue[1] and P.holdQueue[1].id or P.nextQueue[1] and P.nextQueue[1].id
end
if bn then
for dir=0,dirCount[bn]do--Each dir
for dir=0,dirCount[bn] do--Each dir
local cb=BLOCKS[bn][dir]
for cx=1,11-#cb[1]do--Each pos
for cx=1,11-#cb[1] do--Each pos
local cy=#Tfield+1
--Move to bottom
while cy>1 and not _ifoverlapAI(Tfield,cb,cx,cy-1)do
while cy>1 and not _ifoverlapAI(Tfield,cb,cx,cy-1) do
cy=cy-1
end
--Simulate lock
for i=1,#cb do
local y=cy+i-1
if not Tfield[y]then
if not Tfield[y] then
Tfield[y]=getRow(0)
end
local L=Tfield[y]
for j=1,#cb[1]do
if cb[i][j]then
for j=1,#cb[1] do
if cb[i][j] then
L[cx+j-1]=1
end
end

View File

@@ -21,7 +21,7 @@ function bot_cc:checkDest(b2b,atk,exblock,yomi)
local CB=self.P.cur.bk
for k=1,#dest,2 do
local r=CB[dest[k+1]-self.P.curY+2]
if not r or not r[dest[k]-self.P.curX+2]then
if not r or not r[dest[k]-self.P.curX+2] then
print('wrong place')
self:lockWrongPlace()
self.P.destFX=nil
@@ -76,7 +76,7 @@ function bot_cc:thread()
if hold then--Hold
keys[1]=8
end
while move[1]do
while move[1] do
local m=rem(move,1)
if m<4 then
ins(keys,m+1)
@@ -105,7 +105,7 @@ function bot_cc:updateField()
end end
while i<=400 do F[i],i=false,i+1 end
local y = P:getNextSpawn()-1
if not pcall(self.ccBot.reset,self.ccBot,F,P.b2b,P.combo,P.stat.pc,P.stat.row,y)then
if not pcall(self.ccBot.reset,self.ccBot,F,P.b2b,P.combo,P.stat.pc,P.stat.row,y) then
print("CC is dead ("..P.id..")","error")
for y=#F0,1,-1 do
local s=""

View File

@@ -14,9 +14,9 @@ function baseBot.update(bot)
local keys=bot.keys
if P.control and P.cur then
bot.delay=bot.delay-1
if not keys[1]then
if not keys[1] then
if bot.runningThread then
if not pcall(bot.runningThread)then
if not pcall(bot.runningThread) then
bot.runningThread=false
end
else
@@ -61,17 +61,17 @@ local AISpeed={60,50,42,34,27,21,16,12,9,6}
}
]]
function BOT.template(arg)
if arg.type=='CC'then
if arg.type=='CC' then
return{
type='CC',
next=arg.next,
hold=arg.hold,
delay=AISpeed[arg.speedLV],
node=arg.node,
bag=(arg.randomizer or'bag')=='bag',
bag=(arg.randomizer or 'bag')=='bag',
_20G=arg._20G,
}
elseif arg.type=='9S'then
elseif arg.type=='9S' then
return{
type='9S',
delay=math.floor(AISpeed[arg.speedLV]),
@@ -82,7 +82,7 @@ end
function BOT.new(P,data)
local bot={P=P,data=data}
if data.type=="CC"then
if data.type=="CC" then
P:setRS('TRS')
bot.keys={}
bot.bufferedNexts={}
@@ -107,8 +107,8 @@ function BOT.new(P,data)
local cc_lua=require"parts.bot.bot_cc"
setmetatable(bot,{__index=function(self,k)
return
self.ccBot[k]and function(_,...)self.ccBot[k](self.ccBot,...)end or
cc_lua[k]and function(_,...)cc_lua[k](self,...)end or
self.ccBot[k] and function(_,...)self.ccBot[k](self.ccBot,...) end or
cc_lua[k] and function(_,...)cc_lua[k](self,...) end or
assert(baseBot[k],"No CC action called "..k)
end})
@@ -127,7 +127,7 @@ function BOT.new(P,data)
end
bot.runningThread=coroutine.wrap(cc_lua.thread)
bot.runningThread(bot)
else--if data.type=="9S"then--9s or else
else--if data.type=="9S" then--9s or else
TABLE.cover(baseBot,bot)
TABLE.cover(require"parts.bot.bot_9s",bot)
P:setRS('TRS')