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


Python Log.write_log方法代码示例

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


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

示例1: MinMax

# 需要导入模块: from logger import Log [as 别名]
# 或者: from logger.Log import write_log [as 别名]
class MinMax():
    def __init__(self, gui, game):
        self.gui = gui
        self.game = game
        self.log = Log()

    def run(self):
        try:
            # Create a state of the initial game
            self.state = State(self.game.grid)

            free, highest = self.state.free_tiles()
            # Run the algorithm one step
            if free <= 1:
                root = TreeNode(self.state, None, 7)
            elif free <= 2:
                root = TreeNode(self.state, None, 6)
            elif free <= 3:
                root = TreeNode(self.state, None, 4)
            elif free <= 6:
                root = TreeNode(self.state, None, 3)
            else:
                root = TreeNode(self.state, None, 3)

            # root = TreeNode(self.state, None, 4)

            # Chose dept depentdent on free tiles
            direc, way = root.get_move()

            # Log the move
            if way is None:
                # self.log.write_log()
                pass
            else:
                self.log.add_log(copy.deepcopy(self.game.grid), way)
                self.log.write_log()

            return direc, highest
        except Exception, err:
            eprint(err)
开发者ID:krekle,项目名称:aiProg,代码行数:42,代码来源:algorithm.py


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