注释首字母大写
This commit is contained in:
29
parts/ai.lua
29
parts/ai.lua
@@ -198,7 +198,7 @@ end
|
||||
return{
|
||||
["9S"]={
|
||||
function(P,ctrl)
|
||||
local Tfield={}--test field
|
||||
local Tfield={}--Test field
|
||||
local field_org=P.field
|
||||
for i=1,#field_org do
|
||||
Tfield[i]=freeRow.get(0)
|
||||
@@ -217,13 +217,17 @@ return{
|
||||
end
|
||||
if not bn then goto CTN end
|
||||
|
||||
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 not ifoverlapAI(Tfield,cb,cx,cy-1)do
|
||||
cy=cy-1
|
||||
end--move to bottom
|
||||
end
|
||||
|
||||
--Simulate lock
|
||||
for i=1,#cb do
|
||||
local y=cy+i-1
|
||||
if not Tfield[y]then Tfield[y]=freeRow.get(0)end
|
||||
@@ -232,7 +236,7 @@ return{
|
||||
Tfield[y][cx+j-1]=1
|
||||
end
|
||||
end
|
||||
end--simulate lock
|
||||
end
|
||||
local score=getScore(Tfield,cb,cy)
|
||||
if score>best.score then
|
||||
best={bn=bn,x=cx,dir=dir,hold=ifhold==1,score=score}
|
||||
@@ -270,11 +274,11 @@ return{
|
||||
end,
|
||||
},
|
||||
["CC"]={
|
||||
function(P)
|
||||
function(P)--Start thinking
|
||||
BOT.think(P.AI_bot)
|
||||
return 2
|
||||
end,--start thinking
|
||||
function(P,ctrl)
|
||||
end,
|
||||
function(P,ctrl)--Poll keys
|
||||
if BOT.ifDead(P.AI_bot)then ins(ctrl,6)return 3 end
|
||||
local success,hold,move=BOT.getMove(P.AI_bot)
|
||||
if success then
|
||||
@@ -290,10 +294,11 @@ return{
|
||||
ins(ctrl,6)
|
||||
return 3
|
||||
else
|
||||
return 2--stay this stage
|
||||
--Stay this stage
|
||||
return 2
|
||||
end
|
||||
end,--poll keys
|
||||
function(P)
|
||||
end,
|
||||
function(P)--Check if time to change target
|
||||
P.AI_delay=P.AI_delay0
|
||||
if Timer()-P.modeData.point>P.modeData.event then
|
||||
P.modeData.point=Timer()
|
||||
@@ -301,6 +306,6 @@ return{
|
||||
P:changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
|
||||
end
|
||||
return 1
|
||||
end,--check if time to change target
|
||||
end,
|
||||
},
|
||||
}--AI think stage
|
||||
Reference in New Issue
Block a user