Example #1
0
def update(event, screen):
    for grid_cols in grids:
        for grid in grid_cols:
            grid.update(event)
            grid.render(screen)
    for city in corners:
        city.update(event)
        city.render(screen)
    for player in players:
        player.update(event)
        player.render(screen)
    def update( self ):
        self.production.reset()
        self.consumption.reset()
        self.stockpile.reset()

        self.population = 0
        self.military = 0
        self.youth = 0
        
        for city in self.cities:
            city.update()
            self.production += city.production
            self.consumption += city.consumption
            self.stockpile += city.stockpile

            self.population += city.population
            self.military += city.military
            self.youth += city.youth

        self.change = self.production - self.consumption
    def tick( self ):
        "Perform one tick of the simulation"

        self.out.log("-" * 79)
        self.out.log("Faction: '%s' beginning tick." % self.name)

        # handle our resources
        self.out.log( "Initial Stockpile: %s." % repr(self.stockpile) )

        for city in self.cities:
            city.update()
            city.tick()
        self.update()
        
        self.out.log( "Consumption: %s." % repr(self.consumption) )
        self.out.log( "Production: %s." % repr(self.production) )
        self.out.log( "Final Stockpile: %s." % repr(self.stockpile) )
        

        self.out.log("Faction has completed tick.")
        self.out.log("-" * 79)
Example #4
0
def update():
    db_init()
    ### = master
    city.update()