示例#1
0
iAgreeWithBet = False
opponentAgreesWithBet = False
numBoardCards = 0
boardCards = []

opponentRound0Folds = 0
opponentRound1Folds = 0
opponentRound2Folds = 0
opponentRound3Folds = 0

preflopBets = []
postflopBets = []
turnBets = []
riverBets = []

d = Pokerini.pokeriniInitialise()


#If both players agree on bet, moves bet to pot
def updatePot():
    global iAgreeWithBet, opponentAgreesWithBet, myPot, myBet, opponentPot, opponentBet
    if (iAgreeWithBet and opponentAgreesWithBet):
        myPot = myPot + myBet
        myBet = 0
        opponentPot = opponentPot + opponentBet
        opponentBet = 0
        iAgreeWithBet = False
        opponentAgreesWithBet = False


#handles actions performed between GetAction packets
示例#2
0
def parseHand(words, length):
    if length == 1:
        return [parseCard(words[1:-1])]
    hand = []
    for x in range(0, length):
        if x == 0:
            hand.append(parseCard(words[x][1:]))
            continue
        if x == length - 1:
            hand.append(parseCard(words[x][:-1]))
            continue
        hand.append(parseCard(words[x]))
    return hand


pokeriniDict = Pokerini.pokeriniInitialise()

print "*********************************************************************"

teamID = {}

for fn in os.listdir('hands'):
    #print (fn)
    #Pokerini initialised
    #Open and process the file
    #f = open('process.txt', 'r')
    if fn == ".DS_Store": continue

    print fn

    f = open("hands/" + fn, 'r')
示例#3
0
        meanSimulations = self.totalNumSimulations / (self.handId -1)
        print "timeLeftPerHand: ", timeLeftPerHand
        print "timePerHand", timePerHand
        if self.handId > self.totalNumHands - 20:
            safetyFactor = 0.60
        elif self.handId > self.totalNumHands - 60:
            safetyFactor = 0.80
        else:
            safetyFactor = 0.95
        return int(meanSimulations * safetyFactor * ( timeLeftPerHand / timePerHand ))

if __name__ == '__main__':
    start =time.time()
    bot = Player()
    #bot.loadParametersFromFile()
    pokeriniDict = Pokerini.pokeriniInitialise()
    #PP.processDumpFile()
    #evalTable.createEvalCSV()

    '''
    handEvalDict = evalTable.loadHandEval()
    translationDict = evalTable.loadTranslationDict()
    '''

    parser = argparse.ArgumentParser(description='A Pokerbot.', add_help=False, prog='pokerbot')
    parser.add_argument('-h', dest='host', type=str, default='localhost', help='Host to connect to, defaults to localhost')
    parser.add_argument('port', metavar='PORT', type=int, help='Port on host to connect to')
    args = parser.parse_args()

    # Create a socket connection to the engine.
    print 'Connecting to %s:%d' % (args.host, args.port)
iAgreeWithBet = False
opponentAgreesWithBet = False
numBoardCards = 0
boardCards = []

opponentRound0Folds = 0
opponentRound1Folds = 0
opponentRound2Folds = 0
opponentRound3Folds = 0

preflopBets = []
postflopBets = []
turnBets = []
riverBets = []

d = Pokerini.pokeriniInitialise()


    #If both players agree on bet, moves bet to pot
def updatePot():
    global iAgreeWithBet, opponentAgreesWithBet, myPot, myBet, opponentPot, opponentBet
    if(iAgreeWithBet and opponentAgreesWithBet):
        myPot = myPot + myBet
        myBet = 0
        opponentPot = opponentPot + opponentBet
        opponentBet = 0
        iAgreeWithBet = False
        opponentAgreesWithBet = False

#handles actions performed between GetAction packets
def parsePerformedAction(performedAction, writeFile):