地图消除测试修改
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 i := 0; i < Height; i++ {
|
||||||
for j := 0; j < Height; j++ {
|
for j := 0; j < Height; j++ {
|
||||||
k := j + i*7
|
k := j + i*7
|
||||||
if k%Height-3 >= 0 {
|
if k%Height+3 < Height {
|
||||||
k1 := this.Plat[k].Color
|
k1 := this.Plat[k].Color
|
||||||
k2 := this.Plat[k+2].Color
|
k2 := this.Plat[k+2].Color
|
||||||
pos := k + 1
|
pos := k + 1
|
||||||
if k1 == k2 {
|
if k1 == k2 {
|
||||||
// 左右
|
// 左
|
||||||
if pos%Height-1 >= Width {
|
if pos/Height-1 >= 0 {
|
||||||
p := this.Plat[pos-Height].Color
|
p := this.Plat[pos-Height].Color
|
||||||
if p == k1 {
|
if p == k1 {
|
||||||
bEliminate = true
|
bEliminate = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if pos%Height+1 < Width {
|
if pos/Height+1 < Width { // 右
|
||||||
p := this.Plat[pos+Width].Color
|
p := this.Plat[pos+Width].Color
|
||||||
if p == k1 {
|
if p == k1 {
|
||||||
bEliminate = true
|
bEliminate = true
|
||||||
|
@ -84,12 +84,23 @@ func Test_Main(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
m := new(entertainment.MapData)
|
m := new(entertainment.MapData)
|
||||||
m.InitMap(nil)
|
m.InitMap(nil)
|
||||||
m.SetMap()
|
for i := 0; i < 100; i++ {
|
||||||
|
m := new(entertainment.MapData)
|
||||||
|
m.InitMap(nil)
|
||||||
|
//m.SetMap()
|
||||||
m.SetIndelibilityPlat()
|
m.SetIndelibilityPlat()
|
||||||
|
d, _ := m.CheckMap(0, true)
|
||||||
|
if len(d) > 0 {
|
||||||
|
fmt.Println("===========有消除")
|
||||||
m.Debugf()
|
m.Debugf()
|
||||||
|
}
|
||||||
|
|
||||||
if m.CheckAndRefreshPlat() {
|
if m.CheckAndRefreshPlat() {
|
||||||
|
m.Debugf()
|
||||||
fmt.Println("xxxx")
|
fmt.Println("xxxx")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//var szMap []*pb.MapData
|
//var szMap []*pb.MapData
|
||||||
// if bSwap, m := m.AiSwapGirde(); bSwap {
|
// if bSwap, m := m.AiSwapGirde(); bSwap {
|
||||||
// szMap = append(szMap, m...)
|
// szMap = append(szMap, m...)
|
||||||
|
Loading…
Reference in New Issue
Block a user