예제 #1
0
    def get(self, action, id=None):
        if action == "create":
            id = len(self.games)

            
            n_detectives = 4
            game = Game(board_definition)

            mrX = MrX(game)
            detectives = [Detective(game) for i in range(n_detectives)]

            game.set_players(mrX, detectives)

            self.games.append(game)
            
            self.write(json.dumps({
                'id' : id,
                'board' : board_definition
            }))
예제 #2
0
    def post(self):
        self.write_json('done')
        return

        if action == "create":
            id = len(self.games)

            
            n_detectives = 4
            game = Game(board_definition)

            detectives = [Detective(game) for i in range(n_detectives)]
            game.set_players(detectives=detectives)

            self.games.append(game)

            self.write(json.dumps({
                'id' : id,
                'board' : board_definition
            }))
        elif action == "list":
            self.write(json.dumps(range(len(self.games))))