예제 #1
0
def handlePerformedActionShow(words, writeFile):
    global myName
    global numBoardCards
    global preflopBets
    global postflopBets
    global turnBets
    global riverBets
    global boardCards
    global d

    if (words[5] == myName):
        myHand = []
        for card in words[1:5]:
            myHand.append(parseCard(card))
        preflopRating = Pokerini.pokeriniLookup(myHand, d)
        writeFile.write(str(preflopRating) + "," + ','.join(preflopBets))
        writeFile.write('\n')
        if (numBoardCards >= 3):
            postflopRanking = Simulation.simulateOld(myHand, boardCards[0:3],
                                                     3, 100)
            writeFile.write(
                str(postflopRanking) + "," + ','.join(postflopBets))
            writeFile.write('\n')
        if (numBoardCards >= 4):
            turnRanking = Simulation.simulateOld(myHand, boardCards[0:4], 4,
                                                 100)
            writeFile.write(str(turnRanking) + "," + ','.join(turnBets))
            writeFile.write('\n')
        if (numBoardCards == 5):
            riverRanking = Simulation.simulateOld(myHand, boardCards[0:5], 5,
                                                  100)
            writeFile.write(str(riverRanking) + "," + ','.join(riverBets))
            writeFile.write('\n')
def handlePerformedActionShow(words, writeFile):
    global opponentName
    global numBoardCards
    global preflopBets
    global postflopBets
    global turnBets
    global riverBets
    global boardCards
    global d

    if(words[5] == opponentName):
        opponentHand = []
        for card in words[1:5]:
            opponentHand.append(parseCard(card))
        preflopRating = Pokerini.pokeriniLookup(opponentHand, d)
        writeFile.write(str(preflopRating)+","+','.join(preflopBets))
        writeFile.write('\n')
        if(numBoardCards >= 3):
            postflopRanking = Simulation.simulateOld(opponentHand, boardCards[0:3], 3, 100)
            writeFile.write(str(postflopRanking)+","+','.join(postflopBets))
            writeFile.write('\n')
        if(numBoardCards >= 4):
            turnRanking = Simulation.simulateOld(opponentHand, boardCards[0:4], 4, 100)
            writeFile.write(str(turnRanking)+","+','.join(turnBets))
            writeFile.write('\n')
        if(numBoardCards == 5):
            riverRanking = Simulation.simulateOld(opponentHand, boardCards[0:5], 5, 100)
            writeFile.write(str(riverRanking)+","+','.join(riverBets))
            writeFile.write('\n')
예제 #3
0
 def updateHandRanking(self):
     if(self.cardsChanged == True):
         if(self.numBoardCards == 0): #preflop
             self.pokeriniRank = Pokerini.pokeriniLookup(self.myHand, pokeriniDict)
             self.calculatePreflopBetLimit()
         if(self.numBoardCards >= 3):#postflop
             #self.simulationWinChance = Simulation.simulate(self.myHand, self.boardCards, self.numBoardCards, 200, handEvalDict, translationDict)
             self.simulationWinChance = Simulation.simulateOld(self.myHand, self.boardCards, self.numBoardCards, self.numSimulations)
     self.cardsChanged = False
예제 #4
0
        for line in handsDict[hand]:
            split = line.split()

            if split[0] == "Dealt":
                handParse = parseHand(split[3:], 4)
                team = split[2]
                if team == team1: team1hand = handParse
                if team == team2: team2hand = handParse

            if split[1] == "folds":
                team = split[0]
                if team == team1:
                    team1Exits["round" + str(roundNum) + "fold"] += 1
                    if roundNum == 0:
                        team1folds0.append(
                            Pokerini.pokeriniLookup(team1hand, pokeriniDict))
                if team == team2:
                    team2Exits["round" + str(roundNum) + "fold"] += 1
                    if roundNum == 0:
                        team2folds0.append(
                            Pokerini.pokeriniLookup(team2hand, pokeriniDict))
                continue
            if split[1] == "wins":
                team = split[0]
                if team == team1:
                    team1Wins["wins"] += 1
                    team1Wins["totalScore"] += int(split[4][1:-1])
                    team1Wins["listWins"].append(int(split[4][1:-1]))
                if team == team2:
                    team2Wins["wins"] += 1
                    team2Wins["totalScore"] += int(split[4][1:-1])
예제 #5
0
        roundNum = 0
        for line in handsDict[hand]:
            split = line.split()

            if split[0] == "Dealt":
                handParse = parseHand(split[3:], 4)
                team = split[2]
                if team == team1: team1hand = handParse
                if team == team2: team2hand = handParse

            if split[1] == "folds":
                team = split[0]
                if team == team1: 
                    team1Exits["round" + str(roundNum) + "fold"] += 1
                    if roundNum == 0:
                        team1folds0.append(Pokerini.pokeriniLookup(team1hand, pokeriniDict))
                if team == team2: 
                    team2Exits["round" + str(roundNum) + "fold"] += 1
                    if roundNum == 0:
                        team2folds0.append(Pokerini.pokeriniLookup(team2hand, pokeriniDict))
                continue
            if split[1] == "wins":
                team = split[0]
                if team == team1: 
                    team1Wins["wins"] += 1
                    team1Wins["totalScore"] += int(split[4][1:-1])
                    team1Wins["listWins"].append(int(split[4][1:-1]))
                if team == team2: 
                    team2Wins["wins"] += 1
                    team2Wins["totalScore"] += int(split[4][1:-1])
                    team2Wins["listWins"].append(int(split[4][1:-1]))