예제 #1
0
    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])
예제 #2
0
    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
예제 #3
0
    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
예제 #4
0
    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)