Beispiel #1
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.title("Drunkard walk")
        self.resizable(False, False)
        self.controller = EventController(self)

        board = Board()

        self.controller.set_board(board)

        main_frame = ttk.Frame(self, padding=(20, 10, 10, 10))
        main_frame.pack(fill="both", expand=True)
        interface_frame = InterfaceFrame(main_frame,
                                         self.controller,
                                         padding=(20, 10, 10, 10))
        interface_frame.pack(side="left", fill="x")
        board_frame = BoardFrame(main_frame,
                                 board,
                                 self.controller,
                                 padding=(10, 10, 10, 10))
        board_frame.pack(side="left", fill="both")

        output_frame = OutputFrame(self,
                                   self.controller,
                                   padding=(20, 10, 20, 10))
        output_frame.pack(side="bottom", fill="both", expand=True)
Beispiel #2
0
class Doodle:
    def __init__(self):
        self.gamecore = PlayingMode()
        self.view = PygameView()
        self.controller = EventController()
        self.gameObject = None
        pass

    def get_player_scene_info(self):
        pass

    def update(self):
        cmds = self.controller.get_keyboard_command()
        self.gameObject = self.gamecore.update(cmds)
        self.draw(self.gameObject)

    def reset(self):

        pass

    def isRunning(self):
        running = self.controller.is_running()
        return running

    def draw(self, object):
        self.view.draw(object)
        self.view.flip()

    def get_scene_info(self):
        """
        Get the scene information
        """
        pass

    def get_game_info(self):
        """
        Get the scene and object information for drawing on the web
        """
        pass

    def get_game_progress(self):
        """
        Get the position of game objects for drawing on the web
        """
        pass

    def get_game_result(self):
        """
        Get the game result for the web
        """
        pass
Beispiel #3
0
 def __init__(self):
     self.gamecore = PlayingMode()
     self.view = PygameView(self.get_game_info())
     self.controller = EventController()
     self.gameObject = None
     pass
Beispiel #4
0
import falcon
from falcon_cors import CORS
from controller import EventController

event_controller = EventController()


class SearchEventResource:
    def on_post(self, req, resp):
        j = req.media
        event_controller.create_search(query=j['query'],
                                       session_uuid=j['session_uuid'])
        resp.status = falcon.HTTP_201


class SearchRatingEventResource:
    def on_post(self, req, resp):
        j = req.media
        try:
            event_controller.create_search_rating(query=j['query'],
                                                  rating=j['rating'])
            resp.status = falcon.HTTP_201
        except ValueError:
            resp.body = '{"message": "Rating must be between 1 and 5"}'
            resp.status = falcon.HTTP_400


class ResultClickEventResource:
    def on_post(self, req, resp):
        j = req.media
        event_controller.create_result_click(session_uuid=j['session_uuid'],