示例#1
0
	def create_game(self, payload):
		# self.game_id = payload["GameID"]
		player_data = payload["Players"]
		players = []
		for player in player_data:
			# Shuffle the cards to prevent information leaking
			cards = player["Cards"]
			random.shuffle(cards)
			p = Player(player["Name"], cards, player["Hero"])
			players.append(p)

		INFO("Initializing a Kettle game with players=%r", players)
		game = Game(players=players)
		manager = KettleManager(game)
		game.manager.register(manager)
		game.current_player = game.players[0]  # Dumb.
		game.start()

		# Skip mulligan
		for player in game.players:
			player.choice = None

		return manager
示例#2
0
    def create_game(self, payload):
        # self.game_id = payload["GameID"]
        player_data = payload["Players"]
        players = []
        for player in player_data:
            # Shuffle the cards to prevent information leaking
            cards = player["Cards"]
            random.shuffle(cards)
            p = Player(player["Name"], cards, player["Hero"])
            players.append(p)

        INFO("Initializing a Kettle game with players=%r", players)
        game = Game(players=players)
        manager = KettleManager(game)
        game.manager.register(manager)
        game.current_player = game.players[0]  # Dumb.
        game.start()

        # Skip mulligan
        for player in game.players:
            player.choice = None

        return manager