def stateCallback(ctrl, state): if state == Controller.State.ALLOCATING: show('Allocating transposition and proof tables...') elif state == Controller.State.SEARCHING: show('... Done. Commencing search.') global start, startCpu start = time.time() startCpu = clock()
controller.searchProgressCallbacks.add(printProgress) show('Starting search. Pres Control-C to stop the search at any time.') try: controller.runSearch(burst=1000) except RuntimeError, e: print >> sys.stderr, \ 'Internal error has occured; this is likely a bug.\n\n' + str(e) raise SystemExit(EXIT_ERROR) except MemoryError: print >> sys.stderr, \ 'Error: The program ran out of memory while trying to expand the tree.' raise SystemExit(EXIT_ERROR) end = time.time() endCpu = clock() exitStatus = None if not args.quiet or args.noProgress: print 'Search finished:', if controller.root.proofNumber == 0: print 'Root vertex is proved' exitStatus = EXIT_FINISHED elif controller.root.disproofNumber == 0: print 'Root vertex is disproved' exitStatus = EXIT_FINISHED elif params.timeLimit > 0 and \ controller.stats.timeElapsed >= params.timeLimit: print 'Time limit exceeded' exitStatus = EXIT_LIMIT