Exemplo n.º 1
0
 def newGame(
     self,
     layout,
     pacmanAgent,
     ghostAgents,
     display,
     quiet=False,
     catchExceptions=False,
 ):
     agents = [pacmanAgent] + ghostAgents[: layout.getNumGhosts()]
     initState = GameState()
     initState.initialize(layout, len(ghostAgents))
     game = Game(agents, display, self, catchExceptions=catchExceptions)
     game.state = initState
     self.initialState = initState.deepCopy()
     self.quiet = quiet
     return game
Exemplo n.º 2
0
 def newGame(self, layout, agents, display, length, muteAgents,
             catchExceptions):
     initState = GameState()
     initState.initialize(layout, len(agents))
     starter = random.randint(0, 1)
     print(('%s' % ['Red', 'Blue'][starter]))
     game = Game(agents,
                 display,
                 self,
                 startingIndex=starter,
                 muteAgents=muteAgents,
                 catchExceptions=catchExceptions)
     game.state = initState
     game.length = length
     game.state.data.timeleft = length
     if 'drawCenterLine' in dir(display):
         display.drawCenterLine()
     self._initBlueFood = initState.getBlueFood().count()
     self._initRedFood = initState.getRedFood().count()
     return game