From 57dc3f721becdb7e1633ec5f45c1e27cabe97486 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 26 Oct 2023 18:53:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=B6=88=E9=99=A4=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/entertainment/xxlPlat.go | 8 ++++---- modules/entertainment/xxl_test.go | 21 ++++++++++++++++----- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/modules/entertainment/xxlPlat.go b/modules/entertainment/xxlPlat.go index 695b891cb..998091b74 100644 --- a/modules/entertainment/xxlPlat.go +++ b/modules/entertainment/xxlPlat.go @@ -751,20 +751,20 @@ func (this *MapData) CheckAndRefreshPlat() (bEliminate bool) { for i := 0; i < Height; i++ { for j := 0; j < Height; j++ { k := j + i*7 - if k%Height-3 >= 0 { + if k%Height+3 < Height { k1 := this.Plat[k].Color k2 := this.Plat[k+2].Color pos := k + 1 if k1 == k2 { - // 左右 - if pos%Height-1 >= Width { + // 左 + if pos/Height-1 >= 0 { p := this.Plat[pos-Height].Color if p == k1 { bEliminate = true return } } - if pos%Height+1 < Width { + if pos/Height+1 < Width { // 右 p := this.Plat[pos+Width].Color if p == k1 { bEliminate = true diff --git a/modules/entertainment/xxl_test.go b/modules/entertainment/xxl_test.go index b4d7faf19..3b23a3ba8 100644 --- a/modules/entertainment/xxl_test.go +++ b/modules/entertainment/xxl_test.go @@ -84,12 +84,23 @@ func Test_Main(t *testing.T) { }() m := new(entertainment.MapData) m.InitMap(nil) - m.SetMap() - m.SetIndelibilityPlat() - m.Debugf() - if m.CheckAndRefreshPlat() { - fmt.Println("xxxx") + for i := 0; i < 100; i++ { + m := new(entertainment.MapData) + m.InitMap(nil) + //m.SetMap() + m.SetIndelibilityPlat() + d, _ := m.CheckMap(0, true) + if len(d) > 0 { + fmt.Println("===========有消除") + m.Debugf() + } + + if m.CheckAndRefreshPlat() { + m.Debugf() + fmt.Println("xxxx") + } } + //var szMap []*pb.MapData // if bSwap, m := m.AiSwapGirde(); bSwap { // szMap = append(szMap, m...)