地图消除测试修改
This commit is contained in:
parent
d684e12e93
commit
57dc3f721b
@ -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
|
||||
|
@ -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...)
|
||||
|
Loading…
Reference in New Issue
Block a user