2022-01-13 20:12:32 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
2022-01-16 09:55:32 +08:00
|
|
|
// dna 的整合
|
|
|
|
// comb of dna
|
2022-01-14 17:20:42 +08:00
|
|
|
func fas_mix(sum_nex []dna, sum_charset []charset) (map[string][]string, int, int) {
|
2022-01-16 09:55:32 +08:00
|
|
|
|
2022-01-13 20:12:32 +08:00
|
|
|
ntax := 0
|
|
|
|
nchar := sum_charset[len(sum_charset)-1].To
|
2022-01-16 09:55:32 +08:00
|
|
|
|
2022-01-13 20:12:32 +08:00
|
|
|
sum_dna := make(map[string][]string)
|
2022-01-16 09:55:32 +08:00
|
|
|
|
2022-01-13 20:12:32 +08:00
|
|
|
for _, v := range sum_nex {
|
2022-01-14 17:20:42 +08:00
|
|
|
for k1 := range v.min {
|
2022-01-13 20:12:32 +08:00
|
|
|
_, has := sum_dna[k1]
|
|
|
|
if !has {
|
|
|
|
sum_dna[k1] = make([]string, len(sum_charset))
|
|
|
|
ntax++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for k, v := range sum_nex {
|
2022-01-14 17:20:42 +08:00
|
|
|
for _, v1 := range v.min {
|
2022-01-13 20:12:32 +08:00
|
|
|
for k2 := range sum_dna {
|
2022-01-14 17:20:42 +08:00
|
|
|
if _, ok := v.min[k2]; ok {
|
2022-01-13 20:12:32 +08:00
|
|
|
sum_dna[k2][k] = v1
|
|
|
|
} else {
|
|
|
|
sum_dna[k2][k] = strings.Repeat("?", v.count)
|
2022-01-16 09:55:32 +08:00
|
|
|
// 之前就没写错吗?已修复
|
2022-01-13 20:12:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// fmt.Println(sum_dna)
|
|
|
|
return sum_dna, ntax, nchar
|
|
|
|
}
|