def announce_later_turn(self, prev_turns, our_roll): if len(prev_turns) == 1: rank = max(tools.value_to_rank((6, 4)), tools.value_to_rank(our_roll)) else: prev_roll = prev_turns[-1][1] rank = max( tools.value_to_rank(prev_roll) + 1, tools.value_to_rank(our_roll)) if rank == 20 or rank == tools.value_to_rank(our_roll): return tools.rank_to_value(rank) return tools.rank_to_value(random.choice([rank, rank + 1]))
def announce_later_turn(self, prev_turns, our_roll): if tools.higher_than(our_roll, prev_turns[-1][1]): announcement = our_roll else: announcement = tools.rank_to_value( tools.value_to_rank(prev_turns[-1][1]) + 1) return announcement
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: n = 21 - prev_rank top_by = binomial(n, self.p) return tools.rank_to_value(min(prev_rank + top_by, 20))
def announce_first_turn(self, our_roll): rank = max(tools.value_to_rank((6, 3)), tools.value_to_rank(our_roll)) return tools.rank_to_value(rank)
def announce_later_turn(self, prev_turns, our_roll): prev_roll = prev_turns[-1][1] rank = max(tools.value_to_rank((5, 4)), tools.value_to_rank(prev_roll) + 1, tools.value_to_rank(our_roll)) return tools.rank_to_value(rank)