Esempio n. 1
0
 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))
Esempio n. 2
0
 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]
Esempio n. 3
0
 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]))
Esempio n. 4
0
 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
Esempio n. 5
0
 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
Esempio n. 6
0
 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)
Esempio n. 7
0
 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)