Esempio n. 1
0
def benchmark_hpoo():
    playerWins = Array[Double]([1.0]*9)
    opponentWins = Array[Double]([0.0]*9)
    Pocket = "ac as"
    repeat = 100
    
    Board = "4d 5d 6c 7s 8d"
    start_time = time.time()
    for i in range(repeat):
        Hand.HandPlayerOpponentOdds(Pocket, Board, playerWins, opponentWins)
    average = (time.time()-start_time)/float(repeat)
    print("average time (5+2 cards): ", average*1000, "ms")
    
    Board = "4d 5d 6c 7s"
    start_time = time.time()
    for i in range(repeat):
        Hand.HandPlayerOpponentOdds(Pocket, Board, playerWins, opponentWins)
    average = (time.time()-start_time)/float(repeat)
    print("average time (4+2 cards): ", average*1000, "ms")
    
    Board = "4d 5d 6c"
    start_time = time.time()
    for i in range(repeat):
        Hand.HandPlayerOpponentOdds(Pocket, Board, playerWins, opponentWins)
    average = (time.time()-start_time)/float(repeat)
    print("average time (3+2 cards): ", average*1000, "ms")
    
    repeat = 10000
    Board = ""
    start_time = time.time()
    for i in range(repeat):
        Hand.HandPlayerOpponentOdds(Pocket, Board, playerWins, opponentWins)
    average = (time.time()-start_time)/float(repeat)
    print("average time (0+2 cards): ", average*1000, "ms")
Esempio n. 2
0
def test_hpoo2():
    playerWins = Array[Double]([1.0]*9)
    opponentWins = Array[Double]([0.0]*9)
    Pocket = "kc ks"
    Board = "8h 6c 4h"

    print("===============================================================================")
    for Pocket in ["kc ks", "7h 9h"]:
        Hand.HandPlayerOpponentOdds(Pocket, Board, playerWins, opponentWins)
        print("Pocket:", Pocket)
        print("Board:", Board)
        #print(list(playerWins))
        print("playerWins:", sum(playerWins))
        print("High Card: %f%%"%      ( playerWins[int(Hand.HandTypes.HighCard)]*100.0))
        print("Pair: %f%%"%           ( playerWins[int(Hand.HandTypes.Pair)]*100.0))
        print("Two Pair: %f%%"%       ( playerWins[int(Hand.HandTypes.TwoPair)]*100.0))
        print("Three of Kind: %f%%"%  ( playerWins[int(Hand.HandTypes.Trips)]*100.0))
        print("Straight: %f%%"%       ( playerWins[int(Hand.HandTypes.Straight)]*100.0))
        print("Flush: %f%%"%          ( playerWins[int(Hand.HandTypes.Flush)]*100.0))
        print("Fullhouse: %f%%"%      ( playerWins[int(Hand.HandTypes.FullHouse)]*100.0))
        print("Four of a Kind: %f%%"% ( playerWins[int(Hand.HandTypes.FourOfAKind)]*100.0))
        print("Straight Flush: %f%%"% ( playerWins[int(Hand.HandTypes.StraightFlush)]*100.0))
        print("\n")
        #print(list(opponentWins))
        print("opponentWins:", sum(opponentWins))
        print("High Card: %f%%"%      ( opponentWins[int(Hand.HandTypes.HighCard)]*100.0))
        print("Pair: %f%%"%           ( opponentWins[int(Hand.HandTypes.Pair)]*100.0))
        print("Two Pair: %f%%"%       ( opponentWins[int(Hand.HandTypes.TwoPair)]*100.0))
        print("Three of Kind: %f%%"%  ( opponentWins[int(Hand.HandTypes.Trips)]*100.0))
        print("Straight: %f%%"%       ( opponentWins[int(Hand.HandTypes.Straight)]*100.0))
        print("Flush: %f%%"%          ( opponentWins[int(Hand.HandTypes.Flush)]*100.0))
        print("Fullhouse: %f%%"%      ( opponentWins[int(Hand.HandTypes.FullHouse)]*100.0))
        print("Four of a Kind: %f%%"% ( opponentWins[int(Hand.HandTypes.FourOfAKind)]*100.0))
        print("Straight Flush: %f%%"% ( opponentWins[int(Hand.HandTypes.StraightFlush)]*100.0))
        print("===============================================================================\n")
Esempio n. 3
0
def CalcWinrate_hpoo(Pocket, Board):
    playerWins = Array[Double]([1.0]*9)
    opponentWins = Array[Double]([0.0]*9)
    Hand.HandPlayerOpponentOdds(Pocket, Board, playerWins, opponentWins)
    return sum(playerWins)
Esempio n. 4
0
 def calcHandOdds(self, pocket, board):
     playerWins = Array[Double]([1.0] * 9)
     opponentWins = Array[Double]([0.0] * 9)
     Hand.HandPlayerOpponentOdds(pocket, board, playerWins, opponentWins)
     return float(sum(playerWins))