def getPlayerPowerPlants(self,playerId): for player in self.game.players: if (playerId == player.get_playerID()): return player.get_PowerPlants()
def main(self): # TODO Load the map blocked need map object # init turns # TODO self.initializePlayerTurns() for player in reversed(self.players): while len(player.get_PowerPlants()) == 0: auction = Auction.Auction( self.Table.getDeck(), self.Table.getCardsForAuction() + self.Table.getFutureCardsForAuction() ) # TODO Anandh add auction stuff while not self.gameover: print("buy resources") # PHASE 2 bid for resources for player in self.players: request = {} request[Resource.COAL] = player.getCoalRequest() request[Resource.OIL] = player.getOilRequest() request[Resource.GARBAGE] = player.getGarbageRequest() request[Resource.URANIUM] = player.getUraniumRequest() cost = Resource.buy_resource(request) if cost == 0: player.warn(NOT_ENOUGH_RESOURCES) elif cost <= player.f_b_get_money(): player.pay(cost) player.add_coal(request[Resource.COAL]) player.add_oil(request[Resource.OIL]) player.add_garbage(request[Resource.GARBAGE]) player.add_uranium(request[Resource.URANIUM]) else: # This case there is not enough money player.warn(NOT_ENOUGH_MONEY) self.ResourceMarket.restore_resources() # PHASE 3 buy cities # TODO Blocked no map available # PHASE 4 power cities for player in self.players: player.powerCities() # TODO check game end # PHASE 5 pay the players for player in self.players: player.addMoney(payday.pay(player.get_cities_powered)) # Check if advance to 2 if self.currentPhase == 1: self.checkAdvancePhaseTwo() for player in self.players: if player.get_cities() >= self.GAMEEND[self.numPlayers]: self.gameover = True # PHASE 1 bid for power plants self.players = calculateTurns() availableCards = self.Table.getCardsForAuction() futureCards = self.Table.getFutureCardsForAuction() self.checkAdvancePhaseThree(availableCards) # Pass to players # TODO Auction print("Bid for power plants") auction = Auction.Auction(self.Table.getDeck(), availableCards + futureCards)