Exemple #1
0
    def okAggPlay(self,game):
        move = Move(CHECK)
        curAmt = game.lastBet
        potAmt = game.pot + game.rightOpp.pip + game.leftOpp.pip + game.me.pip
        street = game.street

        canBet = False
        canRaise = False
        for la in game.legalActions:
            if la[0] == "BET":
                canBet = True
            if la[0] == "RAISE":
                canRaise = True

        if game.street == PREFLOP:
            if curAmt>50:
                return move
            move = Move(CALL)
            if random.randint(1,100) <= 10 and canRaise:
                move = Move(RAISE, random.randint(1,3)*potAmt)
        elif game.street == FLOP:
            if canRaise:
                move = Move(CALL)
                if random.randint(1,100) <= 75:
                    move = Move(RAISE, random.randint(20,25)/10.0*game.lastBet)
            elif canBet:
                move = Move(CHECK)
                if random.randint(1,100) <= 35:
                    move = Move(BET, random.randint(33,66)/100.0*potAmt)
        elif game.street == TURN:
            if canRaise:
                move = Move(CHECK)
                if random.randint(1,100) <= 45:
                    move = Move(RAISE, random.randint(20,25)/10.0*game.lastBet)
            elif canBet:
                move = Move(CHECK)
                if random.randint(1,100) <= 25:
                    move = Move(BET, random.randint(33,66)/100.0*potAmt)
        elif game.street == RIVER:
            if canRaise:
                move = Move(CHECK)
                if random.randint(1,100) <= 15:
                    move = Move(RAISE, random.randint(20,25)/10.0*game.lastBet)
            elif canBet:
                move = Move(CHECK)
                if random.randint(1,100) <= 15:
                    move = Move(BET, random.randint(33,66)/100.0*potAmt)
        else:
            print "Error! You reached a state not 0-3! in blindEVplay"

        if move.type == CHECK and curAmt < .33 * potAmt and canRaise:
            move = Move(CALL)
            if random.randint(1,100) <= 50:
                move = Move(RAISE, random.randint(20,25)/10.0*game.lastBet)
        move.amount = min([move.amount, game.me.getAllIn()])
        return move
Exemple #2
0
    def badAggPlay(self, game):
        curAmt = game.lastBet
        potAmt = game.pot + game.rightOpp.pip + game.leftOpp.pip + game.me.pip
        street = game.street

        move = Move(CHECK)

        canBet = False
        canRaise = False
        for la in game.legalActions:
            if la[0] == "BET":
                canBet = True
            if la[0] == "RAISE":
                canRaise = True

        if canRaise and curAmt > 2*potAmt: #don't call super aggressive bets
            #with bad ev
            return move
        if canRaise: #don't re-raise with bad ev
            if game.rightOpp.active and self.matchLastAction(game, game.rightOpp,[RAISE]):
                return move
            elif game.leftOpp.active and self.matchLastAction(game, game.leftOpp,[RAISE]):
                return move

        if street == PREFLOP:
            move = Move(CHECK)
            #Raise 10% of the time
            if random.randint(1,100) <= 10 and canRaise:
                move = Move(RAISE, random.randint(1,2)*potAmt)
        elif street == FLOP:
            if canRaise:
                move = Move(CHECK)
                if random.randint(1,100) <= 60:
                    move = Move(RAISE, random.randint(20,25)/10.0*game.lastBet)
            elif canBet:
                move = Move(CHECK)
                if random.randint(1,100) <= 35:
                    move = Move(BET, random.randint(33,50)/100.0*potAmt)
        elif street == TURN:
            if canRaise:
                move = Move(CHECK)
                if random.randint(1,100) <= 15:
                    move = Move(RAISE, random.randint(20,25)/10.0*game.lastBet)
            elif canBet:
                move = Move(CHECK)
                if random.randint(1,100) <= 7:
                    move = Move(BET, random.randint(33,50)/100.0*potAmt)

        if move.type == CHECK and curAmt < .33 * potAmt and canRaise:
            move = Move(CALL)
            if random.randint(1,100) <= 50:
                move = Move(RAISE, random.randint(20,25)/10.0*game.lastBet)
        move.amount = min([move.amount, game.me.getAllIn()])
        return move
Exemple #3
0
    def goodAggPlay(self,game):
        move = Move(CHECK)
        curAmt = game.lastBet
        potAmt = game.pot + game.rightOpp.pip + game.leftOpp.pip + game.me.pip

        canBet = False
        canRaise = False
        for la in game.legalActions:
            if la[0] == "BET":
                canBet = True
            if la[0] == "RAISE":
                canRaise = True

        if game.street == PREFLOP:
            move = Move(CALL)
            if random.randint(1,100) <= 50 and canRaise:
                move = Move(RAISE, random.randint(1,5)*potAmt)
        elif game.street == FLOP:
            move = Move(CALL)
            if canRaise:
                if random.randint(1,100) <= 50:
                    move = Move(RAISE, random.randint(20,25)/10.0*game.lastBet)
            elif canBet:
                move = Move(CHECK)
                if random.randint(1,100) <= 50:
                    move = Move(BET, random.randint(66,75)/100.0*potAmt)
        elif game.street == TURN:
            move = Move(CALL)
            if canRaise:
                if random.randint(1,100) <= 45:
                    move = Move(RAISE, random.randint(20,25)/10.0*game.lastBet)
            elif canBet:
                move = Move(CHECK)
                if random.randint(1,100) <= 75:
                    move = Move(BET, random.randint(66,75)/100.0*potAmt)
        elif game.street == RIVER:
            move = Move(CALL)
            if canRaise:
                amt = round(min([2.5*game.lastBet, game.me.getAllIn()]))
                move = Move(RAISE, random.randint(amt, round(game.me.getAllIn())))
            elif canBet:
                move = Move(BET, random.randint(50,150)/100.0*potAmt)
        move.amount = min([move.amount, game.me.getAllIn()])
        return move
Exemple #4
0
    def getMove(self, game):
        OppEvs = self.getOppEvs(game)
        ev = self.evalHand(game, OppEvs)
        scores = {}
        nump = game.activePlayers

        if ev>blindEVs[nump-2][game.street][2]:
            myBlindEV = GOOD
        elif ev>blindEVs[nump-2][game.street][1]:
            myBlindEV = OK
        elif ev>blindEVs[nump-2][game.street][0]:
            myBlindEV = BAD
        else:
            myBlindEV = AWFUL

        for pname,p in OppEvs.items():
            if p[0] == -1:
                scores[pname] = UNKNOWN
            elif ev>p[0]+p[1]:
                scores[pname] = GOOD
            elif ev>p[0]:
                scores[pname] = OK
            elif ev>p[0]-p[1]:
                scores[pname] = BAD
            else:
                scores[pname] = AWFUL

        maxLeftEV = max([myBlindEV,scores[game.leftOpp.name]])
        if OppEvs[game.leftOpp.name][1]<100:
            maxLeftEV = scores[game.leftOpp.name]
        maxRightEV = max([myBlindEV,scores[game.rightOpp.name]])
        if OppEvs[game.rightOpp.name][1]<100:
            maxLeftEV = scores[game.rightOpp.name]

        print "EV:", ev, "myBlindEV:",myBlindEV, "LEFT EV:", OppEvs[game.leftOpp.name],"-",scores[game.leftOpp.name],"=",scores[game.leftOpp.name], "RIGHT EV:", OppEvs[game.rightOpp.name],"=",scores[game.rightOpp.name], "activePlayers:", game.activePlayers
        if nump == 3:
            score = min([maxLeftEV, maxRightEV])
        else:
            score = maxRightEV
            if not game.rightOpp.active:
                score = maxLeftEV


        tagPlaying = ((not game.leftOpp.isLAP(game) and game.leftOpp.active)
                      or (not game.rightOpp.isLAP(game) and game.rightOpp.active))
        comment = ""
        if score == AWFUL:
            move = Move(CHECK)
        else:
            move = self.decide(game, not tagPlaying, score)
            comment += move.comment
        comment += " score: " + str(score)

        if move.amount is not None:
            move.amount = min([move.amount, game.me.getAllIn()])

        if ACTION_TYPES[move.type] not in [la[0] for la in game.legalActions]:
            print "returned illegal action",move.toString()[:-1],"! in",game.legalActions
            if move.type in [BET,RAISE]:
                move = Move(CALL)
            else:
                move = Move(CHECK)

        move.rightEV = OppEvs[game.rightOpp.name]
        move.leftEV = OppEvs[game.leftOpp.name]
        move.myEV = ev
        move.comment = comment
        return move