Example #1
0
def calculateOddsWithGame(game, playerNum):
	tempCard = Card(1,2)
	myCards = game.players[playerNum].cards
	opCards = game.players[not playerNum].cards
	
	args = [tempCard.getCardOfNumA(myCard.num)+tempCard.getCharOfSuit(myCard.suit) for myCard in myCards]
	args += [tempCard.getCardOfNumA(myCard.num)+tempCard.getCharOfSuit(myCard.suit) for myCard in opCards]
	args+=["--"]
	args += [tableCards.getCardOfNumA(tableCards.num)+tableCards.getCharOfSuit(tableCards.suit) for tableCards in game.table]
	return [float(num) for num in (check_output(["pokenum.exe", "-h", "-t"] + args).split()[2:])]
Example #2
0
def calculateOdds(player1, player2, stage):
	tempCard = Card(1,2)
	#print player2.status.vec_cards
	#print player1.status.vec_cards
	myCards = [tempCard.num_to_card(num) for num in all_indices(1, player1.status.vec_cards[0])]
	#myCards = Card.num_to_card(self.status.vec_cards[0])
	opCards = [tempCard.num_to_card(num) for num in all_indices(1, player2.status.vec_cards[0])]
	args = [tempCard.getCardOfNumA(myCard.num)+tempCard.getCharOfSuit(myCard.suit) for myCard in myCards]
	args += [tempCard.getCardOfNumA(myCard.num)+tempCard.getCharOfSuit(myCard.suit) for myCard in opCards]
	args+=["--"]
	if stage>=1:
		flopCards = [tempCard.num_to_card(num) for num in all_indices(1, player1.status.vec_cards[1])]
		args += [turnCard.getCardOfNumA(turnCard.num)+turnCard.getCharOfSuit(turnCard.suit) for turnCard in flopCards]
	if stage>=2:
		turnCards = [tempCard.num_to_card(num) for num in all_indices(1, player1.status.vec_cards[2])]
		args += [turnCard.getCardOfNumA(turnCard.num)+turnCard.getCharOfSuit(turnCard.suit) for turnCard in turnCards]
	if stage>=3: #should be just one 
		riverCards = [tempCard.num_to_card(num) for num in all_indices(1, player1.status.vec_cards[3])]
		args += [turnCard.getCardOfNumA(turnCard.num)+turnCard.getCharOfSuit(turnCard.suit) for turnCard in riverCards]
	#print check_output(["pokenum.exe", "-h"] + args)
	return [float(num) for num in (check_output(["pokenum.exe", "-h", "-t"] + args).split()[2:])]
Example #3
0
def calculateOddsWithGame(game, playerNum):
    tempCard = Card(1, 2)
    myCards = game.players[playerNum].cards
    opCards = game.players[not playerNum].cards

    args = [
        tempCard.getCardOfNumA(myCard.num) +
        tempCard.getCharOfSuit(myCard.suit) for myCard in myCards
    ]
    args += [
        tempCard.getCardOfNumA(myCard.num) +
        tempCard.getCharOfSuit(myCard.suit) for myCard in opCards
    ]
    args += ["--"]
    args += [
        tableCards.getCardOfNumA(tableCards.num) +
        tableCards.getCharOfSuit(tableCards.suit) for tableCards in game.table
    ]
    return [
        float(num) for num in (check_output(["pokenum.exe", "-h", "-t"] +
                                            args).split()[2:])
    ]
Example #4
0
def calculateOdds(player1, player2, stage):
    tempCard = Card(1, 2)
    #print player2.status.vec_cards
    #print player1.status.vec_cards
    myCards = [
        tempCard.num_to_card(num)
        for num in all_indices(1, player1.status.vec_cards[0])
    ]
    #myCards = Card.num_to_card(self.status.vec_cards[0])
    opCards = [
        tempCard.num_to_card(num)
        for num in all_indices(1, player2.status.vec_cards[0])
    ]
    args = [
        tempCard.getCardOfNumA(myCard.num) +
        tempCard.getCharOfSuit(myCard.suit) for myCard in myCards
    ]
    args += [
        tempCard.getCardOfNumA(myCard.num) +
        tempCard.getCharOfSuit(myCard.suit) for myCard in opCards
    ]
    args += ["--"]
    if stage >= 1:
        flopCards = [
            tempCard.num_to_card(num)
            for num in all_indices(1, player1.status.vec_cards[1])
        ]
        args += [
            turnCard.getCardOfNumA(turnCard.num) +
            turnCard.getCharOfSuit(turnCard.suit) for turnCard in flopCards
        ]
    if stage >= 2:
        turnCards = [
            tempCard.num_to_card(num)
            for num in all_indices(1, player1.status.vec_cards[2])
        ]
        args += [
            turnCard.getCardOfNumA(turnCard.num) +
            turnCard.getCharOfSuit(turnCard.suit) for turnCard in turnCards
        ]
    if stage >= 3:  #should be just one
        riverCards = [
            tempCard.num_to_card(num)
            for num in all_indices(1, player1.status.vec_cards[3])
        ]
        args += [
            turnCard.getCardOfNumA(turnCard.num) +
            turnCard.getCharOfSuit(turnCard.suit) for turnCard in riverCards
        ]
    #print check_output(["pokenum.exe", "-h"] + args)
    return [
        float(num) for num in (check_output(["pokenum.exe", "-h", "-t"] +
                                            args).split()[2:])
    ]