def _context(self): game_context = MutableGameState() game_context.players = [fake_player("A", 2000), fake_player("B", 2000), fake_player("C", 3000)] game_context.private_companies = [fake_private_company(0), fake_private_company(1)] game_context.private_companies[1].bid(game_context.players[0], 255) game_context.private_companies[1].bid(game_context.players[1], 260) return game_context
def state(self) -> MutableGameState: game_context = MutableGameState() game_context.players = [fake_player("A"), fake_player("B"), fake_player("C"), fake_player("D"), fake_player("E"), fake_player("F")] game_context.public_companies = [fake_public_company(x) for x in ["PublicABC", "PublicDEF", "PublicGHI"]] game_context.private_companies = [fake_private_company(int(x)) for x in [1, 2]] game_context.auctioned_private_company = game_context.private_companies[0] game_context.auctioned_private_company.belongs_to = game_context.players[5] game_context.auction = [] game_context.stock_round_count = 1 game_context.sales = [{},{}] game_context.purchases = [{},{}] return game_context
def next(self, kwargs: MutableGameState) -> str: players: List[Player] = kwargs.players if self.sell_private_company_auction: kwargs.auction = [] return "Auction" if kwargs.stock_round_play % len(players) == 0 \ and kwargs.stock_round_play > 0 \ and kwargs.stock_round_passed == len(players): return "OperatingRound1" return "StockRound"
def state(self) -> MutableGameState: game_context = MutableGameState() game_context.players = [ fake_player("A", 10000, 1), fake_player("B", 10000, 2) ] game_context.public_companies = [ fake_public_company(str(x)) for x in ["ABC", "DEF", "GHI"] ] game_context.stock_round_count = 2 game_context.stock_round_play = 0 game_context.stock_round_passed = 0 game_context.sales = [{}, {}, {}] game_context.purchases = [{}, {}, {}] return game_context
def initialize(players: List[Player], saved_game: dict = None) -> "Game": """ :param players: :param saved_game: Used to load data, if any. If empty, everything defaults to a new game. :return: """ game = Game() game.state = MutableGameState() game.state.players = players game.state.private_companies = PrivateCompany.allPrivateCompanies() game.state.public_companies = [] return game