コード例 #1
0
def add_option_group(parser):
    """Add Macro_Simulator options group to an OptParser parser object."""
    assert isinstance(parser, OptionParser)

    group = OptionGroup(parser, "Macro Simulator options")

    group.add_option("--steps",
                     type=int,
                     default=INF,
                     help="Max steps to run each simulation (0 for infinite). "
                     "[Default: infinite]")
    group.add_option("--time",
                     type=float,
                     default=15.0,
                     help="Max seconds to run each simulation. "
                     "[Default: %default]")
    group.add_option("--tape-limit",
                     type=int,
                     default=50,
                     help="Max tape size to allow.")
    group.add_option("--no-ctl",
                     dest="ctl",
                     action="store_false",
                     default=True,
                     help="Don't try CTL optimization.")

    parser.add_option_group(group)

    Simulator.add_option_group(parser)
    Block_Finder.add_option_group(parser)
コード例 #2
0
ファイル: Quick_Sim.py プロジェクト: nickdrozd/busy-beaver
  parser.add_option("-v", "--verbose", action="store_true",
                    help="Print step-by-step informaion from simulator "
                    "and prover (Overrides other --verbose-* flags).")
  parser.add_option("-l", "--loops", type=int, default=0,
                    help="Specify a maximum number of loops.")
  parser.add_option("--print-loops", type=int, default=10000, metavar="LOOPS",
                    help="Print every LOOPS loops [Default %default].")
  parser.add_option("--csv", action="store_true",
                    help="Read input file as CSV not standard format.")

  parser.add_option("--manual", action="store_true",
                    help="Don't run any simulation, just set up simulator "
                    "and quit. (Run as python -i Quick_Sim.py to interactively "
                    "run simulation.)")

  Simulator.add_option_group(parser)
  Block_Finder.add_option_group(parser)

  (options, args) = parser.parse_args()

  if options.quiet:
    options.verbose_simulator = False
    options.verbose_prover = False
    options.verbose_block_finder = False
  elif options.verbose:
    options.verbose_simulator = True
    options.verbose_prover = True
    options.verbose_block_finder = True

  if options.loops and options.print_loops > options.loops:
    options.print_loops = options.loops