players.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:TicTacTio 作者: DevelopForLizardz 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号