def offer(self, table): if ISPT.round() == 1: return 0.01 last_round = ISPT.get_history()[-1] # print("Mimic's last round obj:", last_round) # print([t.offer for t in last_round]) return mean([t.offer for t in last_round])
def response(self, table, offer): if ISPT.round() == 1: return ACCEPT # If current offer better than last round's average, accept offers = [t.offer for t in ISPT.get_history()[-1]] avg_offer = mean(offers) if offers else 0 return ACCEPT if avg_offer <= offer else REJECT
def response(self, table, offer): if ISPT.round() == 1: return ACCEPT last_round = ISPT.get_history()[-1] responses = [t.response for t in last_round] counts = {ACCEPT: responses.count(ACCEPT), REJECT: responses.count(REJECT), COUNTER: responses.count(COUNTER)} return max(counts, key=counts.get)
def response(self, table, offer): last = ISPT.get_history()[-1] accepted = [table.offer for table in last if table.response == ACCEPT] if accepted: return sum(accepted) / len(accepted) else: return 1 # i.e. choose to counteroffer
def offer(self, table): # # Determine the last offer the opponent accepted, make that offer # if table.game.state.round == 1: # return 0.5 if ISPT.round() == 1: return 0.5 last_accepted = self.last_accepted(table.players[1]) return last_accepted if last_accepted else 0.5
def offer(self, table): history = ISPT.get_history(players=[1, 5, 9]) offers = [] for round in history: offers += [t.offer for t in round] if offers: return sum(offers) / len(offers) else: return 0.25
def last_accepted(self, player): '''Gets the last offer accepted by the player, if any.''' history = ISPT.get_history() for i in reversed(range(len(history))): if history[i]: # Check that the round isn't an empty list for t in history[i]: if t.players[1] == player and t.response == ACCEPT: return t.offer return None