Ejemplo n.º 1
0
// Exhaustive hand equity calculation.
func handEquityE(hole, board, deck []int32) float64 {
	var sum, count float64
	bLen := int32(len(board))
	board = append(board, make([]int32, 5-bLen)...)
	oHole := make([]int32, 2)
	c1 := util.Comb(deck, 2)
	for loop1 := true; loop1; {
		loop1 = c1(oHole)
		c2 := util.Comb(cards.Minus(deck, oHole), 5-bLen)
		for loop2 := true; loop2; {
			loop2 = c2(board[bLen:])
			sum += EvalHands(board, hole, oHole)
			count++
		}
	}
	return sum / count
}
Ejemplo n.º 2
0
// 2 cards =     169 hands
// 5 cards = 134,459 hands
func TestIso(_ *testing.T) {
	colex := newColex()
	canonical := newCanonical()
	var count int
	t0 := time.Now()
	hands := make([]hand, binomial(52, 5))
	hand := make([]int32, 5)
	deck := NewDeck()
	c1 := util.Comb(deck, 5)
	for loop := true; loop; {
		loop = c1(hand)
		hands[colex(canonical(hand))].count++
	}
	t1 := time.Now()
	for _, v := range hands {
		if v.count != 0 {
			count++
		}
	}
	fmt.Println(t1.Sub(t0), count)
}