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


Python Problem.autFinal方法代码示例

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


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

示例1: parseProblem

# 需要导入模块: from problem import Problem [as 别名]
# 或者: from problem.Problem import autFinal [as 别名]
    def parseProblem(it):
        '''parseProblem(it)

Parses top file structures of a problem in a file.  Modifies it.
'''
        problem = Problem()
        for line in it:
            if (line[0:2] == "//"): # comments
                pass
            elif (line == ""): # empty string
                pass
            elif reOptionEncoding.match(line):
                match = reOptionEncoding.match(line)
                assert match is not None
                problem.encoding = match.group('name')
            elif (reOptionNoParam.match(line)): # option
                match = reOptionNoParam.match(line)
                assert match is not None
                problem.options.append(match.group('option'))
            elif (reOptionWithParam.match(line)): # option with parameter
                match = reOptionWithParam.match(line)
                assert match is not None
                problem.options.append(match.group('option'))
            elif (reAutDefStart.match(line)): # beginning of an automaton
                name = reAutDefStart.match(line).group('autname')
                if name == "I0": # aut for initial configurations
                    problem.autInit = Parser.parseAut(problem, it)
                elif name == "F": # aut for final configurations
                    problem.autFinal = Parser.parseAut(problem, it)
                elif name == "P1": # aut for Player 1
                    problem.autPlay1 = Parser.parseAut(problem, it)
                elif name == "P2": # aut for Player 2
                    problem.autPlay2 = Parser.parseAut(problem, it)
                elif name == "Enabled": # aut for Enabled
                    problem.autEnabled = Parser.parseAut(problem, it)
                else:
                    problem.misc[name] = Parser.parseAut(problem, it)
                    # raise Exception("Invalid automaton name: " + name)
            else:
                raise Exception("Syntax error: " + line)

        # # process encoding if present
        # for option in problem.options:
        #     print("Option " + option, file=sys.stderr)
        #     if reOptionEncoding.match(option):
        #         match = reOptionEncoding.match(option)
        #         assert match is not None
        #         problem.encoding = match.group('name')

        return problem
开发者ID:uuverifiers,项目名称:autosat,代码行数:52,代码来源:parser.py


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