def announce_later_turn(self, prev_turns, our_roll): all_values = tools.valid_game_values_lowest_to_highest() prev_roll = prev_turns[-1][1] value = prev_roll index = tools.value_to_rank(value) higher_values = all_values[index + 1:] announce_value = random.choice(higher_values) return announce_value
def announce_later_turn(self, prev_turns, our_roll): our_rank = tools.value_to_rank(our_roll) prev_rank = tools.value_to_rank(prev_turns[-1][1]) if our_rank > prev_rank: return our_roll else: higher_values = tools.valid_game_values_lowest_to_highest()[prev_rank + 1:] weights = [tools.probability_of_value(value) for value in higher_values] return random.choices(higher_values, weights=weights)[0]
def exclude_trivialities(self, prev_turn, first_turn=None): if prev_turn is None: if first_turn is None: roll = self.bot.roll() self.bot.announce(roll) else: self.bot.roll() self.bot.announce(first_turn) return True elif prev_turn[1] == valid_game_values_lowest_to_highest()[-1]: self.bot.accuse() return True return False
def announce_first_turn(self, our_roll): return random.choice(tools.valid_game_values_lowest_to_highest())