十三张比牌包含花色
This commit is contained in:
parent
52b4994de3
commit
690a5f1a08
|
@ -245,36 +245,35 @@ func (l *Logic) SortMidAndEnd(cards *Group) *Group {
|
|||
// 不可能
|
||||
} else if n == 0 { // 逻辑点数相同
|
||||
// 比花色,比三条就行了
|
||||
//n, index1, index2 := IndexCompareColorByLogic(c1, c2)
|
||||
n = 0
|
||||
n, index1, index2 := IndexCompareColorByLogic(c1, c2)
|
||||
if n == 1 {
|
||||
// 花色交换,结束
|
||||
//if index1 >= 0 && index2 >= 0 {
|
||||
// for k, v := range cards.Head {
|
||||
// if v == r1[index1] {
|
||||
// cards.Head[k] = -1
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// for k, v := range cards.Mid {
|
||||
// if v == r2[index2] {
|
||||
// cards.Mid[k] = -1
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// for k, v := range cards.Head {
|
||||
// if v == -1 && r2[index2] >= 0 {
|
||||
// cards.Head[k] = r2[index2]
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// for k, v := range cards.Mid {
|
||||
// if v == -1 && r1[index1] >= 0 {
|
||||
// cards.Mid[k] = r1[index1]
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
if index1 >= 0 && index2 >= 0 {
|
||||
for k, v := range cards.Head {
|
||||
if v == r1[index1] {
|
||||
cards.Head[k] = -1
|
||||
break
|
||||
}
|
||||
}
|
||||
for k, v := range cards.Mid {
|
||||
if v == r2[index2] {
|
||||
cards.Mid[k] = -1
|
||||
break
|
||||
}
|
||||
}
|
||||
for k, v := range cards.Head {
|
||||
if v == -1 && r2[index2] >= 0 {
|
||||
cards.Head[k] = r2[index2]
|
||||
break
|
||||
}
|
||||
}
|
||||
for k, v := range cards.Mid {
|
||||
if v == -1 && r1[index1] >= 0 {
|
||||
cards.Mid[k] = r1[index1]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if n == 0 {
|
||||
// 比癞子数
|
||||
if l.LaiZiCount(r1) < l.LaiZiCount(r2) {
|
||||
|
@ -381,13 +380,12 @@ func (l *Logic) SortMidAndEnd(cards *Group) *Group {
|
|||
}
|
||||
} else if n == 0 { // 点数相同
|
||||
// 比花色
|
||||
//n, index1, index2 := IndexCompareColorByLogic(nHead[:], nMid[:])
|
||||
n = 0
|
||||
n, index1, index2 := IndexCompareColorByLogic(nHead[:], nMid[:])
|
||||
if n == 1 {
|
||||
// 交换花色,结束
|
||||
//if index1 >= 0 && index2 >= 0 {
|
||||
// cards.Head[index1], cards.Mid[index2] = cards.Mid[index2], cards.Head[index1]
|
||||
//}
|
||||
if index1 >= 0 && index2 >= 0 {
|
||||
cards.Head[index1], cards.Mid[index2] = cards.Mid[index2], cards.Head[index1]
|
||||
}
|
||||
} else if n == 0 {
|
||||
// 比癞子多少
|
||||
if l.LaiZiCount(r1) < l.LaiZiCount(r2) {
|
||||
|
@ -426,13 +424,13 @@ func (l *Logic) SortMidAndEnd(cards *Group) *Group {
|
|||
}
|
||||
} else if n == 0 {
|
||||
// 点数相同比花色
|
||||
//n, index1, index2 := IndexCompareColorByLogic(cards.Head[:], cards.Mid[:])
|
||||
//if n == 1 {
|
||||
// // 交换最大花色的牌
|
||||
// if index1 >= 0 && index2 >= 0 {
|
||||
// cards.Head[index1], cards.Mid[index2] = cards.Mid[index2], cards.Head[index1]
|
||||
// }
|
||||
//}
|
||||
n, index1, index2 := IndexCompareColorByLogic(cards.Head[:], cards.Mid[:])
|
||||
if n == 1 {
|
||||
// 交换最大花色的牌
|
||||
if index1 >= 0 && index2 >= 0 {
|
||||
cards.Head[index1], cards.Mid[index2] = cards.Mid[index2], cards.Head[index1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -834,10 +832,10 @@ func (l *Logic) CompareHead(c, cs [3]int) int {
|
|||
return n
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c1, c2)
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n = CompareColorByLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
// 比癞子数
|
||||
z1, z2 := l.LaiZiCount(c[:]), l.LaiZiCount(cs[:])
|
||||
if z1 < z2 {
|
||||
|
@ -869,10 +867,10 @@ func (l *Logic) CompareFive(c, cs [5]int) int {
|
|||
return n
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c1, c2)
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n = CompareColorByLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
|
||||
case PokersTypeStraightFlush:
|
||||
_, c1 := FindMaxSameColorFlush(c[:], l.LaiZi)
|
||||
|
@ -888,20 +886,20 @@ func (l *Logic) CompareFive(c, cs [5]int) int {
|
|||
}
|
||||
if ch1 && ch2 {
|
||||
// 比花色
|
||||
//n := CompareColorByLogic(c1, c2)
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n := CompareColorByLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
} else if !ch1 && !ch2 {
|
||||
n := CompareLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c1, c2)
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n = CompareColorByLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
} else {
|
||||
if ch1 {
|
||||
return -1
|
||||
|
@ -928,10 +926,10 @@ func (l *Logic) CompareFive(c, cs [5]int) int {
|
|||
return n
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c1, c2)
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n = CompareColorByLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
|
||||
case PokersTypeFullHouse:
|
||||
_, c1 := FindMaxGourdCards(c[:], l.LaiZi)
|
||||
|
@ -946,10 +944,10 @@ func (l *Logic) CompareFive(c, cs [5]int) int {
|
|||
return n
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c1, c2)
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n = CompareColorByLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
|
||||
case PokersTypeFlush:
|
||||
_, c1 := FindMaxSameColors(c[:], l.LaiZi)
|
||||
|
@ -960,10 +958,10 @@ func (l *Logic) CompareFive(c, cs [5]int) int {
|
|||
return n
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c1, c2)
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n = CompareColorByLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
|
||||
case PokersTypeStraight:
|
||||
_, c1 := FindMaxFlush(c[:], l.LaiZi)
|
||||
|
@ -979,20 +977,20 @@ func (l *Logic) CompareFive(c, cs [5]int) int {
|
|||
}
|
||||
if ch1 && ch2 {
|
||||
// 比花色
|
||||
//n := CompareColorByLogic(c1, c2)
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n := CompareColorByLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
} else if !ch1 && !ch2 {
|
||||
n := CompareLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c1, c2)
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n = CompareColorByLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
} else {
|
||||
if ch1 {
|
||||
return -1
|
||||
|
@ -1019,10 +1017,10 @@ func (l *Logic) CompareFive(c, cs [5]int) int {
|
|||
return n
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c1, c2)
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n = CompareColorByLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
|
||||
case PokersTypeTwoPairs:
|
||||
r1, c1 := FindMaxPairs(c[:], l.LaiZi)
|
||||
|
@ -1053,10 +1051,10 @@ func (l *Logic) CompareFive(c, cs [5]int) int {
|
|||
return n
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c1, c2)
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n = CompareColorByLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
|
||||
case PokersTypePair:
|
||||
r1, c1 := FindMaxPairs(c[:], l.LaiZi)
|
||||
|
@ -1077,10 +1075,10 @@ func (l *Logic) CompareFive(c, cs [5]int) int {
|
|||
return n
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c1, c2)
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n = CompareColorByLogic(c1, c2)
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
|
||||
case PokersTypeOne:
|
||||
// 乌龙不会有癞子
|
||||
|
@ -1090,10 +1088,10 @@ func (l *Logic) CompareFive(c, cs [5]int) int {
|
|||
return n
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c[:], cs[:])
|
||||
//if n != 0 {
|
||||
// return n
|
||||
//}
|
||||
n = CompareColorByLogic(c[:], cs[:])
|
||||
if n != 0 {
|
||||
return n
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -1136,10 +1134,10 @@ func (l *Logic) IsDP(head [3]int, mid, end [5]int) bool {
|
|||
return n == 1
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c1, changeMid)
|
||||
//if n != 0 {
|
||||
// return n == 1
|
||||
//}
|
||||
n = CompareColorByLogic(c1, changeMid)
|
||||
if n != 0 {
|
||||
return n == 1
|
||||
}
|
||||
// 比癞子数
|
||||
z1, z2 := l.LaiZiCount(r1), l.LaiZiCount(r2)
|
||||
if z1 < z2 {
|
||||
|
@ -1164,10 +1162,10 @@ func (l *Logic) IsDP(head [3]int, mid, end [5]int) bool {
|
|||
return n == 1
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(c1, changeMid)
|
||||
//if n != 0 {
|
||||
// return n == 1
|
||||
//}
|
||||
n = CompareColorByLogic(c1, changeMid)
|
||||
if n != 0 {
|
||||
return n == 1
|
||||
}
|
||||
// 比癞子数
|
||||
z1, z2 := l.LaiZiCount(r1), l.LaiZiCount(r2)
|
||||
if z1 < z2 {
|
||||
|
@ -1184,10 +1182,10 @@ func (l *Logic) IsDP(head [3]int, mid, end [5]int) bool {
|
|||
return n == 1
|
||||
}
|
||||
// 比花色
|
||||
//n = CompareColorByLogic(head[:], mid[:])
|
||||
//if n != 0 {
|
||||
// return n == 1
|
||||
//}
|
||||
n = CompareColorByLogic(head[:], mid[:])
|
||||
if n != 0 {
|
||||
return n == 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue