三消规则debug
This commit is contained in:
parent
8dcb5b95c3
commit
85ae2a1d1c
@ -487,30 +487,6 @@ func (this *MapData) CheckMap(color int32, bSkill bool) (szMap []*pb.MapData, xc
|
||||
new[k] = v
|
||||
}
|
||||
|
||||
// if bEliminate, xiaochu, s := this.Check5X(); bEliminate {
|
||||
// for _, v := range xiaochu {
|
||||
// tXiaochu[v] = struct{}{}
|
||||
// }
|
||||
// for k, v := range s {
|
||||
// new[k] = v
|
||||
// }
|
||||
// xc = true // 只要有 4x 5x 就标记ture
|
||||
// }
|
||||
// if bEliminate, xiaochu, s := this.Check4X(); bEliminate {
|
||||
// for _, v := range xiaochu {
|
||||
// tXiaochu[v] = struct{}{}
|
||||
// }
|
||||
// for k, v := range s {
|
||||
// new[k] = v
|
||||
// }
|
||||
// xc = true // 只要有 4x 5x 就标记ture
|
||||
// }
|
||||
// if bEliminate, xiaochu := this.Check3X(); bEliminate {
|
||||
// for _, v := range xiaochu {
|
||||
// tXiaochu[v] = struct{}{}
|
||||
// }
|
||||
// }
|
||||
|
||||
for id := range tXiaochu {
|
||||
if _, ok := new[id]; ok {
|
||||
if this.Plat[id].Color == color {
|
||||
@ -1441,6 +1417,7 @@ func (this *MapData) CheckElem(color int32) (mtmp map[int]struct{}, sp map[int]i
|
||||
w [14][]int32
|
||||
s1 [][]int // heng
|
||||
s2 [][]int // shu
|
||||
xc [][]int //
|
||||
)
|
||||
mtmp = make(map[int]struct{}, 0)
|
||||
sp = make(map[int]int)
|
||||
@ -1547,56 +1524,57 @@ func (this *MapData) CheckElem(color int32) (mtmp map[int]struct{}, sp map[int]i
|
||||
}
|
||||
|
||||
for _, v := range s1 {
|
||||
for _, vs1 := range v {
|
||||
t := CheckInSlice(vs1, s2) // 横竖相交
|
||||
if len(t) > 0 {
|
||||
for _, vs1 := range v {
|
||||
t[vs1] = struct{}{}
|
||||
}
|
||||
for k := range t {
|
||||
mtmp[k] = struct{}{}
|
||||
}
|
||||
if len(t) >= 5 {
|
||||
sp[vs1] = FiveType
|
||||
}
|
||||
t, xj, new := CheckInSlice(v, s2) // 横竖相交
|
||||
if len(t) > 0 {
|
||||
xc = append(xc, t)
|
||||
sp[xj] = FiveType
|
||||
s2 = new[0:][0:]
|
||||
} else {
|
||||
if len(v) >= 5 {
|
||||
sp[xj] = FiveType
|
||||
} else if len(v) >= 4 {
|
||||
sp[len(v)/2] = FourLType
|
||||
}
|
||||
xc = append(xc, v)
|
||||
}
|
||||
}
|
||||
for _, v := range s2 {
|
||||
if len(v) >= 5 {
|
||||
sp[len(v)/2] = FiveType
|
||||
} else if len(v) >= 4 {
|
||||
sp[len(v)/2] = FourUType
|
||||
}
|
||||
xc = append(xc, v)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
for k := range t {
|
||||
mtmp[k] = struct{}{}
|
||||
}
|
||||
func CheckInSlice(s []int, sz [][]int) (si []int, xj int, newMatrix [][]int) {
|
||||
newMatrix = make([][]int, len(sz))
|
||||
for i := 0; i < len(sz); i++ {
|
||||
newMatrix[i] = make([]int, len(sz[0]))
|
||||
}
|
||||
|
||||
copy(newMatrix, sz)
|
||||
for _, index := range s {
|
||||
for pos, v := range sz {
|
||||
bfound := false
|
||||
for _, vs2 := range v {
|
||||
if index == vs2 {
|
||||
bfound = true
|
||||
xj = index // 相交的点
|
||||
si = append(si, v...)
|
||||
si = append(si, s...)
|
||||
break
|
||||
}
|
||||
}
|
||||
if bfound {
|
||||
newMatrix = append(newMatrix[:pos], newMatrix[pos+1:]...)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, v := range s1 {
|
||||
for _, v1 := range v {
|
||||
mtmp[v1] = struct{}{}
|
||||
}
|
||||
}
|
||||
for _, v := range s2 {
|
||||
for _, v1 := range v {
|
||||
mtmp[v1] = struct{}{}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
func CheckInSlice(index int, sz [][]int) (m map[int]struct{}) {
|
||||
m = make(map[int]struct{})
|
||||
for _, v := range sz {
|
||||
b := false
|
||||
for _, vs2 := range v {
|
||||
if index == vs2 {
|
||||
b = true
|
||||
|
||||
for _, t := range v {
|
||||
m[t] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
if b {
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user