Beispiel #1
0
 def __showdown(self, state):
   winners, hand_info, prize_map = GameEvaluator.judge(state["table"])
   self.__prize_to_winners(state["table"].seats.players, prize_map)
   result_message = MessageBuilder.build_round_result_message(state["round_count"], winners, hand_info, state)
   state["table"].reset()
   state["street"] += 1
   return state, [(-1, result_message)]
Beispiel #2
0
 def test_round_result_message(self):
     state = self.__setup_state()
     winners = state["table"].seats.players[1:2]
     hand_info = ["dummy", "info"]
     message = MessageBuilder.build_round_result_message(7, winners, hand_info, state)
     msg = message["message"]
     self.eq("notification", message["type"])
     self.eq(MessageBuilder.ROUND_RESULT_MESSAGE, msg["message_type"])
     self.eq(7, msg["round_count"])
     self.eq(hand_info, msg["hand_info"])
     self.eq(DataEncoder.encode_winners(winners)["winners"], msg["winners"])
     self.eq(DataEncoder.encode_round_state(state), msg["round_state"])
Beispiel #3
0
 def test_round_result_message(self):
     state = self.__setup_state()
     winners = state['table'].seats.players[1:2]
     hand_info = ['dummy', 'info']
     message = MessageBuilder.build_round_result_message(7, winners, hand_info, state)
     msg = message['message']
     self.eq('notification', message['type'])
     self.eq(MessageBuilder.ROUND_RESULT_MESSAGE, msg['message_type'])
     self.eq(7, msg['round_count'])
     self.eq(hand_info, msg['hand_info'])
     self.eq(DataEncoder.encode_winners(winners)['winners'], msg['winners'])
     self.eq(DataEncoder.encode_round_state(state), msg['round_state'])
 def test_round_result_message(self):
   state = self.__setup_state()
   winners = state["table"].seats.players[1:2]
   hand_info = ["dummy", "info"]
   message = MessageBuilder.build_round_result_message(7, winners, hand_info, state)
   msg = message["message"]
   self.eq("notification", message["type"])
   self.eq(MessageBuilder.ROUND_RESULT_MESSAGE, msg["message_type"])
   self.eq(7, msg["round_count"])
   self.eq(hand_info, msg["hand_info"])
   self.eq(DataEncoder.encode_winners(winners)["winners"], msg["winners"])
   self.eq(DataEncoder.encode_round_state(state), msg["round_state"])
 def __round_result_message(self):
   hand_info = ["dummy", "info"]
   state = self.__setup_state()
   winners = state["table"].seats.players[1:2]
   return MessageBuilder.build_round_result_message(7, winners, hand_info, state)
 def __round_result_message(self):
     hand_info = ['dummy', 'info']
     state = self.__setup_state()
     winners = state['table'].seats.players[1:2]
     return MessageBuilder.build_round_result_message(
         7, winners, hand_info, state)