当前位置: 首页>>代码示例>>Python>>正文


Python Fysom.makemove方法代码示例

本文整理汇总了Python中fysom.Fysom.makemove方法的典型用法代码示例。如果您正苦于以下问题:Python Fysom.makemove方法的具体用法?Python Fysom.makemove怎么用?Python Fysom.makemove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fysom.Fysom的用法示例。


在下文中一共展示了Fysom.makemove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from fysom import Fysom [as 别名]
# 或者: from fysom.Fysom import makemove [as 别名]

#.........这里部分代码省略.........
            else:
                gameStatus["player"] = "w"

            JSONmove = {}
            JSONmove["move"] = bestMove
            JSONmove["cp"] = str(cp)
            JSONmove["player"] = gameStatus["player"]
            gameStatus["JSONmoves"].append(JSONmove)

            gameStatus["moves"].append(e.args[0])

            if gameStatus["currentMove"] < totalMoves:
                self.manager.position(startpos, fen, moves)
                self.manager.go(e.args[2])

        def ongodeeper(e):
            movesList = e.args[0]
            movesListCP = e.args[1]
            totaDepth = e.args[2]
            gameStatus = e.args[3]
            cp = e.args[4]

            currentDepth = 1
            self.search.newgame(gameStatus)
            while currentDepth <= self.searchingDepth:
                currentDepth += 1
                while True:
                    res = self.manager.get()
                    if re.search("^info", res):
                        self.search.searching()
                        ongodepth(res, cp)
                    if re.search("^bestmove (?P<move>\w+) ", res):
                        bestmove = re.search("^bestmove (?P<move>\w+) ", res)
                        self.search.makemove(
                            bestmove.group("move"),
                            movesList,
                            movesListCP,
                            currentDepth,
                            self.searchingDepth,
                            cp,
                            gameStatus,
                        )
                        break

        def onexplore(e):
            gameStatus = e.args[4]

            movesList = e.args[0]
            movesListCP = e.args[1]
            totalMoves = e.args[2]
            exploreDepth = e.args[3]

            startpos = gameStatus["startpos"]

            for key in gameStatus["moveDepths"].keys():
                move = key
                gameStatus["moves"] = [move]
                gameStatus["currentMove"] = 1
                gameStatus["player"] = gameStatus["startPlayer"]

                self.explore.ucinewgame(exploreDepth, startpos, move, gameStatus)
                while True:
                    res = self.manager.get()
                    if re.search("^info", res):
                        self.explore.infinite()
                        onsearch(res, gameStatus)
开发者ID:Nixonite,项目名称:chesscomputer,代码行数:70,代码来源:boomerang_server.py

示例2: __init__

# 需要导入模块: from fysom import Fysom [as 别名]
# 或者: from fysom.Fysom import makemove [as 别名]

#.........这里部分代码省略.........
			else:
				gameStatus["player"] = 'w'
			
			JSONmove = {}
			JSONmove["move"] = bestMove
			JSONmove["cp"] = str(cp)
			JSONmove["player"] = gameStatus["player"]
			gameStatus["JSONmoves"].append(JSONmove)
			
			gameStatus["moves"].append(e.args[0])

			if (gameStatus["currentMove"]<totalMoves):
				self.manager.position(startpos, fen, moves)
				self.manager.go(e.args[2])

		def ongodeeper(e):
			movesList = e.args[0]
			movesListCP = e.args[1]
			totaDepth = e.args[2]
			gameStatus = e.args[3]
			cp = e.args[4]
			
			currentDepth = 1
			self.search.newgame(gameStatus)
			while currentDepth <= self.searchingDepth:
				currentDepth += 1
				while True:
					res = self.manager.get()
					if re.search('^info', res):
						self.search.searching()
						ongodepth(res, cp)
					if re.search('^bestmove (?P<move>\w+) ', res):
						bestmove = re.search('^bestmove (?P<move>\w+) ', res)
						self.search.makemove(bestmove.group('move'), movesList, movesListCP, currentDepth, self.searchingDepth, cp, gameStatus)
						break
				
		def onexplore(e):
			gameStatus = e.args[4]
			
			movesList = e.args[0]
			movesListCP = e.args[1]
			totalMoves = e.args[2]
			exploreDepth = e.args[3]

			startpos = gameStatus["startpos"]

			for key in gameStatus["moveDepths"].keys():
				move = key
				gameStatus["moves"] = [move]
				gameStatus["currentMove"] = 1
				gameStatus["player"] = gameStatus["startPlayer"]

				self.explore.ucinewgame(exploreDepth, startpos, move, gameStatus)
				while True:
					res = self.manager.get()
					if re.search('^info', res):
						self.explore.infinite()
						onsearch(res, gameStatus)
					if re.search('^bestmove (?P<move>\w+) ', res):
						bestmove = re.search('^bestmove (?P<move>\w+) ', res)
						self.explore.move(bestmove.group('move'), gameStatus, exploreDepth, totalMoves, move)

					if (gameStatus["currentMove"]>=totalMoves):
						break
						
				currentLine = {}
开发者ID:M0nd4,项目名称:chesscomputer,代码行数:70,代码来源:boomerang_server.py


注:本文中的fysom.Fysom.makemove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。