Files
mjhelper/bin/pattern-lookup/generatetable.go
T
2023-10-10 02:02:56 -07:00

151 lines
12 KiB
Go

package main
import (
"fmt"
pkg "mjhelper/pkg"
"github.com/mowshon/iterium"
)
func allFans() []pkg.Fan {
testFans := []pkg.Fan{
{Id: 1, Name: "大四喜", Pattern: pkg.PatternDivision{Ke: 4, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{38, 49, 62, 63}, Value: 88},
{Id: 2, Name: "大三元", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 88},
{Id: 3, Name: "绿一色", Pattern: pkg.PatternDivision{Ke: 4, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 88},
{Id: 4, Name: "九莲宝灯", Pattern: pkg.PatternDivision{Ke: 2, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 88},
{Id: 5, Name: "四杠", Pattern: pkg.PatternDivision{Ke: 4, Shun: 0, Dui: 1, Gang: 4}, ExcludeIds: []int{}, Value: 88},
{Id: 6, Name: "连七对", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 7, Gang: 0}, ExcludeIds: []int{}, Value: 88},
{Id: 7, Name: "十三幺", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 88},
{Id: 8, Name: "清幺九", Pattern: pkg.PatternDivision{Ke: 4, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 64},
{Id: 9, Name: "小四喜", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 64},
{Id: 10, Name: "小三元", Pattern: pkg.PatternDivision{Ke: 2, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 64},
{Id: 11, Name: "字一色", Pattern: pkg.PatternDivision{Ke: 4, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 64},
{Id: 12, Name: "四暗刻", Pattern: pkg.PatternDivision{Ke: 4, Shun: 0, Dui: 2, Gang: 0}, ExcludeIds: []int{}, Value: 64},
{Id: 13, Name: "一色双龙会", Pattern: pkg.PatternDivision{Ke: 0, Shun: 4, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 64},
{Id: 14, Name: "一色四同顺", Pattern: pkg.PatternDivision{Ke: 0, Shun: 4, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 48},
{Id: 15, Name: "一色四节高", Pattern: pkg.PatternDivision{Ke: 4, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 48},
{Id: 16, Name: "一色四步高", Pattern: pkg.PatternDivision{Ke: 0, Shun: 4, Dui: 2, Gang: 0}, ExcludeIds: []int{}, Value: 32},
{Id: 17, Name: "三杠", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 3}, ExcludeIds: []int{}, Value: 32},
{Id: 18, Name: "混幺九", Pattern: pkg.PatternDivision{Ke: 4, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 32},
{Id: 19, Name: "七对", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 7, Gang: 0}, ExcludeIds: []int{}, Value: 24},
{Id: 20, Name: "七星不靠", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 24},
{Id: 21, Name: "全双刻", Pattern: pkg.PatternDivision{Ke: 4, Shun: 0, Dui: 2, Gang: 0}, ExcludeIds: []int{}, Value: 24},
{Id: 22, Name: "清一色", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 24},
{Id: 23, Name: "一色三同顺", Pattern: pkg.PatternDivision{Ke: 0, Shun: 3, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 24},
{Id: 24, Name: "一色三节高", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 24},
{Id: 25, Name: "全大", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 24},
{Id: 26, Name: "全中", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 24},
{Id: 27, Name: "全小", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 24},
{Id: 28, Name: "清龙", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 16},
{Id: 29, Name: "三色双龙会", Pattern: pkg.PatternDivision{Ke: 4, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 16},
{Id: 30, Name: "一色三步高", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 16},
{Id: 31, Name: "全带五", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 16},
{Id: 32, Name: "三同刻", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 16},
{Id: 33, Name: "三暗刻", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 16},
{Id: 34, Name: "全不靠", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 12},
{Id: 35, Name: "组合龙", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 12},
{Id: 36, Name: "大于五", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 12},
{Id: 37, Name: "小于五", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 12},
{Id: 38, Name: "三风刻", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 12},
{Id: 39, Name: "花龙", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 8},
{Id: 40, Name: "推不倒", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 8},
{Id: 41, Name: "三色三同顺", Pattern: pkg.PatternDivision{Ke: 0, Shun: 3, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 8},
{Id: 42, Name: "三色三节高", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 8},
{Id: 43, Name: "无番和", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 8},
{Id: 44, Name: "妙手回春", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 8},
{Id: 45, Name: "海底捞月", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 8},
{Id: 46, Name: "杠上开花", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 1}, ExcludeIds: []int{}, Value: 8},
{Id: 47, Name: "抢杠和", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 8},
// 双暗杠 98版计6番,06版计8番
{Id: 48, Name: "双暗杠", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 2}, ExcludeIds: []int{}, Value: 6},
{Id: 49, Name: "碰碰和", Pattern: pkg.PatternDivision{Ke: 4, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 6},
{Id: 50, Name: "混一色", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 6},
{Id: 51, Name: "三色三步高", Pattern: pkg.PatternDivision{Ke: 0, Shun: 3, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 6},
{Id: 52, Name: "三色三节高", Pattern: pkg.PatternDivision{Ke: 3, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 6},
{Id: 53, Name: "五门齐", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 6},
{Id: 54, Name: "全求人", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 6},
// 明暗杠 06版计6番,存疑
{Id: 55, Name: "明暗杠", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 6},
{Id: 56, Name: "双箭刻", Pattern: pkg.PatternDivision{Ke: 2, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 6},
{Id: 57, Name: "全带幺", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 4},
{Id: 58, Name: "不求人", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 4},
{Id: 59, Name: "双明杠", Pattern: pkg.PatternDivision{Ke: 2, Shun: 0, Dui: 1, Gang: 2}, ExcludeIds: []int{}, Value: 4},
{Id: 60, Name: "和绝张", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 4},
{Id: 61, Name: "箭刻", Pattern: pkg.PatternDivision{Ke: 1, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 2},
{Id: 62, Name: "圈风刻", Pattern: pkg.PatternDivision{Ke: 1, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 2},
{Id: 63, Name: "门风刻", Pattern: pkg.PatternDivision{Ke: 1, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 2},
{Id: 64, Name: "门前清", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 2},
{Id: 65, Name: "平和", Pattern: pkg.PatternDivision{Ke: 0, Shun: 4, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 2},
{Id: 66, Name: "四归一", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 2},
{Id: 67, Name: "双同刻", Pattern: pkg.PatternDivision{Ke: 2, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 2},
{Id: 68, Name: "双暗刻", Pattern: pkg.PatternDivision{Ke: 2, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 2},
{Id: 69, Name: "暗杠", Pattern: pkg.PatternDivision{Ke: 1, Shun: 0, Dui: 1, Gang: 1}, ExcludeIds: []int{}, Value: 2},
{Id: 70, Name: "断幺", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 2},
{Id: 71, Name: "一般高", Pattern: pkg.PatternDivision{Ke: 0, Shun: 2, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 1},
{Id: 72, Name: "喜相逢", Pattern: pkg.PatternDivision{Ke: 0, Shun: 2, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 1},
{Id: 73, Name: "连六", Pattern: pkg.PatternDivision{Ke: 0, Shun: 2, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 1},
{Id: 74, Name: "老少副", Pattern: pkg.PatternDivision{Ke: 0, Shun: 2, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 1},
{Id: 75, Name: "幺九刻", Pattern: pkg.PatternDivision{Ke: 1, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 1},
{Id: 76, Name: "明杠", Pattern: pkg.PatternDivision{Ke: 1, Shun: 0, Dui: 0, Gang: 1}, ExcludeIds: []int{}, Value: 1},
{Id: 77, Name: "缺一门", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 1},
{Id: 78, Name: "无字", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 1},
{Id: 79, Name: "边张", Pattern: pkg.PatternDivision{Ke: 0, Shun: 1, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 1},
{Id: 80, Name: "坎张", Pattern: pkg.PatternDivision{Ke: 0, Shun: 1, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 1},
{Id: 81, Name: "单钓将", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 1, Gang: 0}, ExcludeIds: []int{}, Value: 1},
{Id: 82, Name: "自摸", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 1},
{Id: 82, Name: "花牌", Pattern: pkg.PatternDivision{Ke: 0, Shun: 0, Dui: 0, Gang: 0}, ExcludeIds: []int{}, Value: 1},
}
return testFans
}
func AllFansToFile() {
allFans := allFans()
pkg.FansToFile(allFans, "test.json")
}
func GenerateFan(fan pkg.Fan) {
}
func GenerateKe() {
}
func main() {
result := iterium.Combinations([]string{
"1W", "2W", "3W", "4W", "5W", "6W", "7W", "8W", "9W",
"1T", "2T", "3T", "4T", "5T", "6T", "7T", "8T", "9T",
"1B", "2B", "3B", "4B", "5B", "6B", "7B", "8B", "9B",
"DO", "XI", "NA", "BE", "ZH", "FA", "BA",
"1W", "2W", "3W", "4W", "5W", "6W", "7W", "8W", "9W",
"1T", "2T", "3T", "4T", "5T", "6T", "7T", "8T", "9T",
"1B", "2B", "3B", "4B", "5B", "6B", "7B", "8B", "9B",
"DO", "XI", "NA", "BE", "ZH", "FA", "BA",
"1W", "2W", "3W", "4W", "5W", "6W", "7W", "8W", "9W",
"1T", "2T", "3T", "4T", "5T", "6T", "7T", "8T", "9T",
"1B", "2B", "3B", "4B", "5B", "6B", "7B", "8B", "9B",
"DO", "XI", "NA", "BE", "ZH", "FA", "BA",
"1W", "2W", "3W", "4W", "5W", "6W", "7W", "8W", "9W",
"1T", "2T", "3T", "4T", "5T", "6T", "7T", "8T", "9T",
"1B", "2B", "3B", "4B", "5B", "6B", "7B", "8B", "9B",
"DO", "XI", "NA", "BE", "ZH", "FA", "BA"}, 14)
fmt.Println(result.Count())
result2_1 := iterium.CombinationsWithReplacement([]string{
"1TS", "2TS", "3TS", "4TS", "5TS", "6TS", "7TS",
"1TK", "2TK", "3TK", "4TK", "5TK", "6TK", "7TK", "8TK", "9TK",
"1TS", "2TS", "3TS", "4TS", "5TS", "6TS", "7TS",
"1TK", "2TK", "3TK", "4TK", "5TK", "6TK", "7TK", "8TK", "9TK",
"1TS", "2TS", "3TS", "4TS", "5TS", "6TS", "7TS",
"1TK", "2TK", "3TK", "4TK", "5TK", "6TK", "7TK", "8TK", "9TK",
"DOK", "XIK", "NAK", "BEK", "ZHK", "FAK", "BAK"}, 4)
result2_2 := iterium.Combinations([]string{
"1W", "2W", "3W", "4W", "5W", "6W", "7W", "8W", "9W",
"1T", "2T", "3T", "4T", "5T", "6T", "7T", "8T", "9T",
"1B", "2B", "3B", "4B", "5B", "6B", "7B", "8B", "9B",
"DO", "XI", "NA", "BE", "ZH", "FA", "BA"}, 1)
fmt.Println(result2_1.Count() * result2_2.Count())
for i := range result2_1.Chan() {
fmt.Println(i)
}
}