本文整理汇总了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