# HistoryBot <!-- language: lang-py --> import random class HistoryBot(object): def __init__(self, index): self.pastWins = [] def select(self): if not self.pastWins: return 1 return random.choice(self.pastWins) def update(self, choices): unique = [x for x in choices if choices.count(x) == 1] if unique: self.pastWins.append(min(unique)) Implementation of user2390246's comment: > What about this then? Start with 1. After the first round, keep track > of the winning values and pick randomly from them with probability > equal to the number of occurrences. E.g. if the winning values in the > first three rounds are [2, 3, 2] then in round four, pick [2] with p = > 2/3 and [3] with p = 1/3.