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
|
||||
local blockPos={4,4,4,4,4,5,4}
|
||||
-------------------------------------------------Cold clear
|
||||
cc=LOADLIB("CC")
|
||||
if cc then
|
||||
CC=LOADLIB("CC")
|
||||
if CC then
|
||||
local CCblockID={6,5,4,3,2,1,0}
|
||||
CC={
|
||||
getConf= cc.get_default_config ,--()options,weights
|
||||
fastWeights=cc.fast_weights ,--(weights)
|
||||
--setConf= cc.set_options ,--(options,hold,20g,bag7)
|
||||
getConf= CC.get_default_config ,--()options,weights
|
||||
fastWeights=CC.fast_weights ,--(weights)
|
||||
--setConf= CC.set_options ,--(options,hold,20g,bag7)
|
||||
|
||||
new= cc.launch_async ,--(options,weights)bot
|
||||
addNext= cc.add_next_piece_async ,--(bot,piece)
|
||||
update= cc.reset_async ,--(bot,field,b2b,combo)
|
||||
think= cc.request_next_move ,--(bot)
|
||||
getMove= cc.poll_next_move ,--(bot)success,dest,hold,move
|
||||
destroy= cc.destroy_async ,--(bot)
|
||||
new= CC.launch_async ,--(options,weights)bot
|
||||
addNext= CC.add_next_piece_async ,--(bot,piece)
|
||||
update= CC.reset_async ,--(bot,field,b2b,combo)
|
||||
think= CC.request_next_move ,--(bot)
|
||||
getMove= CC.poll_next_move ,--(bot)success,dest,hold,move
|
||||
destroy= CC.destroy_async ,--(bot)
|
||||
|
||||
setHold= cc.set_hold ,--(opt,bool)
|
||||
set20G= cc.set_20g ,--(opt,bool)
|
||||
setPCLoop= cc.set_pcloop ,--(opt,bool)
|
||||
setBag= cc.set_bag7 ,--(opt,bool)
|
||||
setNode= cc.set_max_nodes ,--(opt,bool)
|
||||
free= cc.free ,--(opt/wei)
|
||||
setHold= CC.set_hold ,--(opt,bool)
|
||||
set20G= CC.set_20g ,--(opt,bool)
|
||||
-- setPCLoop= CC.set_pcloop ,--(opt,bool)
|
||||
setBag= CC.set_bag7 ,--(opt,bool)
|
||||
setNode= CC.set_max_nodes ,--(opt,bool)
|
||||
free= CC.free ,--(opt/wei)
|
||||
}
|
||||
function CC_updateField(P)
|
||||
function CC.updateField(P)
|
||||
local F,i={},1
|
||||
for y=1,#P.field do
|
||||
for x=1,10 do
|
||||
@@ -51,8 +51,7 @@ if cc then
|
||||
LOG.print("CC is dead ("..P.id..")","error")
|
||||
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
|
||||
LOG.print("CC is dead ("..P.id..")","error")
|
||||
return
|
||||
@@ -70,11 +69,11 @@ if cc then
|
||||
for i=1,P.AIdata.next do
|
||||
CC.addNext(P.AI_bot,CCblockID[P.next[i].id])
|
||||
end
|
||||
CC_updateField(P)
|
||||
CC.updateField(P)
|
||||
P.hd=nil
|
||||
P.holded=false
|
||||
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.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
|
||||
P.curY=P.imgY
|
||||
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
|
||||
|
||||
@@ -344,9 +344,9 @@ local function Pupdate_alive(P,dt)
|
||||
if P.imgY~=P.curY then
|
||||
P.dropDelay=P.gameEnv.drop
|
||||
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
|
||||
CC_switch20G(P)
|
||||
CC.switch20G(P)
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -354,7 +354,7 @@ local function Pupdate_alive(P,dt)
|
||||
if P.lockDelay>=0 then goto stop end
|
||||
P:drop()
|
||||
if P.AI_mode=="CC"then
|
||||
CC_updateField(P)
|
||||
CC.updateField(P)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1662,7 +1662,7 @@ function player.garbageRelease(P)
|
||||
break
|
||||
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
|
||||
function player.garbageRise(P,color,amount,pos)
|
||||
local _
|
||||
@@ -1856,7 +1856,7 @@ function player.lock(P)
|
||||
end
|
||||
end
|
||||
if has_dest and not dest then
|
||||
CC_updateField(P)
|
||||
CC.updateField(P)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user