Ejemplo n.º 1
0
    def run(self):
        """
        Handle the game logic
        """
        while not sys.stdin.closed:

            try:
                raw_line = sys.stdin.readline()

                if len(raw_line) == 0:
                    continue

                line = raw_line.strip()

                parts = line.split()
                command = parts[0]

                if command == "settings":
                    self._settings.update(setting=parts[1], value=parts[2])

                elif command == "update":
                    self._state.update(obj=parts[1], state=parts[2], value=parts[3])

                elif command == "action":
                    # Take action
                    Output.write("drop")

            except EOFError:
                return
Ejemplo n.º 2
0
    def update(self, setting, value):
        """
        Minimalistic setting parser
        """
        if setting not in self._settings.keys():
            Output.write("Could not parse setting {}: {}".format(setting, value))

        Output.debug("Setting \"{}\": {}".format(setting, value))
        self._settings[setting] = value
Ejemplo n.º 3
0
    def _print_matrix(self):

        Output.debug("#" * 50)

        for columns in self.grid:
            Output.debug(columns)

        Output.debug("#" * 50)