地图消除测试修改

This commit is contained in:
meixiongfeng 2023-10-26 18:53:17 +08:00
parent d684e12e93
commit 57dc3f721b
2 changed files with 20 additions and 9 deletions

View File

@ -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

View File

@ -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...)