Top Three Previous
class TopThreePrevious:
"""
Will marry any of the top three it has seen from the previous round.
If it's the first round, it flips a coin instead.
"""
def __init__(self, nrof_bots, rng):
self.rng = rng
self.best = []
self.previousBest = []
def round_finished(self, nrof_remaining_bots):
self.best = []
self.bots.sort(reverse = True)
for i in range(3):
self.best.append(self.bots[i])
self.bots = []
def date(self, other) -> bool:
self.bots += [other]
if len(self.best) == 0:
return self.rng.random()>0.5
return other in self.best
This bot simply checks if the bot it's currently dating was one of the top three it has seen in the previous round, or flips a coin if it's the first round (it uses the length of self.best
to determine this).