def getMove(self, timeout=60):
"""
Gets the necessary input from the board then calls the TTTNeuralNet's getMove function, passing said input
:param timeout: Added to match signature of method in parent class
"""
move = self.game.board.translateNumToPos(self.neuralNet.getMove(self.game.turn, self.game.board.sBoard))
self.playPiece(move)
self.game.board.cursorPos = self.game.board.getEmptySpace()
if self.game.board.cursorPos is not None:
self.game.board.updateCursor()
pygame.display.flip()
self.game.clock.tick(self.game.fps)
pygame.event.post(pygame.event.Event(pygame.USEREVENT, {})) # posting an event keeps the game loop going
return move
# this is here for when the multiplayer will be properly added
评论列表
文章目录