递归消除特殊元素

This commit is contained in:
meixiongfeng 2023-11-06 16:12:56 +08:00
parent e3509b4023
commit 5629f5439b

View File

@ -1125,13 +1125,19 @@ func (this *MapData) SpecialElem(id int, s int32) (x map[int]struct{}) {
}
}
// for k := range x {
// if this.Plat[k].Special != 0 {
// for key := range this.SpecialElem(k, this.Plat[k].Special) { // 递归调用
// x[key] = struct{}{}
// }
// }
// }
for k := range x {
if k == id {
continue
}
sp := this.Plat[k].Special
if sp != 0 {
this.Plat[k].Special = 0
ids := this.SpecialElem(k, sp) // 递归调用
for key := range ids {
x[key] = struct{}{}
}
}
}
return
}