Пример #1
0
func TestHEerr(_ *testing.T) {
	error := 0.0
	perror := 0.0
	for i := 0; i < 1000; i++ {
		d := cards.NewDeck()
		sample(d, 7, 0)
		df := cards.ItoS(d)
		exp := HandEquity(df[:2], df[2:7], 0)
		act := HandEquity(df[:2], df[2:7], 1000)
		pact := HandEquityP(df[:2], df[2:7], 1000)
		error += math.Abs(exp - act)
		perror += math.Abs(exp - pact)
	}
	fmt.Println(error / 1000)
	fmt.Println(perror / 1000)
}
Пример #2
0
// Get ready to do the hand equity calculations. Returns hand, board, deck.
func handEquityInit(sHand, sBoard []string) ([]int32, []int32, []int32) {
	hole := cards.StoI(sHand)
	board := cards.StoI(sBoard)
	deck := cards.NewDeck(append(hole, board...)...)
	return hole, board, deck
}