Exemple #1
0
 def build_game_start_message(self, config, seats):
     message = {
         'message_type': self.GAME_START_MESSAGE,
         'game_information':
         DataEncoder.encode_game_information(config, seats)
     }
     return self.__build_notification_message(message)
Exemple #2
0
 def build_game_result_message(self, config, seats):
     message = {
         "message_type": self.GAME_RESULT_MESSAGE,
         "game_information":
         DataEncoder.encode_game_information(config, seats)
     }
     return self.__build_notification_message(message)
Exemple #3
0
 def test_game_result_message(self):
     config = self.__setup_config()
     seats = self.__setup_seats()
     state = self.__setup_state()
     message = MessageBuilder.build_game_result_message(config, seats)
     msg = message["message"]
     self.eq("notification", message["type"])
     self.eq(MessageBuilder.GAME_RESULT_MESSAGE, msg["message_type"])
     self.eq(DataEncoder.encode_game_information(config, seats), msg["game_information"])
Exemple #4
0
 def test_game_start_message(self):
     config = self.__setup_config()
     seats = self.__setup_seats()
     message = MessageBuilder.build_game_start_message(config, seats)
     msg = message['message']
     self.eq('notification', message['type'])
     self.eq(MessageBuilder.GAME_START_MESSAGE, msg['message_type'])
     self.eq(MessageBuilder.GAME_START_MESSAGE, msg['message_type'])
     self.eq(DataEncoder.encode_game_information(config, seats), msg['game_information'])
 def test_game_result_message(self):
   config = self.__setup_config()
   seats = self.__setup_seats()
   state = self.__setup_state()
   message = MessageBuilder.build_game_result_message(config, seats)
   msg = message["message"]
   self.eq("notification", message["type"])
   self.eq(MessageBuilder.GAME_RESULT_MESSAGE, msg["message_type"])
   self.eq(DataEncoder.encode_game_information(config, seats), msg["game_information"])
 def test_encofe_game_information(self):
     config = { "initial_stack":100, "max_round":10, "small_blind_amount":5,\
             "ante":1, "blind_structure": {1: {"ante": 3, "small_blind": 10} } }
     seats = setup_seats()
     hsh = DataEncoder.encode_game_information(config, seats)
     self.eq(3, hsh["player_num"])
     self.eq(DataEncoder.encode_seats(seats)["seats"], hsh["seats"])
     self.eq(config["small_blind_amount"], hsh["rule"]["small_blind_amount"])
     self.eq(config["max_round"], hsh["rule"]["max_round"])
     self.eq(config["initial_stack"], hsh["rule"]["initial_stack"])
     self.eq(config["ante"], hsh["rule"]["ante"])
     self.eq(config["blind_structure"], hsh["rule"]["blind_structure"])
Exemple #7
0
 def test_encofe_game_information(self):
     config = {"initial_stack": 100, "max_round": 10, "small_blind_amount": 5, \
               "ante": 1, "blind_structure": {1: {"ante": 3, "small_blind": 10}}}
     seats = setup_seats()
     hsh = DataEncoder.encode_game_information(config, seats)
     self.eq(3, hsh["player_num"])
     self.eq(DataEncoder.encode_seats(seats)["seats"], hsh["seats"])
     self.eq(config["small_blind_amount"],
             hsh["rule"]["small_blind_amount"])
     self.eq(config["max_round"], hsh["rule"]["max_round"])
     self.eq(config["initial_stack"], hsh["rule"]["initial_stack"])
     self.eq(config["ante"], hsh["rule"]["ante"])
     self.eq(config["blind_structure"], hsh["rule"]["blind_structure"])
Exemple #8
0
 def test_encofe_game_information(self):
     config = {
         'initial_stack': 100,
         'max_round': 10,
         'small_blind_amount': 5,
         'ante': 1,
         'blind_structure': {
             1: {
                 'ante': 3,
                 'small_blind': 10
             }
         }
     }
     seats = setup_seats()
     hsh = DataEncoder.encode_game_information(config, seats)
     self.eq(3, hsh['player_num'])
     self.eq(DataEncoder.encode_seats(seats)['seats'], hsh['seats'])
     self.eq(config['small_blind_amount'],
             hsh['rule']['small_blind_amount'])
     self.eq(config['max_round'], hsh['rule']['max_round'])
     self.eq(config['initial_stack'], hsh['rule']['initial_stack'])
     self.eq(config['ante'], hsh['rule']['ante'])
     self.eq(config['blind_structure'], hsh['rule']['blind_structure'])
 def build_game_result_message(self, config, seats):
   message = {
     "message_type": self.GAME_RESULT_MESSAGE,
     "game_information": DataEncoder.encode_game_information(config, seats)
   }
   return self.__build_notification_message(message)