예제 #1
0
 def __init__(self, size, playerNum, maxFoodNum, sight_radius,
              sight_sideways, mode):
     pygame.init()
     self.size = size
     self.playerNum = playerNum
     self.maxFoodNum = maxFoodNum
     self.sight_radius = sight_radius
     self.simulationMode = mode
     self.sight_sideways = sight_sideways
     self.mode = mode
     #self.screen = pygame.Surface((2*(size[0]+2*sight_radius),2*(size[1]+2*sight_radius)),0,32)
     self.screen = pygame.display.set_mode(
         (2 * (size[0] + 2 * sight_radius), 2 *
          (size[1] + 2 * sight_radius)), 0, 32)
     self.epsCounter = 0
     app = Generator(size, 7, 8)
     app.initialiseMap()
     app.simulate(2)
     self.map = app.booleanMap
     self.state = gameplay.State(self.sight_sideways,
                                 self.sight_radius,
                                 self.playerNum,
                                 self.maxFoodNum,
                                 self.size,
                                 self.map,
                                 obsMode=self.mode)
     self.display = Draw.Display(self.screen, self.state, self.sight_radius)
예제 #2
0
 def __init__(self, size, playerNum, maxFoodNum, sight_radius,
              sight_sideways, mode):
     pygame.init()
     self.size = size
     self.simulationMode = mode
     self.playerNum = playerNum
     self.maxFoodNum = maxFoodNum
     self.sight_radius = sight_radius
     self.sight_sideways = sight_sideways
     self.screen = pygame.Surface((2 * (size[0] + 2 * sight_radius), 2 *
                                   (size[1] + 2 * sight_radius)), 0, 32)
     self.state = gameplay.State(self.sight_sideways,
                                 self.sight_radius,
                                 self.playerNum,
                                 self.maxFoodNum,
                                 self.size,
                                 obsMode=mode)
     self.display = Draw.Display(self.screen, self.state, self.sight_radius)
     self.epsCounter = 0
     self.clock = pygame.time.Clock()
     self.playerTimer = 0
     self.tickWait = 0