Example #1
0
    def run(self):

        self.connect()

        while self.end is not True:
            received_message = protocol.receive_json(self.socket)
            if received_message:
                self.handle_json(received_message)
            else:
                self.end = True
Example #2
0
    def run(self):

        self.connect()

        while self.end is not True:
            received_message = protocol.receive_json(self.socket)
            if received_message:
                self.handle_json(received_message)
            else:
                print("no message, finished learning")
                self.end = True
Example #3
0
 def run(self):
     self.socket.connect(("localhost", 12000))
     while self.end is not True:
         received_message = protocol.receive_json(self.socket)
         if received_message:
             self.handle_json(received_message)
         else:
             print("no message, finished learning")
             self.end = True
             return
         self.send_answer()
def receive_json_from_player(player):
    """
        Receives a python object from the client and converts it to a python
        object.

        :param player: object of the class Player. Either the fantom or the
        inspector.
        :return: return a python-readable object.
    """
    logger.debug(f"receive json from player {player}")
    received_bytes = protocol.receive_json(clients[player])
    json_object = json.loads(received_bytes)
    return json_object
    def run(self):

        try:
            self.connect()
        except ConnectionRefusedError as e:
            os.remove(filename)

        while self.end is not True:
            received_message = protocol.receive_json(self.socket)
            if received_message:
                self.handle_json(received_message)
            else:
                print("no message, finished learning")
                self.end = True
Example #6
0
    def run(self):

        self.connect()

        while self.end is not True:
            received_message = protocol.receive_json(self.socket)
            if received_message:
                self.handle_json(received_message)
            else:
                #print("no message, finished learning")
                for key, envManager in self.envManagers.items():
                    envManager.save_training(
                    ) if not envManager.smart else None
                self.end = True