def act(self, state, card): if betting.can_bet(state): if card == deck.ACE: return betting.BET #randomly bet or check elif card == deck.KING: if self.rng.random() < self.bluff: return betting.BET else: return betting.CHECK elif card == deck.QUEEN: return betting.CHECK elif card == deck.JACK: return betting.CHECK else: if card == deck.ACE: return betting.CALL #randomly call or fold elif card == deck.KING: if self.rng.random() < self.bluff: return betting.CALL else: return betting.FOLD elif card == deck.QUEEN: return betting.FOLD elif card == deck.JACK: return betting.FOLD elif betting.
def estimate_prob_win(self, state, card): # we are totally killing this handling if card == deck.ACE: return 1.0 # we have not gained any info on the other players yet elif betting.can_bet(state): return self.base_prob_win(card, 3) # we only know about the previous player elif betting.facing_bet2(state): return self.base_prob_win(card, 2) * self.otherBluff[1] # we know what both players are betting elif betting.facing_bet_call(state): return self.base_prob_win( card, 1) * self.otherBluff[0] * self.otherBluff[1] # only the previous player is betting elif betting.facing_bet_fold(state): return self.base_prob_win(card, 1) * self.otherBluff[0] else: assert (False)
def act(self, state, card): self.counter = self.counter + 1 if betting.can_bet(state): if card == deck.ACE: return betting.BET elif card == deck.KING: if (random.Random() < 1 / 2): return betting.BET else: return betting.CHECK elif card == deck.QUEEN: if (random.Random() < 1 / 6): return betting.BET else: return betting.CHECK else: if card == deck.ACE: return betting.CALL elif card == deck.KING: if (self.counter % 2 == 0): return betting.CALL else: return betting.FOLD elif card == deck.QUEEN: if (random.Random() < 1 / 25): return betting.CALL else: return betting.FOLD else: return betting.FOLD
def act(self, state, card): if betting.can_bet(state): if card >= deck.KING: return betting.CHECK else: return betting.BET else: if card == deck.ACE: return betting.FOLD else: return betting.CALL
def act(self, state, card): for x in range(25): if betting.can_bet(x): print 'can bet', x if betting.facing_bet(x): print 'facing bet', x if betting.facing_bet_call(x): print 'facing bet call', x if betting.facing_bet_fold(x): print 'facing bet fold', x return betting.CALL
def act(self, state, card): if betting.can_bet(state): if card < deck.ACE: if self.rng.random() < self.bluff: return betting.BET else: return betting.CHECK else: return betting.BET else: if card == deck.ACE: return betting.CALL else: return betting.FOLD
def act(self, state, card): # let's estimate prob that we will win self.prob_win = self.estimate_prob_win(state, card) # stay in game with probability according to base prob stay_in_game = False if self.rng.random() < self.prob_win: stay_in_game = True if betting.can_bet(state): if stay_in_game: return betting.BET else: return betting.CHECK else: if stay_in_game: return betting.CALL else: return betting.FOLD