CC函数整理
This commit is contained in:
43
parts/ai.lua
43
parts/ai.lua
@@ -15,29 +15,29 @@ local Timer=love.timer.getTime
|
|||||||
-- 11~13:LL,RR,DD
|
-- 11~13:LL,RR,DD
|
||||||
local blockPos={4,4,4,4,4,5,4}
|
local blockPos={4,4,4,4,4,5,4}
|
||||||
-------------------------------------------------Cold clear
|
-------------------------------------------------Cold clear
|
||||||
cc=LOADLIB("CC")
|
CC=LOADLIB("CC")
|
||||||
if cc then
|
if CC then
|
||||||
local CCblockID={6,5,4,3,2,1,0}
|
local CCblockID={6,5,4,3,2,1,0}
|
||||||
CC={
|
CC={
|
||||||
getConf= cc.get_default_config ,--()options,weights
|
getConf= CC.get_default_config ,--()options,weights
|
||||||
fastWeights=cc.fast_weights ,--(weights)
|
fastWeights=CC.fast_weights ,--(weights)
|
||||||
--setConf= cc.set_options ,--(options,hold,20g,bag7)
|
--setConf= CC.set_options ,--(options,hold,20g,bag7)
|
||||||
|
|
||||||
new= cc.launch_async ,--(options,weights)bot
|
new= CC.launch_async ,--(options,weights)bot
|
||||||
addNext= cc.add_next_piece_async ,--(bot,piece)
|
addNext= CC.add_next_piece_async ,--(bot,piece)
|
||||||
update= cc.reset_async ,--(bot,field,b2b,combo)
|
update= CC.reset_async ,--(bot,field,b2b,combo)
|
||||||
think= cc.request_next_move ,--(bot)
|
think= CC.request_next_move ,--(bot)
|
||||||
getMove= cc.poll_next_move ,--(bot)success,dest,hold,move
|
getMove= CC.poll_next_move ,--(bot)success,dest,hold,move
|
||||||
destroy= cc.destroy_async ,--(bot)
|
destroy= CC.destroy_async ,--(bot)
|
||||||
|
|
||||||
setHold= cc.set_hold ,--(opt,bool)
|
setHold= CC.set_hold ,--(opt,bool)
|
||||||
set20G= cc.set_20g ,--(opt,bool)
|
set20G= CC.set_20g ,--(opt,bool)
|
||||||
setPCLoop= cc.set_pcloop ,--(opt,bool)
|
-- setPCLoop= CC.set_pcloop ,--(opt,bool)
|
||||||
setBag= cc.set_bag7 ,--(opt,bool)
|
setBag= CC.set_bag7 ,--(opt,bool)
|
||||||
setNode= cc.set_max_nodes ,--(opt,bool)
|
setNode= CC.set_max_nodes ,--(opt,bool)
|
||||||
free= cc.free ,--(opt/wei)
|
free= CC.free ,--(opt/wei)
|
||||||
}
|
}
|
||||||
function CC_updateField(P)
|
function CC.updateField(P)
|
||||||
local F,i={},1
|
local F,i={},1
|
||||||
for y=1,#P.field do
|
for y=1,#P.field do
|
||||||
for x=1,10 do
|
for x=1,10 do
|
||||||
@@ -51,8 +51,7 @@ if cc then
|
|||||||
LOG.print("CC is dead ("..P.id..")","error")
|
LOG.print("CC is dead ("..P.id..")","error")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local scs={{0,1},{0,1},{0,1},{0,1},{0,1},{.5,.5},{-.5,1.5}}
|
function CC.switch20G(P)
|
||||||
function CC_switch20G(P)
|
|
||||||
if not pcall(CC.destroy,P.AI_bot)then
|
if not pcall(CC.destroy,P.AI_bot)then
|
||||||
LOG.print("CC is dead ("..P.id..")","error")
|
LOG.print("CC is dead ("..P.id..")","error")
|
||||||
return
|
return
|
||||||
@@ -70,11 +69,11 @@ if cc then
|
|||||||
for i=1,P.AIdata.next do
|
for i=1,P.AIdata.next do
|
||||||
CC.addNext(P.AI_bot,CCblockID[P.next[i].id])
|
CC.addNext(P.AI_bot,CCblockID[P.next[i].id])
|
||||||
end
|
end
|
||||||
CC_updateField(P)
|
CC.updateField(P)
|
||||||
P.hd=nil
|
P.hd=nil
|
||||||
P.holded=false
|
P.holded=false
|
||||||
P.cur=rem(P.next,1)
|
P.cur=rem(P.next,1)
|
||||||
P.sc,P.dir=scs[P.cur.id],0
|
P.sc,P.dir=spinCenters[P.cur.id][0],0
|
||||||
P.r,P.c=#P.cur.bk,#P.cur.bk[1]
|
P.r,P.c=#P.cur.bk,#P.cur.bk[1]
|
||||||
P.curX,P.curY=blockPos[P.cur.id],21+ceil(P.fieldBeneath/30)-P.r+min(int(#P.field*.2),2)
|
P.curX,P.curY=blockPos[P.cur.id],21+ceil(P.fieldBeneath/30)-P.r+min(int(#P.field*.2),2)
|
||||||
|
|
||||||
|
|||||||
@@ -384,7 +384,7 @@ function royaleLevelup()
|
|||||||
if P.gameEnv.drop==0 then
|
if P.gameEnv.drop==0 then
|
||||||
P.curY=P.imgY
|
P.curY=P.imgY
|
||||||
P._20G=true
|
P._20G=true
|
||||||
if P.AI_mode=="CC"then CC_switch20G(P)end
|
if P.AI_mode=="CC"then CC.switch20G(P)end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -344,9 +344,9 @@ local function Pupdate_alive(P,dt)
|
|||||||
if P.imgY~=P.curY then
|
if P.imgY~=P.curY then
|
||||||
P.dropDelay=P.gameEnv.drop
|
P.dropDelay=P.gameEnv.drop
|
||||||
elseif P.AI_mode=="CC"then
|
elseif P.AI_mode=="CC"then
|
||||||
CC_updateField(P)
|
CC.updateField(P)
|
||||||
if not P.AIdata._20G and P.gameEnv.drop<P.AI_delay0*.5 then
|
if not P.AIdata._20G and P.gameEnv.drop<P.AI_delay0*.5 then
|
||||||
CC_switch20G(P)
|
CC.switch20G(P)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -354,7 +354,7 @@ local function Pupdate_alive(P,dt)
|
|||||||
if P.lockDelay>=0 then goto stop end
|
if P.lockDelay>=0 then goto stop end
|
||||||
P:drop()
|
P:drop()
|
||||||
if P.AI_mode=="CC"then
|
if P.AI_mode=="CC"then
|
||||||
CC_updateField(P)
|
CC.updateField(P)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1662,7 +1662,7 @@ function player.garbageRelease(P)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if flag and P.AI_mode=="CC"then CC_updateField(P)end
|
if flag and P.AI_mode=="CC"then CC.updateField(P)end
|
||||||
end
|
end
|
||||||
function player.garbageRise(P,color,amount,pos)
|
function player.garbageRise(P,color,amount,pos)
|
||||||
local _
|
local _
|
||||||
@@ -1856,7 +1856,7 @@ function player.lock(P)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if has_dest and not dest then
|
if has_dest and not dest then
|
||||||
CC_updateField(P)
|
CC.updateField(P)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user