本文整理汇总了Python中fysom.Fysom.reset方法的典型用法代码示例。如果您正苦于以下问题:Python Fysom.reset方法的具体用法?Python Fysom.reset怎么用?Python Fysom.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fysom.Fysom
的用法示例。
在下文中一共展示了Fysom.reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from fysom import Fysom [as 别名]
# 或者: from fysom.Fysom import reset [as 别名]
#.........这里部分代码省略.........
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 = {}
currentLine["searchingDepth"] = gameStatus["moveDepths"][move]
currentLine["moves"] = gameStatus["JSONmoves"][:]
gameStatus["JSONlines"].append(currentLine)
self.boomerang.noMoves()
def onwait(e):
self.initialize.reset()
self.search.reset()
self.explore.reset()
self.initialize = Fysom(
{
"initial": "init",
"events": [
{"name": "uci", "src": "init", "dst": "stockfish"},
{"name": "isready", "src": "stockfish", "dst": "uciok"},
{"name": "reset", "src": "uciok", "dst": "init"},
],
"callbacks": {"onstockfish": onstockfish, "onuciok": onuciok},
}
)
self.search = Fysom(
{
"initial": "init",
"events": [
{"name": "newgame", "src": "init", "dst": "godepth"},
{"name": "searching", "src": "godepth", "dst": "godepth"},
{"name": "makemove", "src": "godepth", "dst": "move"},
{"name": "searching", "src": "move", "dst": "godepth"},
{"name": "newgame", "src": "move", "dst": "godepth"},
{"name": "reset", "src": "move", "dst": "init"},
],
"callbacks": {"onnewgame": onnewgame, "onmove": onmove},
}
)
self.explore = Fysom(
{
"initial": "init",
示例2: __init__
# 需要导入模块: from fysom import Fysom [as 别名]
# 或者: from fysom.Fysom import reset [as 别名]
#.........这里部分代码省略.........
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 = {}
currentLine["searchingDepth"] = gameStatus["moveDepths"][move]
currentLine["moves"] = gameStatus["JSONmoves"][:]
gameStatus["JSONlines"].append(currentLine)
self.boomerang.noMoves()
def onwait(e):
self.initialize.reset()
self.search.reset()
self.explore.reset()
self.initialize = Fysom({'initial': 'init',
'events': [{'name': 'uci','src':'init','dst':'stockfish'},
{'name': 'isready','src':'stockfish','dst':'uciok'},
{'name': 'reset','src':'uciok','dst':'init'}],
'callbacks': {
'onstockfish': onstockfish,
'onuciok': onuciok } })
self.search = Fysom({'initial': 'init',
'events': [{'name': 'newgame','src':'init','dst':'godepth'},
{'name': 'searching','src':'godepth','dst':'godepth'},
{'name': 'makemove','src':'godepth','dst':'move'},
{'name': 'searching','src':'move','dst':'godepth'},
{'name': 'newgame','src':'move','dst':'godepth'},
{'name': 'reset','src':'move','dst':'init'}],
'callbacks': {
'onnewgame': onnewgame,
'onmove': onmove} })
self.explore = Fysom({'initial': 'init',
'events': [{'name': 'ucinewgame','src':'init','dst':'goinfinite'},
{'name': 'infinite','src':'goinfinite','dst':'goinfinite'},
{'name': 'move','src':'goinfinite','dst':'bestmove'},
{'name': 'infinite','src':'bestmove','dst':'goinfinite'},
{'name': 'ucinewgame','src':'bestmove','dst':'goinfinite'},
{'name': 'mate','src':'bestmove','dst':'end'},
{'name': 'reset','src':'bestmove','dst':'init'}],
'callbacks': {
'onucinewgame': onucinewgame,