def update(self, state): numAgents = len(state.agentStates) self.agentCounter = (self.agentCounter + 1) % numAgents if self.agentCounter == 0: self.turn += 1 if DISPLAY_MOVES: ghosts = [ pacman.nearestPoint(state.getGhostPosition(i)) for i in range(1, numAgents) ] print( ( "%4d) P: %-8s" % ( self.turn, str(pacman.nearestPoint(state.getPacmanPosition())), ), "| Score: %-5d" % state.score, "| Ghosts:", ghosts, ) ) if self.turn % DRAW_EVERY == 0: self.draw(state) self.pause() if state._win or state._lose: self.draw(state)
def update(self, state): numAgents = len(state.agentStates) self.agentCounter = (self.agentCounter + 1) % numAgents if self.agentCounter == 0: self.turn += 1 if displaymoves: ghosts = [pacman.nearestPoint(state.getGhostPosition(i)) for i in range(1, numAgents)] print("%4d) P: %-8s" % (self.turn, str(pacman.nearestPoint(state.getPacmanPosition()))),"| Score: %-5d" % state.score,"| Ghosts:", ghosts) if self.turn % drawevery == 0: self.draw(state) self.pause()
def update(self, state): numAgents = len(state.agentStates) self.agentCounter = (self.agentCounter + 1) % numAgents if self.agentCounter == 0: self.turn += 1 if DISPLAY_MOVES: ghosts = [pacman.nearestPoint(state.getGhostPosition(i)) for i in range(1, numAgents)] print "%4d) P: %-8s" % (self.turn, str(pacman.nearestPoint(state.getPacmanPosition()))),'| Score: %-5d' % state.score,'| Ghosts:', ghosts if self.turn % DRAW_EVERY == 0: self.draw(state) self.pause() if state._win or state._lose: self.draw(state)
def update(self, state, total_pacmen, agent, agentIndex, deadPacman, deadPacmanIndex): numAgents = len(state.agentStates) self.agentCounter = (self.agentCounter + 1) % numAgents if self.agentCounter == 0: self.turn += 1 if DISPLAY_MOVES: ghosts = [ pacman.nearestPoint(state.getGhostPosition(i)) for i in range(1, numAgents) ] print( "%4d) P: %-8s" % (self.turn, str(pacman.nearestPoint(state.getPacmanPosition()))), '| Score: %-5d' % state.score, '| Ghosts:', ghosts) if self.turn % DRAW_EVERY == 0: self.draw(state) self.pause() if state._win or state._lose: self.draw(state)