From f6b613ee173c4fa30ef8e161f892725739770cdb Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Thu, 31 Dec 2020 14:53:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0c4w=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=9C=BA=E5=9C=B0=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/modes/c4wtrain_lunatic.lua | 24 ++++++++++++++++-------- parts/modes/c4wtrain_normal.lua | 24 ++++++++++++++++-------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/parts/modes/c4wtrain_lunatic.lua b/parts/modes/c4wtrain_lunatic.lua index 93315fe6..bdae5bc6 100644 --- a/parts/modes/c4wtrain_lunatic.lua +++ b/parts/modes/c4wtrain_lunatic.lua @@ -1,4 +1,5 @@ -local min=math.min +local rnd,min=math.random,math.min +local rem=table.remove local function check_c4w(P) if P.lastPiece.row==0 then P:lose() @@ -35,13 +36,20 @@ return{ P.visTime[i]=FREEROW.get(20) for x=4,7 do F[i][x]=0 end end - local r=P:RND(6) - if r==1 then F[1][5],F[1][4],F[2][4]=20,20,20 - elseif r==2 then F[1][6],F[1][7],F[2][7]=20,20,20 - elseif r==3 then F[1][4],F[2][4],F[2][5]=20,20,20 - elseif r==4 then F[1][7],F[2][7],F[2][6]=20,20,20 - elseif r==5 then F[1][4],F[1][5],F[1][6]=20,20,20 - elseif r==6 then F[1][7],F[1][6],F[1][5]=20,20,20 + if rnd()<.6 then + local initCell={11,14,12,13,21,24} + for _=1,3 do + _=rem(initCell,rnd(#initCell)) + F[math.floor(_/10)][3+_%10]=20 + end + else + local initCell={11,12,13,14,21,22,23,24} + rem(initCell,rnd(5,8)) + rem(initCell,rnd(1,4)) + for _=1,6 do + _=rem(initCell,rnd(#initCell)) + F[math.floor(_/10)][3+_%10]=20 + end end end, mesDisp=function(P) diff --git a/parts/modes/c4wtrain_normal.lua b/parts/modes/c4wtrain_normal.lua index 3dbeb563..97b53c22 100644 --- a/parts/modes/c4wtrain_normal.lua +++ b/parts/modes/c4wtrain_normal.lua @@ -1,4 +1,5 @@ -local min=math.min +local rnd,min=math.random,math.min +local rem=table.remove local function check_c4w(P) if P.lastPiece.row>0 then for _=1,#P.clearedRow do @@ -33,13 +34,20 @@ return{ P.visTime[i]=FREEROW.get(20) for x=4,7 do F[i][x]=0 end end - local r=P:RND(6) - if r==1 then F[1][5],F[1][4],F[2][4]=20,20,20 - elseif r==2 then F[1][6],F[1][7],F[2][7]=20,20,20 - elseif r==3 then F[1][4],F[2][4],F[2][5]=20,20,20 - elseif r==4 then F[1][7],F[2][7],F[2][6]=20,20,20 - elseif r==5 then F[1][4],F[1][5],F[1][6]=20,20,20 - elseif r==6 then F[1][7],F[1][6],F[1][5]=20,20,20 + if rnd()<.6 then + local initCell={11,14,12,13,21,24} + for _=1,3 do + _=rem(initCell,rnd(#initCell)) + F[math.floor(_/10)][3+_%10]=20 + end + else + local initCell={11,12,13,14,21,22,23,24} + rem(initCell,rnd(5,8)) + rem(initCell,rnd(1,4)) + for _=1,6 do + _=rem(initCell,rnd(#initCell)) + F[math.floor(_/10)][3+_%10]=20 + end end end, mesDisp=function(P)