Merge branch 'develop' into sk

This commit is contained in:
sk 2024-12-10 10:40:27 +08:00
commit 43c3d3571b
2 changed files with 127 additions and 34 deletions

View File

@ -165,29 +165,6 @@ func TestLogic_CompareHead(t *testing.T) {
l.LaiZi = []int{52, 53}
data := [][]int{
// 比花色的
//{1, 27, 49, 50, 43, 42, 1},
//{47, 20, 23, 29, 36, 42, -1},
//{0, 2, 18, 31, 21, 29, -1},
//{45, 7, 18, 13, 15, 29, 1},
//{14, 4, 46, 9, 1, 11, -1},
//{7, 3, 24, 43, 50, 44, 1},
//{5, 4, 31, 15, 33, 14, 1},
//{21, 21, 32, 31, 38, 28, 1},
//{47, 38, 49, 30, 34, 23, 1},
//{14, 10, 16, 29, 30, 35, 1},
////
//{0, 52, 8, 7, 8, 9, 1},
//{0, 52, 52, 7, 8, 9, 1},
//{0, 52, 52, 7, 51, 53, 1},
//{0, 52, 51, 7, 51, 53, -1},
//{8, 52, 51, 7, 51, 53, 1},
//{7, 52, 51, 7, 51, 53, 0},
//{7, 9, 22, 22, 7, 53, -1},
//{7, 48, 22, 22, 7, 53, 1},
//{7, 48, 22, 22, 6, 53, 1},
//{7, 48, 22, 22, 20, 53, -1},
// 不比花色
{1, 27, 49, 50, 43, 42, 1},
{47, 20, 23, 29, 36, 42, -1},
{0, 2, 18, 31, 21, 29, -1},
@ -205,10 +182,33 @@ func TestLogic_CompareHead(t *testing.T) {
{0, 52, 51, 7, 51, 53, -1},
{8, 52, 51, 7, 51, 53, 1},
{7, 52, 51, 7, 51, 53, 0},
{7, 9, 22, 22, 7, 53, 1},
{7, 9, 22, 22, 7, 53, -1},
{7, 48, 22, 22, 7, 53, 1},
{7, 48, 22, 22, 6, 53, 1},
{7, 48, 22, 22, 20, 53, 1},
{7, 48, 22, 22, 20, 53, -1},
// 不比花色
//{1, 27, 49, 50, 43, 42, 1},
//{47, 20, 23, 29, 36, 42, -1},
//{0, 2, 18, 31, 21, 29, -1},
//{45, 7, 18, 13, 15, 29, 1},
//{14, 4, 46, 9, 1, 11, -1},
//{7, 3, 24, 43, 50, 44, 1},
//{5, 4, 31, 15, 33, 14, 1},
//{21, 21, 32, 31, 38, 28, 1},
//{47, 38, 49, 30, 34, 23, 1},
//{14, 10, 16, 29, 30, 35, 1},
////
//{0, 52, 8, 7, 8, 9, 1},
//{0, 52, 52, 7, 8, 9, 1},
//{0, 52, 52, 7, 51, 53, 1},
//{0, 52, 51, 7, 51, 53, -1},
//{8, 52, 51, 7, 51, 53, 1},
//{7, 52, 51, 7, 51, 53, 0},
//{7, 9, 22, 22, 7, 53, 1},
//{7, 48, 22, 22, 7, 53, 1},
//{7, 48, 22, 22, 6, 53, 1},
//{7, 48, 22, 22, 20, 53, 1},
}
for _, v := range data {
@ -233,6 +233,33 @@ func TestLogic_CompareFive(t *testing.T) {
l := new(Logic)
l.LaiZi = []int{52, 53}
data := [][]int{
// 不比花色
//{5, 23, 10, 6, 1, 45, 41, 20, 1, 13, 1},
//{29, 31, 26, 1, 39, 31, 44, 17, 9, 34, -1},
//{24, 26, 9, 10, 0, 16, 30, 7, 37, 3, -1},
//{31, 30, 11, 33, 7, 18, 1, 36, 9, 3, 1},
//// 牌型不同
//{2, 15, 28, 0, 6, 12, 0, 1, 2, 3, -1},
//// 点数不同
//{2, 15, 28, 0, 6, 2, 15, 28, 0, 6, 0},
//{2, 15, 28, 0, 6, 2, 15, 28, 0, 7, -1},
//{0, 13, 4, 17, 6, 0, 13, 4, 17, 5, 1},
//{0, 13, 5, 18, 6, 0, 13, 4, 17, 6, 1},
//{1, 14, 4, 17, 6, 0, 13, 4, 17, 5, 1},
//// 花色不同
//{2, 15, 28, 0, 6, 2, 15, 28, 0, 19, 0},
//{41, 15, 28, 0, 6, 2, 15, 28, 0, 6, 0},
//{2, 15, 28, 0, 6, 2, 15, 28, 13, 6, 0},
//{3, 4, 5, 6, 52, 3, 52, 5, 6, 53, 1},
//{3, 17, 5, 6, 52, 3, 52, 5, 6, 53, -1},
//{3, 4, 5, 6, 7, 16, 52, 18, 19, 53, 1},
//{3, 52, 5, 6, 20, 3, 17, 18, 19, 53, 0},
//{3, 52, 5, 6, 46, 3, 17, 18, 19, 53, 0},
//// 癞子数不同
//{52, 52, 7, 20, 12, 52, 7, 20, 33, 25, -1},
//{52, 33, 7, 20, 12, 52, 7, 20, 33, 25, 0},
// 比花色
{5, 23, 10, 6, 1, 45, 41, 20, 1, 13, 1},
{29, 31, 26, 1, 39, 31, 44, 17, 9, 34, -1},
{24, 26, 9, 10, 0, 16, 30, 7, 37, 3, -1},
@ -246,17 +273,17 @@ func TestLogic_CompareFive(t *testing.T) {
{0, 13, 5, 18, 6, 0, 13, 4, 17, 6, 1},
{1, 14, 4, 17, 6, 0, 13, 4, 17, 5, 1},
// 花色不同
{2, 15, 28, 0, 6, 2, 15, 28, 0, 19, 0},
{41, 15, 28, 0, 6, 2, 15, 28, 0, 6, 0},
{2, 15, 28, 0, 6, 2, 15, 28, 13, 6, 0},
{2, 15, 28, 0, 6, 2, 15, 28, 0, 19, -1},
{41, 15, 28, 0, 6, 2, 15, 28, 0, 6, 1},
{2, 15, 28, 0, 6, 2, 15, 28, 13, 6, -1},
{3, 4, 5, 6, 52, 3, 52, 5, 6, 53, 1},
{3, 17, 5, 6, 52, 3, 52, 5, 6, 53, -1},
{3, 4, 5, 6, 7, 16, 52, 18, 19, 53, 1},
{3, 52, 5, 6, 20, 3, 17, 18, 19, 53, 0},
{3, 52, 5, 6, 46, 3, 17, 18, 19, 53, 0},
{3, 4, 5, 6, 7, 16, 52, 18, 19, 53, -1},
{3, 52, 5, 6, 20, 3, 17, 18, 19, 53, -1},
{3, 52, 5, 6, 46, 3, 17, 18, 19, 53, -1},
// 癞子数不同
{52, 52, 7, 20, 12, 52, 7, 20, 33, 25, -1},
{52, 33, 7, 20, 12, 52, 7, 20, 33, 25, 0},
{52, 33, 7, 20, 12, 52, 7, 20, 33, 25, -1},
}
for _, v := range data {
@ -279,3 +306,69 @@ func TestLogic_CompareFive(t *testing.T) {
func TestLogic_IsDP(t *testing.T) {
}
func TestStatisticsPokerType(t *testing.T) {
poker := NewPokers(1, false)
if poker == nil {
return
}
logic := new(Logic)
loop := 2000000
allTypeData := make([]int, PokersTypeMax)
specialAllTypeData := make([]int, SpecialTypeMax)
totalCnt := 0
stotalCnt := 0
for i := 0; i < loop; i++ {
poker.Init()
cardsArr := make([][13]int, poker.N*4)
//cardsGroup := make([]map[int]*Group, poker.N*4)
for k := range cardsArr {
cardsArr[k] = poker.Get13Crads()
specialType := logic.GetSpecialType(cardsArr[k])
specialAllTypeData[specialType]++
stotalCnt++
//cardsGroup[k] = logic.Suggest(cardsArr[k])
//
//cardsO := GetMaxCard(cardsGroup[k])
//
//headType := logic.GetType(cardsO.Head[:])
//midType := logic.GetType(cardsO.Mid[:])
//endType := logic.GetType(cardsO.End[:])
//
//allTypeData[headType]++
//totalCnt++
//allTypeData[midType]++
//totalCnt++
//allTypeData[endType]++
//totalCnt++
//t.Logf("头牌类型:%v 中牌类型: %v 尾牌类型: %v \n", PokersTypeName[headType], PokersTypeName[midType], PokersTypeName[endType])
}
}
t.Logf("共%v次循环", loop)
//ccc := 0.0
for pType, count := range allTypeData {
percent := (float64(count) / float64(totalCnt)) * 100
// t.Logf("牌类型:%v 占百分比: %.2f \n", PokersTypeName[pType], percent)
t.Logf("%v %.2f\n", PokersTypeName[pType], percent)
//ccc += percent
}
t.Logf("特殊牌型共%v次循环", loop)
//ccc := 0.0
for pType, count := range specialAllTypeData {
percent := (float64(count) / float64(stotalCnt)) * 100
// t.Logf("牌类型:%v 占百分比: %.2f \n", PokersTypeName[pType], percent)
t.Logf("%v %.10f\n", SpecialTypeName[pType], percent)
//ccc += percent
}
}

View File

@ -394,14 +394,14 @@ var data = []byte{
0x01, //11 强抓力电压占用位
0x80, //12 中抓力电压
0x01, //13 中抓力电压占用位
0x78, //14 弱抓力电压
0x64, //14 弱抓力电压
0x00, //15 弱抓力电压占用位
0xE0, //16 中奖电压
0x01, //17 中奖电压占用位
0xC8, //18 强抓力时间
0x00, //19 强抓力时间占用位
0x14, //20 放抓时间
0x0A, //20 放抓时间
0x32, //21 前后速度
0x32, //22 左右速度
0x50, //23 上下速度